ontodev / robot

ROBOT is an OBO Tool
http://robot.obolibrary.org
BSD 3-Clause "New" or "Revised" License
261 stars 74 forks source link

Support OWLNamedIndividuals in ROBOT templates #49

Closed jamesaoverton closed 9 years ago

jamesaoverton commented 9 years ago

This feature was requested by Sridevi. I have some working code, but I'd like to discuss it here first before committing.

I propose to add a new TYPE column for ROBOT templates. This column will be optional, defaulting to owl:Class, but its value can be any CURIE or IRI that you want to be assigned to the rdf:type predicate. These types will be special cases, handled using OWLAPI:

(Let me know if I'm missing any...)

If the TYPE is not one of these special values, then we will use dataFactory.getOWLNamedIndividual(iri) and assert the rdf:type like any other annotation with a URI value.

This should allow for template tables that create a bunch of individuals, using ID, TYPE, and various annotation columns. It should also work for other OWL entities, but without special logical axioms such as domain and range (to be added later).

In my current code, if you use C and CI templates for a row, you will end up with the same IRI used for both an OWLNamedIndividual and an OWLClass. I'm not sure how to handle this interaction.

spolavar commented 9 years ago

Hi James, I have tested my requirement of being able to query instances of an OWLClass using the reasoner in OWLAPI, and it works fine. Here is how I tested, I changed my OWL model using protege, by adding the instances as Individuals, and then linking them to the OWLClass as a member. This resulted in the following with rdf:type as rdf:resource:

 <NamedIndividual rdf:about="&vertebrateH;NMODB:62_br2">
        <rdf:type rdf:resource="&vertebrateH;NMOBr_134"/>
 </NamedIndividual>

translating the rule that the _individual NMODB:62_br2 is a type of NMOBr134 class. Both entities will have their own IRIs, e.g., http://neuromorpho.org/neuroMorpho/ontologies/vertebrateH.owl#NMODB:62_br2 http://neuromorpho.org/neuroMorpho/ontologies/vertebrateH.owl#NMOBr_134

So, from the model perspective this is clearly achievable. Therefore, the question is, if it is possible to add this rule via template.

I am not sure I understand the concern you raised in this context.

jamesaoverton commented 9 years ago

See if the changes in 1b5b606 fit your use case:

spolavar commented 9 years ago

Very neat, James. I new type column for the individuals is working for me. I was able to pull the instances with a reasoner. However, I notice minor things that required my manual edits before successfully querying the files:

<NamedIndividual rdf:about="NMODB:9_16">
        <rdf2:type rdf:resource="http://neuromorpho.org/neuromorpho/ontologies/ageclassificationH.owl#OntoS_8010"/>
    </NamedIndividual>

Since you have kick started me with this very useful addition, I will test it more thoroughly with inferential queries too.

jamesaoverton commented 9 years ago

I cannot confirm the "rdf2" problem and I'm a little confused about the second problem. Please send me your input template file and output OWL file.

spolavar commented 9 years ago

Here it is.

-Sridevi

On Sat, Oct 17, 2015 at 10:21 AM, James A. Overton <notifications@github.com

wrote:

I cannot confirm the "rdf2" problem and I'm a little confused about the second problem. Please send me your input template file and output OWL file.

— Reply to this email directly or view it on GitHub https://github.com/ontodev/robot/issues/49#issuecomment-148918676.

jamesaoverton commented 9 years ago

Thanks for sending me the files via email. I ran this command:

 robot template --prefix "ageclassificationH: http://neuromorpho.org/neuromorpho/ontologies/ageclassificationH.owl#" -t input.csv -o output.owl

I think ROBOT is behaving correctly and you're just having some trouble with prefixes. Note that OWL:Thing should be owl:Thing. I don't see an rdf2 prefix in my output.owl file, but in the OWL file you sent I see that xmlns:rdf2="rdf:", which is very weird. Are you defining other prefixes?

I see this CURIE ageclassificationH:OntoS_8000 expand to this IRI http://neuromorpho.org/neuromorpho/ontologies/ageclassificationH.owl#OntoS_8000 as expected. I think that you aren't seeing NMODB:9_16 expanded because you have not defined the NMODB prefix.

spolavar commented 9 years ago

I see, that's right, my second issue was solved. I think the rdf2 is because i am using the option --noprefixes when i run robot.

jamesaoverton commented 9 years ago

Ok. When using --noprefixes you have to provide your own. I'll try to make this more clear in the future.

Closing this issue now.