Hi, I am facing issue while using custom inference rules in marklogic 8.0. Here is the scenario:
1. create data PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX place: <http://example.com/places/> PREFIX ex: <http://example.com/> PREFIX bank: <http://example.com/banks/> INSERT DATA { GRAPH <http://marklogic.com/semantics/sb/banks/inf-1> { bank:1001 rdf:type ex:bank ; ex:name "rbs" ; ex:service "loan" , "asset management" , "fx" ; place:name "london" . bank:1002 rdf:type ex:bank ; ex:name "rbi" ; ex:service "loan" , "retail banking" , "guide lines" ; place:name "delhi" . } } #------------- Define some places and their relationships------------- DROP SILENT GRAPH <http://marklogic.com/semantics/sb/places/inf-1> ; CREATE GRAPH <http://marklogic.com/semantics/sb/places/inf-1> ; PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX place: <http://example.com/places/> PREFIX ex: <http://example.com/> INSERT DATA { GRAPH <http://marklogic.com/semantics/sb/places/inf-1> { place:1001 rdf:type ex:country ; ex:name "uk" ; ex:isin "Europe" . place:1002 rdf:type ex:city ; ex:name "london" ; ex:isin "uk" . } } 2. Query w/o inference PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.com/> PREFIX bank: <http://example.com/banks/> PREFIX place: <http://example.com/places/> SELECT ?b FROM <http://marklogic.com/semantics/sb/banks/inf-1> WHERE { ?b rdf:type ex:bank ; place:name "london" } 3. I know how to use inference via creating ontology data: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX ex: <http://example.com/> INSERT DATA { GRAPH <http://marklogic.com/semantics/sb/banks/inf-1> { ex:city rdfs:subClassOf ex:country . } } ------------------------- 4. Now, what I am trying to do is; achieve this via creating custom rules file. I have created "bankAt.rules" file under schemas database. Here is the code: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema/> PREFIX ex: <http://example.com/> PREFIX gn: <http://www.geonames.org/ontology/> rule "bankAt" CONSTRUCT { ?bank ex:bankAt ?place2 } { ?bank ex:bankAt ?place1 . ?place1 gn:parentFeature ?place2 } I dont know how to use this rules file in my sparql query. I would be really helpful if someone can just list down the steps on "how to use this rule in sparql query". Regards, Prateek Jain -------------------------------------------------------------- EXPECTATION : Causes all troubles...... --------------------------------------------------------------
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
