Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about owl:DatatypeProperty #507

Open
saramsey opened this issue Jan 8, 2021 · 14 comments
Open

question about owl:DatatypeProperty #507

saramsey opened this issue Jan 8, 2021 · 14 comments

Comments

@saramsey
Copy link

saramsey commented Jan 8, 2021

Hello Ontobio team,

I have a simple RDF Turtle file test.ttl that I want to load using Ontobio:

@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://foo.com/bar> a owl:Class ;
        skos:prefLabel """some node"""@en ;
        <http://foo.com/baz> """test property"""^^xsd:string ;
.

<http://foo.com/baz> a owl:DatatypeProperty ;
    rdfs:label """test label""";
    rdfs:comment """test comment""" .

When I convert it to OWL using robot,

./robot convert --input test.ttl --output test.owl

I get something reasonable, including my "test property" as shown here:

    <NamedIndividual rdf:about="http://foo.com/bar">
        <foo:baz rdf:datatype="http://www.w3.org/2001/XMLSchema#string">test property</foo:baz>
    </NamedIndividual>

But when I load that test.owl file into ontobio 2.1.2,

rm  -r -f ~/.cachier
python3
import ontobio
ont = ontobio.ontol_factory.OntologyFactory().create("test.owl", ignore_cache=True)

I don't see the property in the node:

>>> ont = ontobio.ontol_factory.OntologyFactory().create("test.owl", ignore_cache=True)
>>> ont
test.owl handle: test.owl meta: {'subsets': [], 'xrefs': [], 'basicPropertyValues': []}
>>> ont.nodes()
NodeView(('http://foo.com/baz', 'http://foo.com/bar'))
>>> import pprint
>>> pprint.pprint(ont.node("http://foo.com/bar"))
{'id': 'http://foo.com/bar',
 'meta': {'basicPropertyValues': [{'pred': 'http://www.w3.org/2004/02/skos/core#prefLabel',
                                   'val': 'some node'}]},
 'type': 'INDIVIDUAL'}

Is there a way to load an OWL file into Ontobio and to programmatically access a owl:DatatypeProperty field of a class?

@saramsey
Copy link
Author

saramsey commented Jan 8, 2021

My setup:

  • macOS 10.14.6
  • python 3.7.4
  • ontobio 2.1.2
  • networkx 2.2

@saramsey
Copy link
Author

tagging @cmungall and @deepakunni3

@deepakunni3
Copy link
Member

@saramsey This is an interesting observation.

One thing to note here is that Ontobio uses owltools to parse OWL to create a JSON representation.

While technically owltools and robot should be the same, but there is something else at play here.

Using Robot, if I were to convert the test.ttl to test.json (a form Ontobio recognizes), I get an error.

robot convert -vvv --input test.ttl --output test.json -f json

2021-01-11 13:30:10,064 DEBUG org.obolibrary.robot.IOHelper - Saving ontology Ontology(OntologyID(Anonymous-2)) [Axioms: 6 Logical Axioms: 1] First 20 axioms: {AnnotationAssertion(rdfs:label <http://foo.com/baz> "test label") AnnotationAssertion(rdfs:comment <http://foo.com/baz> "test comment") AnnotationAssertion(<http://www.w3.org/2004/02/skos/core#prefLabel> <http://foo.com/bar> "some node"@en) DataPropertyAssertion(<http://foo.com/baz> <http://foo.com/bar> "test property"^^xsd:string) Declaration(Class(<http://foo.com/bar>)) Declaration(DataProperty(<http://foo.com/baz>)) } as OboGraphs JSON Syntax with to IRI file:/Users/deepak.unni3/GIT/ontobio-master/test.json
2021-01-11 13:30:10,070 DEBUG org.obolibrary.robot.ExceptionHelper - {} missing exception message.
java.lang.NullPointerException
	at org.geneontology.obographs.owlapi.FromOwl.getNodeId(FromOwl.java:717)
	at org.geneontology.obographs.owlapi.FromOwl.generateGraph(FromOwl.java:515)
	at org.geneontology.obographs.owlapi.FromOwl.generateGraphDocument(FromOwl.java:110)
	at org.obolibrary.robot.IOHelper.saveOntologyFile(IOHelper.java:1121)
	at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:583)
	at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:524)
	at org.obolibrary.robot.ConvertCommand.execute(ConvertCommand.java:167)
	at org.obolibrary.robot.CommandManager.executeCommand(CommandManager.java:248)
	at org.obolibrary.robot.CommandManager.execute(CommandManager.java:192)
	at org.obolibrary.robot.CommandManager.main(CommandManager.java:139)
	at org.obolibrary.robot.CommandLineInterface.main(CommandLineInterface.java:55)
null
java.lang.NullPointerException
	at org.geneontology.obographs.owlapi.FromOwl.getNodeId(FromOwl.java:717)
	at org.geneontology.obographs.owlapi.FromOwl.generateGraph(FromOwl.java:515)
	at org.geneontology.obographs.owlapi.FromOwl.generateGraphDocument(FromOwl.java:110)
	at org.obolibrary.robot.IOHelper.saveOntologyFile(IOHelper.java:1121)
	at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:583)
	at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:524)
	at org.obolibrary.robot.ConvertCommand.execute(ConvertCommand.java:167)
	at org.obolibrary.robot.CommandManager.executeCommand(CommandManager.java:248)
	at org.obolibrary.robot.CommandManager.execute(CommandManager.java:192)
	at org.obolibrary.robot.CommandManager.main(CommandManager.java:139)
	at org.obolibrary.robot.CommandLineInterface.main(CommandLineInterface.java:55)

Now if I were to convert test.ttl to test.owl then it works as demonstrated above by @saramsey

And when I convert this derived test.owl to test.json,

robot convert --input test.owl --output test.json -f json

I get the following:

{
  "graphs" : [ {
    "nodes" : [ {
      "id" : "http://foo.com/baz",
      "meta" : {
        "comments" : [ "test comment" ]
      },
      "type" : "PROPERTY",
      "lbl" : "test label"
    }, {
      "id" : "http://foo.com/bar",
      "meta" : {
        "basicPropertyValues" : [ {
          "pred" : "http://www.w3.org/2004/02/skos/core#prefLabel",
          "val" : "some node"
        } ]
      },
      "type" : "INDIVIDUAL"
    } ],
    "edges" : [ ],
    "meta" : {
      "subsets" : [ ],
      "xrefs" : [ ],
      "basicPropertyValues" : [ ]
    },
    "equivalentNodesSets" : [ ],
    "logicalDefinitionAxioms" : [ ],
    "domainRangeAxioms" : [ ],
    "propertyChainAxioms" : [ ]
  } ]
}

While I see the owl:DatatypeProperty, it ends up as a node in the graph instead of a property on the node with IRI http://foo.com/bar.

@cmungall Thoughts?

@dougli1sqrd
Copy link
Contributor

dougli1sqrd commented Jan 13, 2021

It's correct for http://foo.com/baz to show up as a "node", since in this graph view, all entities are nodes, even properties. But I'm not sure how the triple should show up. Normally if you're linking objects, like with subClassOf, you would see an entry in the edges list: {'a', 'subClassOf, 'b'}` or similar, for example. It may be different because this is a datatype property.

@saramsey
Copy link
Author

Thanks, @dougli1sqrd and @deepakunni3. Is the current behavior of ontobio on this example input (i.e., not showing any edge in the resulting ontobio object, corresponding to the datatype property) expected?

@deepakunni3
Copy link
Member

@dougli1sqrd Agreed. We expect to see the dataTypeProperty as a node.

@saramsey No, the behavior is definitely not expected.

What we should be seeing is a proper edge that links http://foo.com/bar to test_property where the predicate is http://foo.com/baz. But "test property" is a string, having a direct edge doesn't make sense. So this should be a node property on node http://foo.com/bar.

@dougli1sqrd
Copy link
Contributor

Yeah should this be in one of the meta fields?

@saramsey
Copy link
Author

saramsey commented Jan 21, 2021

Thanks for your replies, @deepakunni3 and @dougli1sqrd!

Great, a node property (in the ontobio object model) would be ideal for us. Any sense of how light or heavy a lift it will be, to make this change to owltools/ontobio?

@saramsey
Copy link
Author

Hi ontobio team, just checking back on this-- do you think this is a feasible fix? Would the fix be in owltools or in ontobio?

@deepakunni3
Copy link
Member

@cmungall Any recommendations on this?

Are only a selected set of properties end up in meta field of a node in OBOGraphs?

@kvarforl
Copy link

Hi @deepakunni3 @cmungall, do you have any updates on the status / feasibility of this fix? a few more issues that stem from this have cropped up on our end, so I thought I'd check back in :)

@cmungall
Copy link
Contributor

a few things going on here. Looks like something unrelated to ontobio for ttl->rdfxml conversion? both owltools and robot are wrappers to the owlapi, but they may use different versions? if there is a bug it should be reported on the appropriate tracker.

but I think the question here is about the obograph spec. yes, this should be clarified, and yes we should make DPs nodes as we do for OPs. Can you add to obographs?

@saramsey
Copy link
Author

saramsey commented Mar 10, 2021

a few things going on here. Looks like something unrelated to ontobio for ttl->rdfxml conversion? both owltools and robot are wrappers to the owlapi, but they may use different versions? if there is a bug it should be reported on the appropriate tracker.

but I think the question here is about the obograph spec. yes, this should be clarified, and yes we should make DPs nodes as we do for OPs. Can you add to obographs?

Thank you @cmungall ! For DPs, can there also be a triple (or alternately, a property on the DP node) that indicates the "parent" node for which it is a owlDatatypeProperty ?

@cmungall
Copy link
Contributor

cmungall commented Mar 11, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants