Code Monkey home page Code Monkey logo

owlapi_wrapper's Introduction

owlapi_wrapper

Build Status

A command line utility that wraps the Java OWL API for parsing RDFS, OWL, and OBO ontologies.

owlapi_wrapper's People

Contributors

alexskr avatar jvendetti avatar msalvadores avatar stdotjohn avatar syphax-bouazzouni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

owlapi_wrapper's Issues

Ontology-level annotation axioms and version info

Hello,

When the parser builds the owl ontology he calls a function called addGroundMetadata which copies ontology-level annotation axioms from the source ontology to the target ontology.
And also checks for the owl#versionInfo property. If found, adds a BioPortal-specific "versionSubject (http://bioportal.bioontology.org/ontologies/versionSubject)" annotation axiom to the target ontology.

But I don't know if it is wanted but the generated ow:Ontology will contain and mix all the annotations of all the imported ontologies.

Example

If we take the example of cnov0_5.owl (one of the ontologies used in the tests)

In the original file, we have

    <owl:Ontology rdf:about="http://purl.org/incf/ontology/Computational_Neurosciences/cno_alpha.owl">
        <dc:date rdf:datatype="&xsd;string">13/03/2012</dc:date>
        <dc:subject rdf:datatype="&xsd;string">An ontology to describe the field of Computational Neurosciences</dc:subject>
        <dc:contributor rdf:datatype="&xsd;string">Birgit Kriener</dc:contributor>
        <dc:title rdf:datatype="&xsd;string">Computational Neuroscience Ontology</dc:title>
        <dc:contributor rdf:datatype="&xsd;string">Erik De Schutter</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Fahim T. Imam</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">INCF MultiScale Modeling Task Force</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Lars Schwabe</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Padraig Gleeson</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Sean Hill</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Stephen D. Larson</dc:contributor>
        <dc:contributor rdf:datatype="&xsd;string">Subhasis Ray</dc:contributor>
        <rdfs:comment rdf:datatype="&xsd;string">This ontology is used to add the Definition class of annotation as in NIF.
The source of the definition can be defined with class from OBO-annotation</rdfs:comment>
        <rdfs:comment rdf:datatype="&xsd;string">This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.</rdfs:comment>
        <dc:creator rdf:datatype="&xsd;string">Yann Le Franc</dc:creator>
        <owl:versionInfo rdf:datatype="&xsd;string">version 0.5</owl:versionInfo>
        <owl:imports rdf:resource="http://ontology.neuinfo.org/NIF/Backend/OBO_annotation_properties.owl"/>
        <owl:imports rdf:resource="http://ontology.neuinfo.org/NIF/Backend/ro_bfo1-1_bridge.owl"/>
        -<owl:imports rdf:resource="http://protege.stanford.edu/plugins/owl/dc/protege-dc.owl"/>
        -<owl:imports rdf:resource="http://purl.org/incf/ontology/Computational_Neurosciences/external_import/external.owl"/>
        <owl:imports rdf:resource="http://purl.org/obo/owl/ro"/>
        -<owl:imports rdf:resource="http://www.ifomis.org/bfo/1.1"/>
        -<owl:imports rdf:resource="http://www.w3.org/2004/02/skos/core"/>
    </owl:Ontology>

The generated file contains

 <owl:Ontology>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Alan Ruttenberg</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Andrew Spear</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Birgit Kriener</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Erik De Schutter</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Fahim T. Imam</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">INCF MultiScale Modeling Task Force</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Lars Schwabe</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Padraig Gleeson</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Sean Hill</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Stephen D. Larson</dc:contributor>
        <dc:contributor rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Subhasis Ray</dc:contributor>
        <dc:creator rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Holger Stenzhorn</dc:creator>
        <dc:creator rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Yann Le Franc</dc:creator>
        <dc:date rdf:datatype="http://www.w3.org/2001/XMLSchema#string">13/03/2012</dc:date>
        <dc:format rdf:datatype="http://www.w3.org/2001/XMLSchema#string">application/rdf+xml</dc:format>
        <dc:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://www.ifomis.org/bfo/1.1</dc:identifier>
        <dc:language rdf:datatype="http://www.w3.org/2001/XMLSchema#string">en</dc:language>
        <dc:publisher rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Institute for Formal Ontology and Medical Information Science (IFOMIS)</dc:publisher>
        <dc:rights>http://creativecommons.org/licenses/by/3.0</dc:rights>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Barry Smith and Pierre Grenon: &quot;The Cornucopia of Formal Ontological Relations&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Barry Smith: &quot;Against Fantology&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Barry Smith: &quot;Basic Tools of Formal Ontology&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Barry Smith: &quot;Beyond Concepts: Ontology as Reality Representation&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon and Barry Smith: &quot;SNAP and SPAN: Towards Geospatial Dynamics&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon, Barry Smith and Louis Goldberg: &quot;Biodynamic Ontology: Applying BFO in the Biomedical Domain&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon: &quot;BFO in a Nutshell: A Bi-categorial Axiomatization of BFO and Comparison with DOLCE&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon: &quot;Nuts in BFO&apos;s Nutshell: Revisions to the Bi-categorial Axiomatization of BFO&quot;</dc:source>
        <dc:source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pierre Grenon: &quot;Spatio-temporality in Basic Formal Ontology: SNAP and SPAN, Upper-Level Ontology, and Framework for Formalization&quot;</dc:source>
        <dc:subject rdf:datatype="http://www.w3.org/2001/XMLSchema#string">An ontology to describe the field of Computational Neurosciences</dc:subject>
        <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Basic Formal Ontology (BFO)</dc:title>
        <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Computational Neuroscience Ontology</dc:title>
        <terms:contributor>Dave Beckett</terms:contributor>
        <terms:contributor>Nikki Rogers</terms:contributor>
        <terms:contributor>Participants in W3C&apos;s Semantic Web Deployment Working Group.</terms:contributor>
        <terms:creator>Alistair Miles</terms:creator>
        <terms:creator>Sean Bechhofer</terms:creator>
        <terms:description xml:lang="en">An RDF vocabulary for describing the basic structure and content of concept schemes such as thesauri, classification schemes, subject heading lists, taxonomies, &apos;folksonomies&apos;, other types of controlled vocabulary, and also concept schemes embedded in glossaries and terminologies.</terms:description>
        <terms:title xml:lang="en">SKOS Vocabulary</terms:title>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This ontology is used to add the Definition class of annotation as in NIF.
The source of the definition can be defined with class from OBO-annotation</rdfs:comment>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.</rdfs:comment>
        <rdfs:seeAlso rdf:resource="http://www.w3.org/TR/skos-reference/"/>
        <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1.1.1</owl:versionInfo>
        <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string">version 0.5</owl:versionInfo>
    </owl:Ontology>

For example the <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string">1.1.1</owl:versionInfo> and <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Basic Formal Ontology (BFO)</dc:title> comes from the imported ontology http://www.ifomis.org/bfo/1.1

Check Version IRI for versioning OWL ontologies

When determining the version number for OWL format ontologies, the current code uses the owl:versionInfo annotation property:

OWLAnnotationProperty versionAnnotationProperty = factory.getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_INFO.getIRI());

This was the standard location for storing version numbers in OWL 1 ontologies, but in OWL 2 the standard is Version IRI:

https://www.w3.org/TR/owl2-syntax/#Ontology_IRI_and_Version_IRI

Code should perhaps be modified to favor Version IRI, then versionInfo as a fallback.

See also: ncbo/bioportal-project#168

NoClassDefFoundError: java/xml/bind/annotations occurs during parsing of some ontologies

Encountering a NoClassDefFoundError when the system attempts to load and parse certain ontologies, e.g., the N-Triples version of the AGROVOC ontology (submission ID 16) hosted in AgroPortal.

The error occurs because we're running on Java 11 in production where the JAXB APIs were removed.

Full stack trace from local dev environment:

java.lang.NoClassDefFoundError: javax/xml/bind/annotation/adapters/HexBinaryAdapter

	at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createNode(AbstractRDFParser.java:479)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseNodeID(TurtleParser.java:1114)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseValue(TurtleParser.java:594)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseSubject(TurtleParser.java:429)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseTriples(TurtleParser.java:370)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:239)
	at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:201)
	at org.semanticweb.owlapi.rio.RioParserImpl.parseDocumentSource(RioParserImpl.java:229)
	at org.semanticweb.owlapi.rio.RioParserImpl.parse(RioParserImpl.java:180)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:221)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1294)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1234)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1191)
	at org.stanford.ncbo.oapiwrapper.OntologyParser.findMasterFile(OntologyParser.java:594)
	at org.stanford.ncbo.oapiwrapper.OntologyParser.internalParse(OntologyParser.java:513)
	at org.stanford.ncbo.oapiwrapper.OntologyParser.parse(OntologyParser.java:497)

Version numbers aren't calculated for some OBO ontologies

The getOBODataVersion method is only called for ontologies where the file extension ends with "obo". Some BioPortal end users submit OBO ontologies where the file extension ends in something else, like ".ontology". In these cases, the method to determine the version number isn't called, and the system later copies the version number from the previous submission, even if an updated version number exists in the ontology source file. The Mammalian Phenotype Ontology is one such example of this issue.

Add IRI mapper for SKOS Core Vocabulary to prevent missing import errors

As of recently, the W3C started rate limiting requests to http://www.w3.org/2004/02/skos/core:

We recently adjusted our abuse prevention systems to address an excessive volume of requests from automated systems, adding up to tens of millions of requests per day.

As a side effect of this, attempting to load ontologies in BioPortal that import SKOS Core, e.g.:

<owl:imports rdf:resource="http://www.w3.org/2004/02/skos/core"/>

.... result in missing import errors in the logs:

++++++++++++++++++++++++++++++++++++++++++++++++++
Error: OWL_IMPORT_MISSING
Message: http://www.w3.org/2004/02/skos/core
++++++++++++++++++++++++++++++++++++++++++++++++++

... and intermittently failing metrics-related unit tests in the ontologies_linked_data project. See this issue: ontoportal/ontologies_linked_data#6.

Since this is an oft-imported vocabulary, I propose an initial solution of using an IRI mapper that maps to a copy of the file that we host somewhere.

Not all ontologies in the specified input folder are parsed

End users of BioPortal are supposed to be able to create a new ontology submission where the file upload portion is a ZIP file that contains multiple ontology source files.

The findLocalOntologies method correctly identifies all ontology source files in a specified input folder, and stores them in an array. However, subsequent code that handles ontology content only loads/parses the file designated as the "master" file (the -m option).

Upgrade to OWL API 4.5.13

We're currently using 4.3.2. The Protege application is on 4.5.9. Would be good to be on the latest version of the 4.x series

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.