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

JSON-LD Writer writes types with expanded rdf:type IRI #3643

Open
daltontc opened this issue Jan 25, 2022 · 0 comments
Open

JSON-LD Writer writes types with expanded rdf:type IRI #3643

daltontc opened this issue Jan 25, 2022 · 0 comments
Labels
🐞 bug issue is a bug 📦 rio affects the Rio RDF Parser/Writer toolkit

Comments

@daltontc
Copy link

Current Behavior

Statements with type declarations are being written out with the expanded rdf:type IRI rather than the @type shorthand when using the JSONLD Writer. Changing the JSONLDSettings. USE_RDF_TYPE property appears to have no effect on the out.

When writing out a model that has an individual with types other than owl:NamedIndividual, the JSONLD Writer prints out the full IRI for rdf:type for the non owl:NamedIndividual types but will correctly write out the @type for owl:NamedIndividual.

For example,

@prefix : <http://test.com/ontology> .

:Class1 rdf:type owl:Class .

:Individual1 rdf:type owl:NamedIndividual ,
                       :Class1 .

:Class2 a owl:Class .

:Individual2 a :Class1 .

Becomes:

[ {
  "@id" : "http://test.com/ontologyClass1",
  "@type" : [ "http://www.w3.org/2002/07/owl#Class" ]
}, {
  "@id" : "http://test.com/ontologyClass2",
  "@type" : [ "http://www.w3.org/2002/07/owl#Class" ]
}, {
  "@id" : "http://test.com/ontologyIndividual1",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ],
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" : [ {
    "@id" : "http://test.com/ontologyClass1"
  } ]
}, {
  "@id" : "http://test.com/ontologyIndividual2",
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" : [ {
    "@id" : "http://test.com/ontologyClass1"
  } ]
} ]

Expected Behavior

All types for a given subject should be written out with the @type annotation.

The above example should become:

[ {
  "@id" : "http://test.com/ontologyClass1",
  "@type" : [ "http://www.w3.org/2002/07/owl#Class" ]
}, {
  "@id" : "http://test.com/ontologyClass2",
  "@type" : [ "http://www.w3.org/2002/07/owl#Class" ]
}, {
  "@id" : "http://test.com/ontologyIndividual1",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual", "http://test.com/ontologyClass1" ]
}, {
  "@id" : "http://test.com/ontologyIndividual2",
  "@type" : [ "http://test.com/ontologyClass1" ]
} ]

Steps To Reproduce

https://github.com/daltontc/rdf4jTest/tree/bug/multiple_types

Version

3.7.4

Are you interested in contributing a solution yourself?

No response

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug issue is a bug 📦 rio affects the Rio RDF Parser/Writer toolkit
Projects
None yet
Development

No branches or pull requests

2 participants