Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[annotate] Allow interpolation of version IRI within annotation values #1241

Open
gouttegd opened this issue Feb 7, 2025 · 2 comments
Open

Comments

@gouttegd
Copy link
Contributor

gouttegd commented Feb 7, 2025

One of the standard operations performed by the ODK when preparing import modules is to insert a dc:source ontology annotation with the value of the ontology’s version IRI. This is done with robot query --update and the following SPARQL query:

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

INSERT { 
    ?ontology dc:source ?version_iri .
}

WHERE {
  ?ontology rdf:type owl:Ontology ;
        owl:versionIRI ?version_iri .
}

While the query itself is very simple, going through all the convoluted process to execute SPARQL queries with ROBOT (converting the ontology from the OWLAPI model to the Jena model, running the query on the Jena model, dumping the updated model in Turtle, then parsing the dumped Turtle back into a OWLAPI model) is a considerable waste of resources for a task that could be done with a handful of lines of Java code. In fact, that task is so resource-intensive that the ODK has to disable it for “large” import modules.

It would be very convenient if ROBOT allowed to perform that task without having to rely on SPARQL.

I propose that it should be possible to do something like this:

robot annotate --input my-ontology.owl \
               --enable-interpolation true \
               --link-annotation dc:source "%{version_iri}" \
               --output my-annotated-ontology.owl

That is, make it possible to use %{version_iri} or %{ontology_iri} as placeholders within the values of the various *-annotation options, to be replaced with the version IRI or the ontology IRI of the current ontology.

Thoughts?

@matentzn
Copy link
Contributor

matentzn commented Feb 7, 2025

I like the idea, but what is the thought behind --enable-interpolation true? Isnt this implicit in the syntax of the interpolated value?
`

@gouttegd
Copy link
Contributor Author

gouttegd commented Feb 7, 2025

The idea was that interpolation would not be enabled by default, so that, if people have been using %{version_iri} in annotate commands before, they could still do so without any unexpected replacement unless they explicitly enable that feature.

Admittedly this is a very unlikely possibility. If you think it’s so unlikely that it is not worth it to have a guard rail, and that we can always perform interpolation without hiding the feature behind an option, that would be fine with me.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants