Re: Jena + Pellet Reasoner
Hi, I recently succeeded in making it working Take a look at https://groups.google.com/forum/#!topic/pellet-users/VpKDI0gFmjo Hope this helps 2015-12-02 22:10 GMT+01:00 Chris Snyder: > I’m trying out some different reasoners in my test application. I wanted > to try Pellet so I updated my Maven to grab: > > com.github.ansell.pellet > pellet-jena > 2.3.6-ansell > > > When I try to access the reasoner factory it is apparent from the error > that the Pellet jar is using its own Jena version. > java.lang.ClassCastException: > org.mindswap.pellet.jena.PelletReasonerFactory cannot be cast to > org.apache.jena.reasoner.ReasonerFactory > > And upon further inspection I see: > package org.mindswap.pellet.jena; > > import com.hp.hpl.jena.ontology.OntModelSpec; > import com.hp.hpl.jena.rdf.model.Model; > import com.hp.hpl.jena.rdf.model.ModelFactory; > import com.hp.hpl.jena.rdf.model.Resource; > import com.hp.hpl.jena.reasoner.Reasoner; > import com.hp.hpl.jena.reasoner.ReasonerFactory; > import com.hp.hpl.jena.reasoner.ReasonerRegistry; > import com.hp.hpl.jena.vocabulary.RDFS; > import com.hp.hpl.jena.vocabulary.ReasonerVocabulary; > > /** > * @author Evren Sirin > * > */ > public class PelletReasonerFactory implements ReasonerFactory { > > and I can understand why there is a class cast error. Is there a version > of the Pellet reasoner that I can plug in to an application already using > the org.apache.jena.* ? > > Thanks, > Chris > >
Jena + Pellet Reasoner
I’m trying out some different reasoners in my test application. I wanted to try Pellet so I updated my Maven to grab: com.github.ansell.pellet pellet-jena 2.3.6-ansell When I try to access the reasoner factory it is apparent from the error that the Pellet jar is using its own Jena version. java.lang.ClassCastException: org.mindswap.pellet.jena.PelletReasonerFactory cannot be cast to org.apache.jena.reasoner.ReasonerFactory And upon further inspection I see: package org.mindswap.pellet.jena; import com.hp.hpl.jena.ontology.OntModelSpec; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.reasoner.Reasoner; import com.hp.hpl.jena.reasoner.ReasonerFactory; import com.hp.hpl.jena.reasoner.ReasonerRegistry; import com.hp.hpl.jena.vocabulary.RDFS; import com.hp.hpl.jena.vocabulary.ReasonerVocabulary; /** * @author Evren Sirin * */ public class PelletReasonerFactory implements ReasonerFactory { and I can understand why there is a class cast error. Is there a version of the Pellet reasoner that I can plug in to an application already using the org.apache.jena.* ? Thanks, Chris
Re: Jena + pellet Reasoner
On 19/03/14 17:26, Adeeb Noor wrote: Hi Dave: Thanks for your answer. owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . What data type should I give to hasValue object property to accept the URI. No data type, http://identifiers.org/kegg.pathway/hsa04110 is a resource not a literal. Dave thanks On Mon, Mar 17, 2014 at 4:28 AM, Dave Reynolds dave.e.reyno...@gmail.comwrote: On 14/03/14 08:08, Adeeb Noor wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); Unless something has changed then Pellet is an in-memory reasoner so reasoning directly over the TDB data doesn't necessarily enable you to scale beyond memory sized data and may be a performance hit. So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. Not sure what you mean by grouping here. This is not one triple but one resource which is the subject of a number of triples. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. What you do you mean by group? What do you mean by rule here? Swrl rules? If so then you need to ask the Pellet folks for support on that. Why is the URI being external of any relevance here? Normally that wouldn't matter at all. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. That you could do directly in OWL, no need for rules, something like: eg:sameKEGG a owl:Class; owl:equivalentClass [ a owl:Restriction; owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . Dave
Re: Jena + pellet Reasoner
Thanks Dave I am using protoge 4.2.0. I created the class sameKEGG and the object property ddids:x-kegg.pathway; but I am not able to find the hasValue restriction. any idea ? Thanks On Wed, Mar 19, 2014 at 11:33 AM, Dave Reynolds dave.e.reyno...@gmail.comwrote: On 19/03/14 17:26, Adeeb Noor wrote: Hi Dave: Thanks for your answer. owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . What data type should I give to hasValue object property to accept the URI. No data type, http://identifiers.org/kegg.pathway/hsa04110 is a resource not a literal. Dave thanks On Mon, Mar 17, 2014 at 4:28 AM, Dave Reynolds dave.e.reyno...@gmail.com wrote: On 14/03/14 08:08, Adeeb Noor wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); Unless something has changed then Pellet is an in-memory reasoner so reasoning directly over the TDB data doesn't necessarily enable you to scale beyond memory sized data and may be a performance hit. So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. Not sure what you mean by grouping here. This is not one triple but one resource which is the subject of a number of triples. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. What you do you mean by group? What do you mean by rule here? Swrl rules? If so then you need to ask the Pellet folks for support on that. Why is the URI being external of any relevance here? Normally that wouldn't matter at all. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. That you could do directly in OWL, no need for rules, something like: eg:sameKEGG a owl:Class; owl:equivalentClass [ a owl:Restriction; owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . Dave -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Re: Jena + pellet Reasoner
will do, thanks On Wed, Mar 19, 2014 at 12:30 PM, Dave Reynolds dave.e.reyno...@gmail.comwrote: On 19/03/14 18:04, Adeeb Noor wrote: Thanks Dave I am using protoge 4.2.0. I created the class sameKEGG and the object property ddids:x-kegg.pathway; but I am not able to find the hasValue restriction. any idea ? Sorry no. Last time I used protege was a long time ago and then it was pretty obvious (create restriction, select hasValue and fill in the form). If it's no longer obvious then you'll need to ask on a protege list. Dave On Wed, Mar 19, 2014 at 11:33 AM, Dave Reynolds dave.e.reyno...@gmail.comwrote: On 19/03/14 17:26, Adeeb Noor wrote: Hi Dave: Thanks for your answer. owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . What data type should I give to hasValue object property to accept the URI. No data type, http://identifiers.org/kegg.pathway/hsa04110 is a resource not a literal. Dave thanks On Mon, Mar 17, 2014 at 4:28 AM, Dave Reynolds dave.e.reyno...@gmail.com wrote: On 14/03/14 08:08, Adeeb Noor wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data. infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); Unless something has changed then Pellet is an in-memory reasoner so reasoning directly over the TDB data doesn't necessarily enable you to scale beyond memory sized data and may be a performance hit. So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. Not sure what you mean by grouping here. This is not one triple but one resource which is the subject of a number of triples. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. What you do you mean by group? What do you mean by rule here? Swrl rules? If so then you need to ask the Pellet folks for support on that. Why is the URI being external of any relevance here? Normally that wouldn't matter at all. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. That you could do directly in OWL, no need for rules, something like: eg:sameKEGG a owl:Class; owl:equivalentClass [ a owl:Restriction; owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . Dave -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Re: Jena + pellet Reasoner
On 19/03/14 18:04, Adeeb Noor wrote: Thanks Dave I am using protoge 4.2.0. I created the class sameKEGG and the object property ddids:x-kegg.pathway; but I am not able to find the hasValue restriction. any idea ? Sorry no. Last time I used protege was a long time ago and then it was pretty obvious (create restriction, select hasValue and fill in the form). If it's no longer obvious then you'll need to ask on a protege list. Dave On Wed, Mar 19, 2014 at 11:33 AM, Dave Reynolds dave.e.reyno...@gmail.comwrote: On 19/03/14 17:26, Adeeb Noor wrote: Hi Dave: Thanks for your answer. owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . What data type should I give to hasValue object property to accept the URI. No data type, http://identifiers.org/kegg.pathway/hsa04110 is a resource not a literal. Dave thanks On Mon, Mar 17, 2014 at 4:28 AM, Dave Reynolds dave.e.reyno...@gmail.com wrote: On 14/03/14 08:08, Adeeb Noor wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); Unless something has changed then Pellet is an in-memory reasoner so reasoning directly over the TDB data doesn't necessarily enable you to scale beyond memory sized data and may be a performance hit. So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. Not sure what you mean by grouping here. This is not one triple but one resource which is the subject of a number of triples. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. What you do you mean by group? What do you mean by rule here? Swrl rules? If so then you need to ask the Pellet folks for support on that. Why is the URI being external of any relevance here? Normally that wouldn't matter at all. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. That you could do directly in OWL, no need for rules, something like: eg:sameKEGG a owl:Class; owl:equivalentClass [ a owl:Restriction; owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . Dave
Re: Jena + pellet Reasoner
On 14/03/14 08:08, Adeeb Noor wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); Unless something has changed then Pellet is an in-memory reasoner so reasoning directly over the TDB data doesn't necessarily enable you to scale beyond memory sized data and may be a performance hit. So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. Not sure what you mean by grouping here. This is not one triple but one resource which is the subject of a number of triples. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. What you do you mean by group? What do you mean by rule here? Swrl rules? If so then you need to ask the Pellet folks for support on that. Why is the URI being external of any relevance here? Normally that wouldn't matter at all. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. That you could do directly in OWL, no need for rules, something like: eg:sameKEGG a owl:Class; owl:equivalentClass [ a owl:Restriction; owl:onProperty ddids:x-kegg.pathway; owl:hasValue http://identifiers.org/kegg.pathway/hsa04110 ] . Dave
Re: Jena + pellet Reasoner
Thanks a lot Miguel. My TDB is around 17G and Jena rule engine will take for ever to do the inferring. Thanks On Sat, Mar 15, 2014 at 5:53 AM, Miguel Bento Alves mbentoal...@gmail.comwrote: In the best of my knowledge, you can¹t do it with OWL or OWL2(pellet reasoner). You need something like rules or spin-rules. Miguel On 15/03/14 03:14, Adeeb Noor adeeb.n...@colorado.edu wrote: Would someone please help me with the question Thanks in advance On Fri, Mar 14, 2014 at 3:04 PM, Adeeb Noor adeeb.n...@colorado.edu wrote: Need your advice below please when you have a chance . Miguel though I need to do it with RuleEngine but in fact I want to do the work with pellet reasoner. thanks and sorry for bothering. -- Forwarded message -- From: Adeeb Noor adeeb.n...@colorado.edu Date: Fri, Mar 14, 2014 at 2:08 AM Subject: Jena + pellet Reasoner To: users@jena.apache.org users@jena.apache.org Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Re: Jena + pellet Reasoner
In the best of my knowledge, you can¹t do it with OWL or OWL2(pellet reasoner). You need something like rules or spin-rules. Miguel On 15/03/14 03:14, Adeeb Noor adeeb.n...@colorado.edu wrote: Would someone please help me with the question Thanks in advance On Fri, Mar 14, 2014 at 3:04 PM, Adeeb Noor adeeb.n...@colorado.edu wrote: Need your advice below please when you have a chance . Miguel though I need to do it with RuleEngine but in fact I want to do the work with pellet reasoner. thanks and sorry for bothering. -- Forwarded message -- From: Adeeb Noor adeeb.n...@colorado.edu Date: Fri, Mar 14, 2014 at 2:08 AM Subject: Jena + pellet Reasoner To: users@jena.apache.org users@jena.apache.org Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Jena + pellet Reasoner
Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Re: Jena + pellet Reasoner
Hi Adeed, I see sameKEGG as an objectProperty and not as a class. The rule should be something like: (?x ex:sameKEGG_p ?y) - (?x ddids:x-kegg.pathway ?z), (?y ddids:x-kegg.pathway ?z), notEqual(?x, ?y). But you can get all the subjects that have others with a same value under a class with: (?x rdf:type ex:sameKEGG_c) - (?x ex:sameKEGG_p ?y). Miguel On 14/03/14 08:08, Adeeb Noor adeeb.n...@colorado.edu wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu
Re: Jena + pellet Reasoner
Thanks Alves, May be I was not clear enough. I do not want to use the rule engine. Instead I would like to use protege to add the rule. Thanks On Friday, March 14, 2014, Miguel Bento Alves mbentoal...@gmail.com wrote: Hi Adeed, I see sameKEGG as an objectProperty and not as a class. The rule should be something like: (?x ex:sameKEGG_p ?y) - (?x ddids:x-kegg.pathway ?z), (?y ddids:x-kegg.pathway ?z), notEqual(?x, ?y). But you can get all the subjects that have others with a same value under a class with: (?x rdf:type ex:sameKEGG_c) - (?x ex:sameKEGG_p ?y). Miguel On 14/03/14 08:08, Adeeb Noor adeeb.n...@colorado.edu javascript:; wrote: Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu javascript:; -- Sent from Gmail Mobile
Re: Jena + pellet Reasoner
Would someone please help me with the question Thanks in advance On Fri, Mar 14, 2014 at 3:04 PM, Adeeb Noor adeeb.n...@colorado.edu wrote: Need your advice below please when you have a chance . Miguel though I need to do it with RuleEngine but in fact I want to do the work with pellet reasoner. thanks and sorry for bothering. -- Forwarded message -- From: Adeeb Noor adeeb.n...@colorado.edu Date: Fri, Mar 14, 2014 at 2:08 AM Subject: Jena + pellet Reasoner To: users@jena.apache.org users@jena.apache.org Hello everyone: I have been struggling a lot with a problem that I did not find a solution for, so hopefully guys can guide me or help me with it. I have my data (rdfs) store in jena tdb as model and my owl (schema) using protoge. Here is the code to merge data and schema: System.out.println(creting infeer dataset ); Dataset dataset = TDBFactory.createDataset(data.infereedTDB); System.out.println(creting OntModel ); OntModel Infmodel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, dataset.getNamedModel(this.URL)); System.out.println(adding schema (OWL) to OntModel); Infmodel.add(this.owl); System.out.println(adding data (RDF) to OntModel ); Infmodel.add(data.tdb); System.out.println(creting ModelExtractor ); ModelExtractor ext = new ModelExtractor(Infmodel); dataset.replaceNamedModel(this.URL, ext.extractModel()); System.out.println(saving infead model); Infmodel.close(); System.out.println(closing infeed dataset); dataset.close(); So I have the ability to store my inferred data into new tdb and to reason or build any rule based on Literal values . For example: this is one triple that has UMLS_type as a property and I can group all subjects with two or more UMLS_types for instance. ddidd:C0007586 | ddids:label | Cell Cycle ddidd:C0007586 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ddids:Pathway ddidd:C0007586 | ddids:UMLS_type | T043 ddidd:C0007586 | ddids:x-kegg.pathway | http://identifiers.org/kegg.pathway/hsa04110 However, as you can see from the triple above I have x-kegg.pathway as an external uri. By default protoge takes it to be object property. What I cannot do is to write a rule for example to group all subject under same x-kegg.pathway number since it is external URI. For example, I want to create a class called sameKEGG that its members has http://identifiers.org/kegg.pathway/hsa04110 value for example. BTW, I can do such a thing easily by SPARQL but I would love to use the reasoner to make complex rules. I have been struggling with this for awhile and I frankly appreciate any comments or feedback. -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu -- Adeeb Noor Ph.D. Candidate Dept of Computer Science University of Colorado at Boulder Cell: 571-484-3303 Email: adeeb.n...@colorado.edu