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

Catalog not used for --input-iri #1030

Closed
psiotwo opened this issue Jul 20, 2022 · 6 comments
Closed

Catalog not used for --input-iri #1030

psiotwo opened this issue Jul 20, 2022 · 6 comments

Comments

@psiotwo
Copy link
Contributor

psiotwo commented Jul 20, 2022

Catalog file does not seem to be used for --input-iri (tested on query command). Based on the documentation I am not completely sure if it is a bug, or intended behaviour. Yet, for my use-case I would like to use the provided catalog for any IRI around (i.e. not only in owl:imports statements, but also in --input-iri parameters).


Example:

test.owl:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://test.org/test.owl> a owl:Ontology ;
    owl:imports <http://test.org/test-imported.owl> .

test-imported.owl:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://test.org/test-imported.owl> a owl:Ontology .

test.rq:
ASK {}

catalog-custom-name.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <uri name="http://test.org/test-imported.owl" uri="test-imported.owl"/>
</catalog>

The following commands succeeds
robot query --catalog catalog-custom-name.xml --input test.owl --query test.rq output.csv
robot query --input test-imported.owl --query test.rq output.csv

while the following fails
robot query --catalog catalog-custom-name.xml --input-iri http://test.org/test-imported.owl --query test.rq output.csv

with org.semanticweb.owlapi.io.OWLOntologyCreationIOException: test.org

@cmungall
Copy link
Contributor

cmungall commented Jul 20, 2022 via email

@jamesaoverton
Copy link
Member

Yes, this is intended behaviour. Checking for a local catalogue file is cheap and fast, and matches Protege's behaviour. So ROBOT makes a guess and checks for local catalogs without asking. Making a network request based on a guess could take seconds and cause other unexpected behaviour.

@psiotwo are you proposing that when using --input-iri http://example.com/foo.owl we should interpret --catalog cat.xml as relative, so http://example.com/cat.xml? That seems slightly too "magical" to me. I doubt that anybody is using a remote input with a local catalogue, but changing this behaviour would break that.

Maybe we could add an explicit --catalog-iri http://example.com/cat.xml option.

@balhoff
Copy link
Contributor

balhoff commented Jul 20, 2022

@jamesaoverton I think you're responding to something different. To me the request is totally sensible. An IRI input specified via --input-iri is currently directly requested, but IRIs in its imports are first mapped to URLs using the provided catalog, then requested. The IRI given to --input-iri should first be mapped to a URL via the catalog before it's requested. (I didn't know this was the case, just believing the report so far).

I think it's just a bug. The catalog is added to the manager before loading, but then an IRIDocumentSource is created, which I guess forces it to treat the provided IRI as a physical location:

ontology = loadOntology(manager, new IRIDocumentSource(ontologyIRI));

@psiotwo
Copy link
Contributor Author

psiotwo commented Jul 21, 2022

I think this is by design, you are assumed to know the paths or urls of your inputs. I can see the use case for using logical names instead but I think technically introducing this could be breaking behavior if introduced?

@cmungall If the current behaviour is not a bug :-) then probably yes - it might happen that if the --input-iri is dereferenceable, after my proposal, it can be rewired to another URL based on the mapping provided by the local catalog. (Yet, using the same IRI for different resources is a bad practice anyway.)

In case the current behaviour is correct, at least the parameter name --input-iri is misleading (should be --input-url).

@psiotwo
Copy link
Contributor Author

psiotwo commented Jul 21, 2022

Yes, this is intended behaviour.

@jamesaoverton my point was different (not remote catalogs, but using local catalogs for resolving physical URLs of --input-iri parameters), as @balhoff points out.

psiotwo added a commit to psiotwo/robot that referenced this issue Jul 28, 2022
psiotwo added a commit to psiotwo/robot that referenced this issue Jul 28, 2022
jamesaoverton added a commit to psiotwo/robot that referenced this issue Oct 28, 2022
jamesaoverton added a commit that referenced this issue Oct 28, 2022
@psiotwo
Copy link
Contributor Author

psiotwo commented Oct 31, 2022

Checked. Works in 1.9.1.

@psiotwo psiotwo closed this as completed Oct 31, 2022
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

No branches or pull requests

4 participants