Commits

Anonymous committed e1ed4b7

owl fixture...

Comments (0)

Files changed (1)

ordf/vocab/owl.py

 
 """
 
+##
+## Data fixtures for ORDF
+##
+def rdf_data():
+    from logging import getLogger
+    log = getLogger(__name__)
+    graph_uri = OWL[""][:-1]
+    log.info("Fetching %s" % graph_uri)
+    g = Graph(identifier=graph_uri).parse(graph_uri)
+    log.info("Parsed %s (%d triples)" % (graph_uri, len(g)))
+    yield g
+
+def inference_rules(handler, network):
+    ### owl-rules.n3 doesn't parse properly!!
+    from FuXi.Horn.HornRules import HornFromN3
+    import os, pkg_resources
+    rule_file = pkg_resources.resource_filename("ordf.vocab", os.path.join("n3", "owl-rules.n3"))
+    rules = HornFromN3(rule_file)
+    for rule in rules:
+        network.buildNetworkFromClause(rule)
+    return rules
+
 # definition of an Infix operator class
 # this recipe also works in jython
 # calling sequence for the infix is either: