2

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.

kllo
  • 53
  • 4
  • AllegroGraph is an RDF store so should be able to apply inference rules with OWL and/or RDFS statements and load through the Web View. I don't have a definite answer for you inference issue but it sounds like you require OWL 2 property chains [http://stackoverflow.com/questions/22792359/using-property-chains-to-get-inferred-knowledge-in-an-owl-ontologyprotege] [http://www.w3.org/TR/owl2-primer/]. – Anthony Hughes Dec 06 '15 at 02:22
  • If you're not locked into AllegroGraph, Stardog offers almost *exactly* the syntax you describe for its rule language, which uses the SWRL semantics. – Michael Dec 06 '15 at 02:30
  • @Michael thanks, I will give it a try if I find it is almost impossible to achieve it with AG. – kllo Dec 07 '15 at 14:12
  • @AnthonyHughes thanks for pointing out OWL2 property chain. seems exactly the feature that I am looking for. – kllo Dec 07 '15 at 14:17

1 Answers1

0

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}
       }
    ...
scotthenninger
  • 3,921
  • 1
  • 15
  • 24