semantic-webowlrdfsallegrograph

Is it possible to add customized rules to infer new relations in AllegroGraph?


In my data there are two triples:

entity1 doA entity2 .
entity2 doB entity3 .

I am looking for a way to infer the following triple and have it back in the outcome of my SPARQL query (e.g., select ?a ?c {?a doC ?c)) :

entity1 doC entity3 .

Basically, I want to say:

IF (?a doA ?b) and (?b doB ?c) THEN (?a doC ?c)

Note, I am looking for a solution that can be completely implemented using the AGWebView interface.


Solution

  • If AllegroGraph supports SPARQL 1.1m then you could try:

    INSERT {?a <doC> ?c}
    WHERE {
       ?a <doA> ?b .
       ?b <doB> ?c .
    }
    

    That inserts into the default graph, however that is defined. To direct to a specific graph, then add a GRAPH statement to the insert:

    INSERT { GRAPH <graph-uri> {
                ?a <doC> ?c}
           }
        ...