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

Imported ontologies in turtle format have odd RDF artifacts when saved #1023

Closed
nickdrummond opened this issue Aug 12, 2021 · 2 comments · Fixed by #1178
Closed

Imported ontologies in turtle format have odd RDF artifacts when saved #1023

nickdrummond opened this issue Aug 12, 2021 · 2 comments · Fixed by #1178
Assignees
Labels
Status: Reproduced For issues that are (critical) bugs, denotes that the bug is reproduced, but no further action taken Type: Bug Indicates that Protege is not working as expected

Comments

@nickdrummond
Copy link
Contributor

Heyup! Fantastic tool you have there!! One tiny niggle...

The problem with roundtripping turtle format ontologies in #609 still occurs on imported ontologies...

tiny-turtle-imports.zip

  1. Open b.owl
  2. change the active ontology to a.owl
  3. modified it (add an ontology annotation for example)
  4. saved a.owl

a.owl has blank nodes and odd comments (see below) - other more complex ontologies expose RDF structures

The fix looks like just running the DocumentFormatUpdater on the imports closure of the loaded ontologies to prevent Rio being used for serialisation.

I have a pull request - will try to link that. Couldn't come up with a reasonable test as it would be a large integration test.

@prefix : <http://null.com/a#> .
@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#> .
# 
# 
# #################################################################
# #
# #    Object Properties
# #
# #################################################################
# 
# 
# http://null.com/a#p
# 
# 
# 
# #################################################################
# #
# #    Classes
# #
# #################################################################
# 
# 
# http://null.com/a#X
# 
# http://null.com/a#Y
# 
# Generated by the OWL API (version 5.1.17.2020-11-07T15:03:35Z) https://github.com/owlcs/owlapi/

<http://null.com/a> a owl:Ontology;
  rdfs:comment "sss" .

:p a owl:ObjectProperty .

:X a owl:Class;
  rdfs:subClassOf _:genid1 .

_:genid1 a owl:Restriction;
  owl:someValuesFrom :Y;
  owl:onProperty :p .

:Y a owl:Class .

Checking the impact of the Rio ttl serialisation:

package com.nickd.sw;

import junit.framework.TestCase;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.formats.RioTurtleDocumentFormat;
import org.semanticweb.owlapi.io.FileDocumentSource;
import org.semanticweb.owlapi.io.OWLOntologyDocumentSource;
import org.semanticweb.owlapi.model.*;

import java.io.File;
import java.net.URISyntaxException;

public class TtlRoundtripTest extends TestCase {

    public void testCorruptA () throws OWLOntologyCreationException, OWLOntologyStorageException, URISyntaxException {
        OWLOntologyManager mngr = new OWLManager().get();
        File a = new File(getClass().getClassLoader().getResource("a.owl.ttl").toURI());
        OWLOntologyDocumentSource docSource = new FileDocumentSource(a, new RioTurtleDocumentFormat());
        OWLOntology ontA = mngr.loadOntologyFromOntologyDocument(docSource);
        OWLDocumentFormat format = new RioTurtleDocumentFormat();
        ontA.saveOntology(format, System.out);
    }
}
@nickdrummond
Copy link
Contributor Author

Sorry, can't work out how to link the pull request - #1025

@jmkeil
Copy link
Contributor

jmkeil commented Oct 9, 2023

@gouttegd This is still an issue in Protege 5.6.3. Would be great, if it gets fixed.

@gouttegd gouttegd self-assigned this Oct 31, 2023
@gouttegd gouttegd added Type: Bug Indicates that Protege is not working as expected Status: Reproduced For issues that are (critical) bugs, denotes that the bug is reproduced, but no further action taken labels Oct 31, 2023
gouttegd pushed a commit that referenced this issue Oct 31, 2023
When updating the document format of the loaded ontology, make sure to
also update the format of all ontologies in the imports closure.

closes #1023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reproduced For issues that are (critical) bugs, denotes that the bug is reproduced, but no further action taken Type: Bug Indicates that Protege is not working as expected
Projects
None yet
3 participants