Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
"""
Creates a new OWLRL Inference session
"""
self.g = Graph(load_brick=True)
def __init__(self):
"""
Creates a new OWLRL Inference session
"""
self.g = Graph(load_brick=True)
def __init__(self):
"""
Creates new Tag Inference session
"""
self.g = Graph(load_brick=True)
# get ontology data from package
data = pkgutil.get_data(__name__, "ontologies/taglookup.pickle")
# TODO: move on from moving pickle to something more secure?
self.lookup = pickle.loads(data)
def infer_model(self, model):
"""
Produces the inferred Brick model from the given Haystack model
Args:
model (dict): a Haystack model
"""
entities = model['rows']
# index the entities by their ID field
entities = {e['id'].replace('"', ''): {'tags': e} for e in entities}
brickgraph = Graph(load_brick=True)
# marker tag pass
for entity_id, entity in entities.items():
marker_tags = {k for k, v in entity['tags'].items()
if v == 'm:' or v == 'M'}
for f in self._filters:
marker_tags = list(filter(f, marker_tags))
# translate tags
entity_tagset = list(map(lambda x: self._tagmap[x.lower()]
if x in self._tagmap else x, marker_tags))
# infer tags for single entity
triples, _ = self.infer_entity(entity_tagset, identifier=entity_id)
brickgraph.add(*triples)
# take a pass through for relationships
for entity_id, entity in entities.items():
def __init__(self):
"""
Creates a new OWLRL Inference session
"""
self.g = Graph(load_brick=True)