You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Marvin Luchs <ma...@luchs.org> on 2013/09/23 14:19:54 UTC

inference support when querying triple collection

Hello everybody,

for my master's thesis I'm working on a custom Stanbol Module. Its concrete purpose is not important. Basically I...


1.       create a new triple collection using the TC Manager from Clerezza:


tcManager.createMGraph(graphName);



2.  import an Ontology which contains the Schema.org ontology amongst others:

OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

OWLOntology ontology = manager.loadOntologyFromOntologyDocument(content);

tripleCollection.addAll(OWLAPIToClerezzaConverter.owlOntologyToClerezzaMGraph((OWLOntology) ontology));



3.  import a whole bunch of RDF statements:

Parser parser = Parser.getInstance();

Graph rdfData = parser.parse(inputStream, format);
tripleCollection.addAll(rdfData);


Up to this point everything works fine. However, I ran into an issue when I wanted to query that triple collection using types from Schema.org. For example I have some entity which is of type schema:Movie. My ontology states that schema:Movie is rfds:subClassOf schema:CreativeWork which in turn is rfds:subClassOf schema:Thing. However it seems, that not there's no automatic inference that schema:Movie is also a subclass of schema:Thing.

I tried it using this query:

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema:<http://schema.org/>
SELECT ?type ?label {
       <http://example.org/SomeEntity> rdf:type ?type .
        ?type rdfs:subClassOf schema:Thing .
        ?type rdfs:label ?label .
}

... and this method:

tcManager.executeSparqlQuery(
       QueryParser.getInstance().parse(query),
       tripleCollection
);

Before I started implementing my project in Stanbol I imported my ontology as well as all the RDF files into a Sesame repository. With that repository the query worked fine as Sesame automatically inferred that SomeEntity is of type schema:Thing.

Is  there any way to configure an inference like this for the triple store that's used by Clerezza (Jena I Think?) in this example?

Best regards,
Marvin Luchs

PS: @Reto Bachmann-Gmür: Thanks a lot for your "Instant Apache Stanbol" E-Book! I already decided to implement my project independently of Stanbol, but your book came out just in time to change my mind :-)