rdfowlsesameblazegraph

RDF--How do I make a transitive property shift, based on the rdf:type?


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.


Solution

  • 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.