stanbol-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmür <r...@wymiwyg.com>
Subject Fwd: inference support when querying triple collection
Date Mon, 23 Sep 2013 17:20:26 GMT
Forwarding this Mail from the Stanbol Mailing list to clerezza dev as the
question seems equally related to clerezza.

For the Jena based backend provider it should be quite straight forward to
enable inference on particular (or all) graphs. But if ontologymanager
provides a graph with all the inferences this could be registered with
TcManager as to allow sparql queries over it. This latter approach would
have the advantage of being independent of the storage used.

Cheers,
Reto

PS: Glad to hear so! Hope you enjoy the reading.

---------- Forwarded message ----------
From: Marvin Luchs <marvin@luchs.org>
Date: Mon, Sep 23, 2013 at 2:30 PM
Subject: inference support when querying triple collection
To: "dev@stanbol.apache.org" <dev@stanbol.apache.org>


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 :-)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message