You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Maatry Daniel Okouya <ok...@yahoo.fr> on 2013/11/27 02:04:28 UTC

Named Graph, TBD, OWL2, OWL-API, Pellet

Hi, 

I am working on a project focused on OWL. Recently we came up with the requirement to deal with multiple owl ontologies interconnected with each other using the named graph approach.

I have two questions on the matter:

1-Is there any tool (i suppose triple store) that support that ?( I understood that when it comes to pure RDF, Jena TDB could handle that. Just not sure upfront with OWL DL. Although i suppose so….)

2-I’m currently heavily relying on OWL-API and Pellet, can TBD allow me to keep working with the OWL API, to update my ontologies at runtime, while providing me with the triple store management ? 

I saw some interesting code on the pellet website that show some interoperability between Jena and the OWL-API trough the Pellet API. I just don’t know how effective that can be: 



>>>>>

How can I run SPARQL queries with OWLAPI?
There is no native SPARQL support in OWLAPI. However, a Jena model can be created with the contents of an OWLAPI reasoner so SPARQL query answering can be done on the Jena model.OWLAPI reasoner and Jena model can be queried together but all updates should be done on theOWLAPI ontology. The following snippet shows the general idea behind this approach:

   // import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
   // import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;

   // Create OWLAPI ontology as usual
   OWLOntology ontology = ...
   // Create Pellet-OWLAPI reasoner (non-buffering mode makes synchronization easier)
   PelletReasoner reasoner =  
         PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
   // Get the KB from the reasoner
   KnowledgeBase kb = reasoner.getKB();
   // Create a Pellet graph using the KB from OWLAPI
   PelletInfGraph graph = new org.mindswap.pellet.jena.PelletReasoner().bind( kb );
   // Wrap the graph in a model
   InfModel model = ModelFactory.createInfModel( graph );
   // Use the model to answer SPARQL queries

The model created this way cannot be used to answer SPARQL queries that query for RDF syntax triples, e.g. SELECT * WHERE { ?x owl:onProperty ?p }.

Re: Named Graph, TBD, OWL2, OWL-API, Pellet

Posted by Dave Reynolds <da...@gmail.com>.
?? You're the one who said you had a requirement to use a named graph 
approach. I was just trying to answer your question, not advocate that 
as an approach.

If all you want is multiple of in-memory ontologies that you access 
separately through an API then you an do that in Jena or OWL-API with 
equal ease. [Well it's certainly easy in Jena, not used OWL-API myself.]

A possible reason for using named graphs might be if you want to SPARQL 
query over the assembly of those ontologies (e.g. to lookup a term and 
figure out which ontology, i.e. which graph, it is in).

Dave

On 27/11/13 16:21, Maatry Daniel Okouya wrote:
>
> Many thanks for your answer.
>
> Just to understand,
>
> what would be exactly the advantage of named graph as provided by store
> over implementing a custom similar approach within the OWL-API. I mean i
> could very well, have several in-memory ontology within the OWL-API, and
> use namedIndividual where necessary to refer to them.
>
>
> ------------------------------------------------------------------------
> From: Dave Reynolds Dave Reynolds <ma...@gmail.com>
> Reply: users@jena.apache.org users@jena.apache.org
> <ma...@jena.apache.org>
> Date: November 27, 2013 at 9:22:16 AM
> To: users@jena.apache.org users@jena.apache.org
> <ma...@jena.apache.org>
> Subject: Re: Named Graph, TBD, OWL2, OWL-API, Pellet
>>
>>
>> On 27/11/13 01:04, Maatry Daniel Okouya wrote:
>> > Hi,
>> >
>> > I am working on a project focused on OWL. Recently we came up with the requirement to deal with multiple owl ontologies interconnected with each other using the named graph approach.
>> >
>> > I have two questions on the matter:
>> >
>> > 1-Is there any tool (i suppose triple store) that support that ?( I understood that when it comes to pure RDF, Jena TDB could handle that. Just not sure upfront with OWL DL. Although i suppose so….)
>>
>> Jena can certainly store RDF in multiple named graphs, each of which can
>> be an ontology.
>>
>> > 2-I’m currently heavily relying on OWL-API and Pellet, can TBD allow me to keep working with the OWL API, to update my ontologies at runtime, while providing me with the triple store management ?
>>
>> Jena does not support the OWL-API. As well as the RDF API it has some
>> convenience functions (OntAPI) for accessing and updating the RDF when
>> treated as an OWL ontology, though this does not support OWL 2.
>>
>> You can plug Pellet in as a reasoner to a Jena model, as you've
>> mentioned below.
>>
>> Dave
>>
>> > I saw some interesting code on the pellet website that show some interoperability between Jena and the OWL-API trough the Pellet API. I just don’t know how effective that can be:
>> >
>> >
>> >
>> >>>>>>
>> >
>> > How can I run SPARQL queries with OWLAPI?
>> > There is no native SPARQL support in OWLAPI. However, a Jena model can be created with the contents of an OWLAPI reasoner so SPARQL query answering can be done on the Jena model.OWLAPI reasoner and Jena model can be queried together but all updates should be done on theOWLAPI ontology. The following snippet shows the general idea behind this approach:
>> >
>> >     // import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
>> >     // import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;
>> >
>> >     // Create OWLAPI ontology as usual
>> >     OWLOntology ontology = ...
>> >     // Create Pellet-OWLAPI reasoner (non-buffering mode makes synchronization easier)
>> >     PelletReasoner reasoner =
>> >           PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
>> >     // Get the KB from the reasoner
>> >     KnowledgeBase kb = reasoner.getKB();
>> >     // Create a Pellet graph using the KB from OWLAPI
>> >     PelletInfGraph graph = new org.mindswap.pellet.jena.PelletReasoner().bind( kb );
>> >     // Wrap the graph in a model
>> >     InfModel model = ModelFactory.createInfModel( graph );
>> >     // Use the model to answer SPARQL queries
>> >
>> > The model created this way cannot be used to answer SPARQL queries that query for RDF syntax triples, e.g. SELECT * WHERE { ?x owl:onProperty ?p }.
>> >
>>


Re: Named Graph, TBD, OWL2, OWL-API, Pellet

Posted by Maatry Daniel Okouya <ok...@yahoo.fr>.
Many thanks for your answer. 

Just to understand, 

what would be exactly the advantage of named graph as provided by store over implementing a custom similar approach within the OWL-API. I mean i could very well, have several in-memory ontology within the OWL-API, and use namedIndividual where necessary to refer to them.


From: Dave Reynolds Dave Reynolds
Reply: users@jena.apache.org users@jena.apache.org
Date: November 27, 2013 at 9:22:16 AM
To: users@jena.apache.org users@jena.apache.org
Subject:  Re: Named Graph, TBD, OWL2, OWL-API, Pellet  


On 27/11/13 01:04, Maatry Daniel Okouya wrote:  
> Hi,  
>  
> I am working on a project focused on OWL. Recently we came up with the requirement to deal with multiple owl ontologies interconnected with each other using the named graph approach.  
>  
> I have two questions on the matter:  
>  
> 1-Is there any tool (i suppose triple store) that support that ?( I understood that when it comes to pure RDF, Jena TDB could handle that. Just not sure upfront with OWL DL. Although i suppose so….)  

Jena can certainly store RDF in multiple named graphs, each of which can  
be an ontology.  

> 2-I’m currently heavily relying on OWL-API and Pellet, can TBD allow me to keep working with the OWL API, to update my ontologies at runtime, while providing me with the triple store management ?  

Jena does not support the OWL-API. As well as the RDF API it has some  
convenience functions (OntAPI) for accessing and updating the RDF when  
treated as an OWL ontology, though this does not support OWL 2.  

You can plug Pellet in as a reasoner to a Jena model, as you've  
mentioned below.  

Dave  

> I saw some interesting code on the pellet website that show some interoperability between Jena and the OWL-API trough the Pellet API. I just don’t know how effective that can be:  
>  
>  
>  
>>>>>>  
>  
> How can I run SPARQL queries with OWLAPI?  
> There is no native SPARQL support in OWLAPI. However, a Jena model can be created with the contents of an OWLAPI reasoner so SPARQL query answering can be done on the Jena model.OWLAPI reasoner and Jena model can be queried together but all updates should be done on theOWLAPI ontology. The following snippet shows the general idea behind this approach:  
>  
> // import com.clarkparsia.pellet.owlapiv3.PelletReasoner;  
> // import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;  
>  
> // Create OWLAPI ontology as usual  
> OWLOntology ontology = ...  
> // Create Pellet-OWLAPI reasoner (non-buffering mode makes synchronization easier)  
> PelletReasoner reasoner =  
> PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );  
> // Get the KB from the reasoner  
> KnowledgeBase kb = reasoner.getKB();  
> // Create a Pellet graph using the KB from OWLAPI  
> PelletInfGraph graph = new org.mindswap.pellet.jena.PelletReasoner().bind( kb );  
> // Wrap the graph in a model  
> InfModel model = ModelFactory.createInfModel( graph );  
> // Use the model to answer SPARQL queries  
>  
> The model created this way cannot be used to answer SPARQL queries that query for RDF syntax triples, e.g. SELECT * WHERE { ?x owl:onProperty ?p }.  
>  


Re: Named Graph, TBD, OWL2, OWL-API, Pellet

Posted by Dave Reynolds <da...@gmail.com>.

On 27/11/13 01:04, Maatry Daniel Okouya wrote:
> Hi,
>
> I am working on a project focused on OWL. Recently we came up with the requirement to deal with multiple owl ontologies interconnected with each other using the named graph approach.
>
> I have two questions on the matter:
>
> 1-Is there any tool (i suppose triple store) that support that ?( I understood that when it comes to pure RDF, Jena TDB could handle that. Just not sure upfront with OWL DL. Although i suppose so….)

Jena can certainly store RDF in multiple named graphs, each of which can 
be an ontology.

> 2-I’m currently heavily relying on OWL-API and Pellet, can TBD allow me to keep working with the OWL API, to update my ontologies at runtime, while providing me with the triple store management ?

Jena does not support the OWL-API. As well as the RDF API it has some 
convenience functions (OntAPI) for accessing and updating the RDF when 
treated as an OWL ontology, though this does not support OWL 2.

You can plug Pellet in as a reasoner to a Jena model, as you've 
mentioned below.

Dave

> I saw some interesting code on the pellet website that show some interoperability between Jena and the OWL-API trough the Pellet API. I just don’t know how effective that can be:
>
>
>
>>>>>>
>
> How can I run SPARQL queries with OWLAPI?
> There is no native SPARQL support in OWLAPI. However, a Jena model can be created with the contents of an OWLAPI reasoner so SPARQL query answering can be done on the Jena model.OWLAPI reasoner and Jena model can be queried together but all updates should be done on theOWLAPI ontology. The following snippet shows the general idea behind this approach:
>
>     // import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
>     // import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;
>
>     // Create OWLAPI ontology as usual
>     OWLOntology ontology = ...
>     // Create Pellet-OWLAPI reasoner (non-buffering mode makes synchronization easier)
>     PelletReasoner reasoner =
>           PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
>     // Get the KB from the reasoner
>     KnowledgeBase kb = reasoner.getKB();
>     // Create a Pellet graph using the KB from OWLAPI
>     PelletInfGraph graph = new org.mindswap.pellet.jena.PelletReasoner().bind( kb );
>     // Wrap the graph in a model
>     InfModel model = ModelFactory.createInfModel( graph );
>     // Use the model to answer SPARQL queries
>
> The model created this way cannot be used to answer SPARQL queries that query for RDF syntax triples, e.g. SELECT * WHERE { ?x owl:onProperty ?p }.
>