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

SWRL with DROOLS (protege) prefix/base error with QuantityKind vocab #819

Closed
vChavezB opened this issue Nov 22, 2023 · 8 comments
Closed

Comments

@vChavezB
Copy link
Contributor

vChavezB commented Nov 22, 2023

For my use case I need to create individuals with SWRL syntax swrlx:makeOWLThing. As mentioned here #62 (comment), reasoning seems to be working fine with Pellet in Protege but Pellet does not support this syntax. Hence, I am using DROOLS in protege with the SWRL Tab

I tried importing the QuantityKind vocabulary but the owlapi which is called by starting the DROOLS reasoner in the SWRL TAB protege 5.50 gives the error:

org.semanticweb.owlapi.model.OWLRuntimeException: Prefix not registered for prefix name: _:

grafik

If I have more nformation to pinpoint this error I will update the post.

@vChavezB vChavezB changed the title Reasoning error with DROOLS (protege) OWL API error with DROOLS (protege) Nov 22, 2023
@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 22, 2023

I have followed the solution in https://stackoverflow.com/a/72390218 and added the prefix @prefix _: <http://qudt.org/2.1/vocab/dimensionvector#> . to solve this problem.

Now I am getting an out of memory error so I will try to find out more about this

java.lang.OutOfMemoryError: GC overhead limit exceeded

@steveraysteveray
Copy link
Collaborator

@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 22, 2023

Yes sorry, my bad. It should be

@prefix _: <http://qudt.org/2.1/vocab/dimensionvector> .

I think it is now working. It just seems to be too many axioms to compute all the OWL2 RL/RDF rules . If I reduce the set of OWL2 RL rules it is able to finish the reasoning.

@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 22, 2023

I tested importing by url http://qudt.org/2.1/schema/qudt in protege and using DROOLS and the reasoning works.

However, when I only import the vocabulary http://qudt.org/2.1/vocab/quantitykind I need to save a copy of the vocabulary and add

@prefix _: <http://qudt.org/2.1/vocab/dimensionvector> .

due to how protege works with the SWRL plugin

@vChavezB vChavezB changed the title OWL API error with DROOLS (protege) OWL API error with DROOLS (protege) for QuantityKind vocab Nov 23, 2023
@vChavezB vChavezB changed the title OWL API error with DROOLS (protege) for QuantityKind vocab SWRL with DROOLS (protege) prefix/base error with QuantityKind vocab Nov 23, 2023
@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 23, 2023

I have done a more detailed inspection.

When I import the vocabulary from the URL http://qudt.org/2.1/vocab/quantitykind and then save it as a local turtle file in protege the first lines look as follows.

@prefix : <http://www.semanticweb.org/owl/owlapi/turtle#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix mc: <http://www.linkedmodel.org/owl/schema/core#> .
@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 prov: <http://www.w3.org/ns/prov#> .
@prefix qkdv: <http://qudt.org/vocab/dimensionvector/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix soqk: <http://qudt.org/vocab/soqk/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix vaem: <http://www.linkedmodel.org/schema/vaem#> .
@prefix voag: <http://voag.linkedmodel.org/schema/voag#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix constant: <http://qudt.org/vocab/constant/> .
@prefix quantitykind: <http://qudt.org/2.1/vocab/quantitykind#> .
@base <http://qudt.org/2.1/vocab/dimensionvector> .

What I dont get is why the base is changed by protege to http://qudt.org/2.1/vocab/dimensionvector. As I understand by inspecting the original vocabulary when downloaded over the url http://qudt.org/2.1/vocab/quantitykind , the base is defined at the first line of the file as # baseURI: http://qudt.org/2.1/vocab/quantitykind.

grafik

I have changed the base to http://qudt.org/2.1/vocab/quantitykind added the _ prefix (as per the stackoverflow suggestion) and it seems that SWRL tab seems to be working now.

 @prefix : <http://www.semanticweb.org/owl/owlapi/turtle#> .
@prefix _: <http://qudt.org/2.1/vocab/quantitykind> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix mc: <http://www.linkedmodel.org/owl/schema/core#> .
@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 prov: <http://www.w3.org/ns/prov#> .
@prefix qkdv: <http://qudt.org/vocab/dimensionvector/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix soqk: <http://qudt.org/vocab/soqk/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix vaem: <http://www.linkedmodel.org/schema/vaem#> .
@prefix voag: <http://voag.linkedmodel.org/schema/voag#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix constant: <http://qudt.org/vocab/constant/> .
@prefix quantitykind: <http://qudt.org/2.1/vocab/quantitykind#> .
@base <http://qudt.org/2.1/vocab/quantitykind> .

@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 23, 2023

Update I get the following reasoner error from the java based Drools engine

java.lang.IllegalArgumentException: could not resolve an OWL data range from a Drools data range with id owl:Thing

This happens when I activate the OWL 2 RL/RDF rule related to semantic vocabulary range (Table 9, scm-rng1).

which is defined as

If Then
T(?p, rdfs:range, ?c1)
T(?c1, rdfs:subClassOf, ?c2)
T(?p, rdfs:range, ?c2)

I will deactivate it for now in DROOLS (SCM_RNG1) and continue testing the vocabulary with DROOLS reasoner and report any other findings.

@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 24, 2023

I found out that the BASE IRI is decoded correctly by protege if the annotation property rdfs:isDefinedBy is deleted

i.e. rdfs:isDefinedBy <http://qudt.org/2.1/vocab/quantitykind> ;

This happens in general with any ontology that uses rdfs:isDefinedBy and points to the same ontology IRI in protege.

@vChavezB
Copy link
Contributor Author

vChavezB commented Nov 24, 2023

So this is my summary so far

Protege has a problem decoding the BASE IRI (see protegeproject/protege#1181) and setting it in the GUI as I showed in #819 (comment) when the annotation property rdfs:isDefinedBy is set to the Ontology IRI. Will probably report this to protege.

And the workaround I found is to download the vocabulary from qudt and adding the prefix @prefix _: <http://qudt.org/2.1/vocab/quantitykind/> .

# baseURI: http://qudt.org/2.1/vocab/quantitykind
# imports: http://qudt.org/2.1/schema/facade/qudt
# imports: http://qudt.org/2.1/vocab/dimensionvector
@prefix constant: <http://qudt.org/vocab/constant/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix mc: <http://www.linkedmodel.org/owl/schema/core#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix qkdv: <http://qudt.org/vocab/dimensionvector/> .
@prefix quantitykind: <http://qudt.org/vocab/quantitykind/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix soqk: <http://qudt.org/vocab/soqk/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix vaem: <http://www.linkedmodel.org/schema/vaem#> .
@prefix voag: <http://voag.linkedmodel.org/schema/voag#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix _: <http://qudt.org/2.1/vocab/quantitykind/> .

In addition, I think this issue is not that critical. I am importing this vocabulary in another ontology I am developing and it works without the _ prefix. Only the main ontology used for reasoning requires the _ prefix.

So I guess I will leave this just as info in case someone is trying to reason with DROOLS in protege and bumps into this issue :)

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