SPARQL Rules

RDF Rules can be written as SPARQL construct-where rules:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
<!ENTITY rdf   "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY rdfs  "http://www.w3.org/2000/01/rdf-schema#">
<!ENTITY rul   "http://ns.inria.fr/edelweiss/2011/rule#">
]>

<rdf:RDF xmlns:rdfs="&rdfs;" xmlns:rdf="&rdf;"   xmlns = '&rul;' >
 
<rule>
<body>
<![CDATA[
construct  {
?x rdf:type ?d
} 
where { 
?p rdfs:domain ?d
?x ?p ?y
}
]]>
</body>
</rule>

</rdf:RDF>

Rule Engine

RuleEngine engine = RuleEngine.create(graph);
RuleLoad ld = RuleLoad.create(engine);
ld.load("rule.rul");
engine.process();