3

I'm trying to find a way to infer/propogate a property based on types to prevent name collision:

:AOrder :Store :AStore ;
        a :OrderType ;
        :user :AUser .

:AStore :name "Store Name";
        a :StoreType

:AUser :name "Some User";
       a :UserType

Based on the triples above, I'd like to infer several other triples:

:AOrder :storeName "Store Name" .
:AOrder :userName "Some User" .

How can I do this? FYI, I'm currently using Bigdata and Sesame.

One way would be to use SPIN, but it doesn't seem like Bigdata + Sesame have it; it looks like Jena is the only thing out there with something comparable.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Michael Kohout
  • 1,073
  • 1
  • 14
  • 26

1 Answers1

1

You could express this using a SPARQL update operation:

INSERT { 
  ?x :storeName ?store_name ; 
     :userName ?user_name . 
 }
 WHERE { 
  ?x a :OrderType;
     :Store [ :name ?store_name ] ;
     :user [ :name ?user_name ] .
 }

Execute this operation whenever your store is updated (if you're working locally you can use a RepositoryListener to intercept change events) and the triples you want will be inserted.

Alternatively, look at some of the custom reasoning tools available for Sesame. I'm not sure Bigdata supports a custom reasoner, but you could have a look at this custom rule-based reasoner extension (although it's slightly out of date). Or take a look at OWLIM, which is a Sesame backend with OWL reasoning capabilities, which also supports custom rules.

Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73
  • Thanks for your reply-I ended up going with Jena + Jena Rules. But anyway, do you know how the custom reasoner you posted deals with entailment/reasoned triples? Does it just add everything to the existing store, making it impossible to tell what's inferred and what's base data? – Michael Kohout Dec 09 '11 at 08:32
  • No, because first of all Sesame supports a distinction between explicit and inferred triples at the API level, so you will always be able to keep tell which is which. In addition, the custom reasoner uses a separate context for inferred triples. – Jeen Broekstra Jan 02 '12 at 07:03