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

Importing qudt in another ontology in Protege #842

Closed
vChavezB opened this issue Dec 19, 2023 · 14 comments
Closed

Importing qudt in another ontology in Protege #842

vChavezB opened this issue Dec 19, 2023 · 14 comments

Comments

@vChavezB
Copy link
Contributor

I am a qudt user that is developing an ontology with Protégé. After some testing I found a bug in the owlapi related to resolving the IRI of the ontology (See owlcs/owlapi#1080). In particular this happens because qudt has an annotation value that points to the IRI of the ontology

rdfs:isDefinedBy <http://qudt.org/2.1/schema/qudt> ;

This bug does not allow to properly use qudt in protege if its imported in another ontology. The main problem is that protege does not load qudt correctly and autocomplete functionality, inference and ontologies that want to import qudt will not work.

Below you will find how to reproduce this issue. I know this is not fault of QUDT but of the owlapi (used by Protege). Hence I would like to document this issue so other Protege users are aware of this when using QUDT. You will note that I also include screenshots of how this should look like. This is because I fixed this :) but it is still not merged in to owlapi nor Protege (which will probably take a long time).

Example

Open this turtle ontology in Protege

@prefix : <www.usecase1.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <www.usecase1.com/> .

<urn:absolute:www.usecase1.com> rdf:type owl:Ontology ;
                                owl:imports <http://qudt.org/schema/qudt> .
:MyClass rdf:type owl:Class .

:MySubclass rdf:type owl:Class ;
            rdfs:subClassOf :MyClass .

Expected behavior

QUDT Classes are loaded and import is shown correctly:

Actual behavior

Not all classes are loaded and the import information is not complete.

@steveraysteveray
Copy link
Collaborator

@vChavezB, thanks for your comments. I have a question and an observation:

Question: Have you tried your example, but importing http://qudt.org/2.1/schema/qudt, i.e. the versioned schema? I'm wondering if that might work better.

Observation: You are probably aware that importing just the schema without the vocabularies will not give you the benefit of all the unit etc. definitions. Try importing http://qudt.org/2.1/vocab/unit and let me know how that goes.

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 4, 2024

Tests with namespace http://qudt.org/2.1/

Have you tried your example, but importing http://qudt.org/2.1/schema/qudt, i.e. the versioned schema? I'm wondering if that might work better


@steveraysteveray The same behaviour occured as the one I posted above where not all qudt classes are loaded correctly.


Try importing http://qudt.org/2.1/vocab/unit and let me know how that goes.


It loads the unit vocabulary but when loaded in protege it shows assertions of individuals as annotation properties. Which I think happens because http://qudt.org/2.1/schema/qudt was not loaded correctly.

grafik


This is how the same individual looks with the patch I made for the owlapi in Protege.


grafik

Final thoughts

You are probably aware that importing just the schema without the vocabularies will not give you the benefit of all the unit etc. definitions.

Oh yes I am aware of this. Part of my research project involves developing a software that loads an ontology that imports qudt. Thats the reason I went down the rabbit hole to make qudt work with the owlapi (and protege) which so far works fine with SWRL queries and reasoning engines. The only thing I have noticed is that it takes around 70 seconds when an ontology imports the vocabularies: unit, quantityKind, dimensionVector but seems reasonable as the amount of assertions combined is around 50 thousand.

Edit: The loading time is reduced when using local copies to around 2-3 seconds.

@steveraysteveray
Copy link
Collaborator

I just tried duplicating your screen shots above, and found that using Protege 5.5.0 it works correctly. I had earlier had problems with the more recent versions of Protege, which is why we had included the disclaimer in the Readme:

Disclaimer: The QUDT ontologies have been tested to load without error only in Protege 5.5.0, but not later releases.

Perhaps you could test 5.5.0 as well to see if you get the same behavior as I do? If so, could you refine the documentation in your PR to reflect that?

@steveraysteveray
Copy link
Collaborator

Actually, let me add that I only tested by directly uploading http://qudt.org/2.1/vocab/unit, not importing it. Is that consistent with your findings?

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 5, 2024

Hello @steveraysteveray. Yes, forgot to mention the results I posted in #842 (comment) were with the ontology that imports qudt. As github has blacklisted ttl files I will post the modified turtle file here as text

@prefix : <www.usecase1.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <www.usecase1.com/> .

<urn:absolute:www.usecase1.com> rdf:type owl:Ontology ;
                                owl:imports <http://qudt.org/2.1/vocab/unit> .
:MyClass rdf:type owl:Class .

:MySubclass rdf:type owl:Class ;
            rdfs:subClassOf :MyClass .

@steveraysteveray
Copy link
Collaborator

I just tried using your turtle file, and it seems to work correctly with Protege 5.5.0.

It does still mess up in showing the graph IRIs:

image

...but otherwise seems OK.

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 5, 2024

Is that screenshot with the turtle file from my previous comment? In that comment I import http://qudt.org/2.1/vocab/unit

grafik

@steveraysteveray
Copy link
Collaborator

Yes, it is.

@steveraysteveray
Copy link
Collaborator

I only captured part of the "Imported ontologies" pane. It would take some more digging to figure out why some graphs are listed correctly and some not. Here's a bit more:

image

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 5, 2024

The reason some imported ontologies are listed with the incorrect IRI has to do with the owlapi bug I mentioned

I think I have noticed that the difference I got was because I have been loading directly http://qudt.org/vocab/unit instead of the versioned iri (http://qudt.org/2.1/vocab/unit).

Now I get the same result as you with Protege 5.5.0.

I will change my ontology imports to the namespace http://qudt.org/2.1 and try to see if the software I am working on still behaves the same or if I need the owlapi patch to solve the IRI bug.

To be continued...

@steveraysteveray
Copy link
Collaborator

Many thanks! We can update the Readme PR accordingly, based on what you find.

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 5, 2024

Works with Protege if using qudt.org/2.1

I have tested it further and it seems to work correctly in Protege if the versioned IRI is used (http://qudt.org/2.1).

Use with other ontology APIs

However for the case where I am working in java with the owlapi and loading the ontology that imports qudt I get an error due to the bug with the IRI.

So I am not sure how important for the qudt organization it is to document this. I can change this in the PR but this is a really specific use case where I am using qudt to develop a software and might be of interest only for software developers that want to use qudt. So far my experience has been:

  1. owlapi (java): Has a bug with IRI name resolution and does not allow to load qudt.
  2. owlready2 (python): Does not load turtle files, only accepts rdf
  3. Apache Jena (java): Loads correctly.
  4. owlcs/ont-api (java): Loads correctly.

@steveraysteveray
Copy link
Collaborator

How about you include a link to the above comment (#842 (comment)) in an edit to your PR and we leave it at that? Something like: "Please note that various libraries exhibit different behaviors when importing the QUDT ontology, see ..."

@vChavezB
Copy link
Contributor Author

vChavezB commented Jan 5, 2024

Ok seems good to me. I will close this issue as it was solved by importing qudt with versioned IRI in Protege.

@vChavezB vChavezB closed this as completed Jan 5, 2024
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

2 participants