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

MERGE annotates xsd datatypes #1163

Closed
jmkeil opened this issue Nov 21, 2023 · 4 comments · Fixed by #1171
Closed

MERGE annotates xsd datatypes #1163

jmkeil opened this issue Nov 21, 2023 · 4 comments · Fixed by #1171
Assignees

Comments

@jmkeil
Copy link
Contributor

jmkeil commented Nov 21, 2023

I am currently setting up a pipeline that merges all ontology modules of a project into one file. During that I notices that robot merge --annotate-derived-from true … also adds annotations to used XSD datatypes, as that triggered some other problems (owlcs/owlapi#1116) later on. I think, it would be better to not annotate the XSD datatypes in the same way rdf:type will not be annotated.

Example:

# test-robot-xsd.ttl

@prefix : <http://example.com/test-robot-xsd#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/test-robot-xsd> rdf:type owl:Ontology .

:someDataProperty rdf:type owl:DatatypeProperty .

:someIndividual rdf:type owl:NamedIndividual ;
                :someDataProperty "true"^^xsd:boolean ,
                                  "2000-01-01"^^xsd:date ,
                                  "2000-01-01T00:00:00"^^xsd:dateTime ,
                                  0.1 ,
                                  0.1e0 ,
                                  1 ,
                                  "a" .

Executed command: robot merge --input test-robot-xsd.ttl --annotate-defined-by true --output test-robot-xsd.merge.ttl

# test-robot-xsd.merge.ttl

@prefix : <http://example.com/test-robot-xsd#> .
@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 <http://example.com/test-robot-xsd> .

<http://example.com/test-robot-xsd> rdf:type owl:Ontology .

#################################################################
#    Datatypes
#################################################################

###  http://www.w3.org/2001/XMLSchema#boolean
xsd:boolean rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#date
xsd:date rdf:type rdfs:Datatype ;
         rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#dateTime
xsd:dateTime rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#decimal
xsd:decimal rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#double
xsd:double rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#integer
xsd:integer rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  http://www.w3.org/2001/XMLSchema#string
xsd:string rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


#################################################################
#    Data properties
#################################################################

###  http://example.com/test-robot-xsd#someDataProperty
:someDataProperty rdf:type owl:DatatypeProperty ;
                  rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


#################################################################
#    Individuals
#################################################################

###  http://example.com/test-robot-xsd#someIndividual
:someIndividual rdf:type owl:NamedIndividual ;
                :someDataProperty "true"^^xsd:boolean ,
                                  "2000-01-01"^^xsd:date ,
                                  "2000-01-01T00:00:00"^^xsd:dateTime ,
                                  0.1 ,
                                  "0.1"^^xsd:double ,
                                  1 ,
                                  "a" ;
                rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  Generated by the OWL API (version 4.5.26) https://github.com/owlcs/owlapi
@jmkeil jmkeil changed the title merge annotates xsd datatypes MERGE annotates xsd datatypes Nov 21, 2023
@jamesaoverton
Copy link
Member

This was introduced in #977. Do the people who were involved in that have any thoughts? @hkir, @matentzn, @balhoff?

@matentzn
Copy link
Contributor

@hkir-dev volunteered to take this on, thanks for the report!

@hkir-dev
Copy link
Contributor

hkir-dev commented Dec 1, 2023

I started an implementation that excludes built-in OWL 2 datatypes

However, I noticed that xsd:date isn't a built-in data type. So new output will be:

@prefix : <http://example.com/test-robot-xsd#> .
@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 <http://example.com/test-robot-xsd> .

<http://example.com/test-robot-xsd> rdf:type owl:Ontology .

#################################################################
#    Datatypes
#################################################################

###  http://www.w3.org/2001/XMLSchema#date
xsd:date rdf:type rdfs:Datatype ;
         rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


#################################################################
#    Data properties
#################################################################

###  http://example.com/test-robot-xsd#someDataProperty
:someDataProperty rdf:type owl:DatatypeProperty ;
                  rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


#################################################################
#    Individuals
#################################################################

###  http://example.com/test-robot-xsd#someIndividual
:someIndividual rdf:type owl:NamedIndividual ;
                :someDataProperty "true"^^xsd:boolean ,
                                  "2000-01-01"^^xsd:date ,
                                  "2000-01-01T00:00:00"^^xsd:dateTime ,
                                  0.1 ,
                                  "0.1"^^xsd:double ,
                                  1 ,
                                  "a" ;
                rdfs:isDefinedBy <http://example.com/test-robot-xsd> .


###  Generated by the OWL API (version 4.5.26) https://github.com/owlcs/owlapi

Should we consider ignoring all data types, not just the built-in ones, or continue with the current implementation?

@balhoff
Copy link
Contributor

balhoff commented Dec 1, 2023

@hkir-dev you could just exclude anything defined as the reserved vocabulary of OWL 2:

IRIs with prefixes rdf:, rdfs:, xsd:, and owl: constitute the reserved vocabulary of OWL 2

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

Successfully merging a pull request may close this issue.

5 participants