Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Inherit OWLDocumentFormat when performing SPARQL update [#1267]
- Updated obographs to [version 0.3.2](https://github.com/geneontology/obographs/releases/tag/v0.3.2)


## [1.9.8] - 2025-05-15

### Added
Expand Down
173 changes: 87 additions & 86 deletions docs/examples/nucleus.owl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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#>
Prefix: foo: <http://example.org/foo/> # This prefix declaration should survive the SPARQL update roundtrip to OWL



Expand All @@ -11,178 +12,178 @@ Ontology: <http://robot.obolibrary.org/nucleus.owl>

AnnotationProperty: rdfs:label


Datatype: xsd:string


ObjectProperty: <http://purl.obolibrary.org/obo/BFO_0000050>

Characteristics:
Characteristics:
Transitive


Class: <http://purl.obolibrary.org/obo/GO_0005623>

Annotations:
Annotations:
rdfs:label "cell"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0005575>


Class: <http://purl.obolibrary.org/obo/GO_0043229>

Annotations:
Annotations:
rdfs:label "intracellular organelle"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005622>,
<http://purl.obolibrary.org/obo/GO_0044424>,
<http://purl.obolibrary.org/obo/GO_0043226>


Class: <http://purl.obolibrary.org/obo/GO_0044464>

Annotations:
Annotations:
rdfs:label "cell part"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005623>,
<http://purl.obolibrary.org/obo/GO_0005575>


Class: <http://purl.obolibrary.org/obo/GO_0043226>

Annotations:
Annotations:
rdfs:label "organelle"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0005575>


Class: <http://purl.obolibrary.org/obo/GO_0044428>

Annotations:
Annotations:
rdfs:label "nuclear part"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005634>,
<http://purl.obolibrary.org/obo/GO_0044446>


Class: <http://purl.obolibrary.org/obo/GO_0043227>

Annotations:
Annotations:
rdfs:label "membrane-bounded organelle"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0043226>


Class: <http://purl.obolibrary.org/obo/GO_0005575>

Annotations:
Annotations:
rdfs:label "cellular_component"


Class: <http://purl.obolibrary.org/obo/GO_0044424>

Annotations:
Annotations:
rdfs:label "intracellular part"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005622>,
<http://purl.obolibrary.org/obo/GO_0044464>


Class: <http://purl.obolibrary.org/obo/GO_0005622>

Annotations:
Annotations:
rdfs:label "intracellular"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0044464>


Class: <http://purl.obolibrary.org/obo/GO_0044422>

Annotations:
Annotations:
rdfs:label "organelle part"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0043226>,
<http://purl.obolibrary.org/obo/GO_0005575>


Class: <http://purl.obolibrary.org/obo/GO_0031974>

Annotations:
Annotations:
rdfs:label "membrane-enclosed lumen"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0005575>


Class: <http://purl.obolibrary.org/obo/GO_0005634>

Annotations:
Annotations:
rdfs:label "nucleus"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0043231>


Class: <http://purl.obolibrary.org/obo/GO_0044446>

Annotations:
Annotations:
rdfs:label "intracellular organelle part"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005622>,
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0043229>,
<http://purl.obolibrary.org/obo/GO_0044422>,
<http://purl.obolibrary.org/obo/GO_0044424>,
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0043226>


Class: <http://purl.obolibrary.org/obo/GO_0070013>

Annotations:
Annotations:
rdfs:label "intracellular organelle lumen"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0043233>,
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0043229>,
<http://purl.obolibrary.org/obo/GO_0044446>


Class: <http://purl.obolibrary.org/obo/GO_0043231>

Annotations:
Annotations:
rdfs:label "intracellular membrane-bounded organelle"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0043227>,
<http://purl.obolibrary.org/obo/GO_0043229>


Class: <http://purl.obolibrary.org/obo/GO_0031981>

Annotations:
Annotations:
rdfs:label "nuclear lumen"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0005634>,
<http://purl.obolibrary.org/obo/GO_0070013>,
<http://purl.obolibrary.org/obo/GO_0044428>


Class: <http://purl.obolibrary.org/obo/GO_0043233>

Annotations:
Annotations:
rdfs:label "organelle lumen"
SubClassOf:

SubClassOf:
<http://purl.obolibrary.org/obo/GO_0031974>,
<http://purl.obolibrary.org/obo/BFO_0000050> some <http://purl.obolibrary.org/obo/GO_0043226>,
<http://purl.obolibrary.org/obo/GO_0044422>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.jena.query.Dataset;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.tdb.TDBFactory;
import org.semanticweb.owlapi.model.OWLDocumentFormat;
import org.semanticweb.owlapi.model.OWLOntology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -338,7 +339,10 @@ private static OWLOntology executeUpdate(
catalogPath = null;
}
}
return QueryOperation.convertModel(model, ioHelper, catalogPath, useTemporaryFile);

OWLDocumentFormat format =
inputOntology.getOWLOntologyManager().getOntologyFormat(inputOntology);
return QueryOperation.convertModel(model, ioHelper, catalogPath, useTemporaryFile, format);
}

/**
Expand Down
36 changes: 33 additions & 3 deletions robot-core/src/main/java/org/obolibrary/robot/QueryOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,50 @@ public static OWLOntology convertModel(Model model, IOHelper ioHelper, String ca
public static OWLOntology convertModel(
Model model, IOHelper ioHelper, String catalogPath, boolean useTemporaryFile)
throws IOException {
return convertModel(model, ioHelper, catalogPath, false, null);
}

/**
* Given a Model, an IOHelper, and a path to an XML catalog, convert the model to an OWLOntology
* object.
*
* @param model Model to convert to OWLOntology
* @param ioHelper IOHelper to load ontology
* @param catalogPath String path to XML catalog
* @param useTemporaryFile whether to use a temporary file to store intermediate results or to
* keep them in memory.
* @param format The OWLDocumentFormat to use in the conversion.
* @return OWLOntology object version of model
* @throws IOException on issue loading ontology
*/
public static OWLOntology convertModel(
Model model,
IOHelper ioHelper,
String catalogPath,
boolean useTemporaryFile,
OWLDocumentFormat format)
throws IOException {
OWLOntology updatedOntology;
if (useTemporaryFile) {
final File tempFile = File.createTempFile("robot", ".owl");
tempFile.deleteOnExit();
try (final BufferedOutputStream os =
new BufferedOutputStream(new FileOutputStream(tempFile))) {
RDFDataMgr.write(os, model, Lang.TTL);
}
return ioHelper.loadOntology(
new BufferedInputStream(new FileInputStream(tempFile)), catalogPath);
updatedOntology =
ioHelper.loadOntology(
new BufferedInputStream(new FileInputStream(tempFile)), catalogPath);
} else {
ByteArrayOutputStream os = new ByteArrayOutputStream();
RDFDataMgr.write(os, model, Lang.TTL);
return ioHelper.loadOntology(new ByteArrayInputStream(os.toByteArray()), catalogPath);
updatedOntology =
ioHelper.loadOntology(new ByteArrayInputStream(os.toByteArray()), catalogPath);
}
if (format != null) {
updatedOntology.getOWLOntologyManager().setOntologyFormat(updatedOntology, format);
}
return updatedOntology;
}

/**
Expand Down
Loading