Anonymous avatar 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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.