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

[FEATURE] Utility method to load prefixes from prefix.cc #957

Open
lewismc opened this issue Jul 19, 2020 · 4 comments
Open

[FEATURE] Utility method to load prefixes from prefix.cc #957

lewismc opened this issue Jul 19, 2020 · 4 comments

Comments

@lewismc
Copy link
Contributor

lewismc commented Jul 19, 2020

PrefixManager currently facilitates #copyPrefixesFrom(Map<String,String> from) which is useful if the implementer has already created a Map<String,String> of prefixes.
In the case where an implementer want to write more flexible code to make the PrefixManager prefix-aware, I feel like a nice feature would be to use something like prefix.cc to populate these.
For example, we could add a new function #loadFromPrefixCC which would return a Map<String,String> simply by hitting http://prefix.cc/popular/all.json. This could then be implemented as follows

try {
  copyPrefixesFrom(loadFromPrefixCC());
} catch {
...
}

Any thoughts folks?

@lewismc lewismc changed the title [FEATURE] Utility method to load Prefixes from prefix.cc [FEATURE] Utility method to load prefixes from prefix.cc Jul 19, 2020
@ignazio1977
Copy link
Contributor

Sounds interesting but I believe it will require some more work to make renderers aware of which prefixes are used in the ontology. Might cause a lot of unused prefixes to appear in the output.

@lewismc
Copy link
Contributor Author

lewismc commented Jul 19, 2020

Hi @ignazio1977 thanks for feedback.
The issue right now, for me at least, is that OWLAPI removes all of my existing user-defined prefixes and uses the full URI's instead. This is not my preferred method of writing succinct TTL. I would rather use the prefix. The problem however, is that when I instantiate the PrefixManager, it is ignorant of my existing prefixes, removes them entirely and uses the fully qualified URI.
Does this situation happen to anyone else or is it just me?
Thanks again @ignazio1977

@ignazio1977
Copy link
Contributor

The prefixes used in the input file should be retained as part of the ontology format, so if you parse an ontology, its manager should have an OWLDocumentFormat for it (manager.getFormat(OWLOntology) should retrieve it). If you use that format to save, or if you don't specify a format, it should reuse the original prefixes; when changing formats, you should be able to copy the prefixes across.

@ignazio1977
Copy link
Contributor

On that topic - I've not tried this to be sure it works, I believe there are unit tests that would fail if I'm mistaken. Not to say it's the best state of affairs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants