|
Using SipStrategy (RIF/OWL/OWL2/SPARQL proof theory) IntroductionNative Prolog-like Python implementation for RIF-Core, OWL, and SPARQL DetailsTakes a query (a python 3-tuple / triple of RDFLib terms), a fact graph used in the GMS transformation, a sip collection formed via PrepareSipCollection run against the factGraph and its adorned program, and a list of apriori derived predicates initial bindings from FuXi.Rete.TopDown import PrepareSipCollection, SipStrategy First we import the helper functions for rule in MagicSetTransformation(factGraph,
rules,
goals,
dPreds):
network.buildNetworkFromClause(rule) First we build a network from the rule resulting from applying the GMS method on a fact graph, a RIF-Core ruleset, a list of goals / queries, and derived predicates. ans,ns = first(SipStrategy(
goal,
PrepareSipCollection(factGraph.adornedProgram),
factGraph,
dPreds))
Then we fetch the first answer to our goal / query. It will come with a NodeSet object, logically representing the PML document
|