owlcs / owlapi

OWL API main repository
828 stars 315 forks source link

Extend Namespaces enum with common prefixes #10

Closed ignazio1977 closed 11 years ago

ignazio1977 commented 11 years ago

The Namespaces enum can be extended to include a common prefix for each of the namespaces, along with a marker to indicate if the namespace is known to be deprecated and not in use currently.

p_ansell: Patch can be found at: https://github.com/ansell/owlapi/compare/master...SF-3577999

ansell commented 11 years ago

That patch is a little out of date. I will rebase it against the current master and open a pull request for it.

On 27 May 2013 22:12, ignazio1977 notifications@github.com wrote:

The Namespaces enum can be extended to include a common prefix for each of the namespaces, along with a marker to indicate if the namespace is known to be deprecated and not in use currently.

p_ansell: Patch can be found at: https://github.com/ansell/owlapi/compare/master...SF-3577999

— Reply to this email directly or view it on GitHubhttps://github.com/ignazio1977/owlapi/issues/10 .

ansell commented 11 years ago

Would you like me to remove the dependency on OpenRDF Sesame when I rebase it or should I target it at release4 instead?

I have been using it to automatically generate org.openrdf.model.Namespace objects for each of the namespaces but I can do that in another place if you want it on master without the new dependency.

On 28 May 2013 06:50, Peter Ansell ansell.peter@gmail.com wrote:

That patch is a little out of date. I will rebase it against the current master and open a pull request for it.

On 27 May 2013 22:12, ignazio1977 notifications@github.com wrote:

The Namespaces enum can be extended to include a common prefix for each of the namespaces, along with a marker to indicate if the namespace is known to be deprecated and not in use currently.

p_ansell: Patch can be found at: https://github.com/ansell/owlapi/compare/master...SF-3577999

— Reply to this email directly or view it on GitHubhttps://github.com/ignazio1977/owlapi/issues/10 .

ignazio1977 commented 11 years ago

I'm not sure about the dependency - I haven't wrapped my head around the RIO patch yet and I'm trying to determine whether it should create dependencies in the API module. I suppose the purpose of previous patches on unifying RDF classes is to enable swapping of parsers in and out, so wouldn't this dependency work in the opposite direction?

Minus the dependency, I'm happy with the patch as it is, I can do the small rework involved.

ansell commented 11 years ago

While you are patching the Namespaces class you may want to expand it to include some of the other RDFa Common Prefixes that have recently attracted attention as a source of default prefix mappings for semantic web applications:

http://www.w3.org/2011/rdfa-context/rdfa-1.1

The owlapi-api module only relies on the sesame-rio-api module (and its dependencies, sesame-model and sesame-util). The actual parsers in Sesame Rio (sesame-rio-turtle, sesame-rio-nquads,... etc.) are all linked in at runtime using META-INF/services entries, so they only need to be included in the classpath at runtime to be activated.

The Rio entries in owlapi-api only link to the constants in RDFFormat, which are shared and universally used in Rio to identify specific RDF formats. I couldn't just use RDFFormat, as the are OWLOntologyFormats that are not RDFFormats, so I added another layer to allow references to RDFFormats from the RDF subset of OWLOntologyFormats.

The addition of OWLOntologyFormatFactory (which could have its name changed if necessary), was necessary to allow loading of OWLOntologyFormatFactorys at runtime. That would allow most of the formats to move to the owlapi-rio module (except for RioRDFOntologyFormat that provides the link between RDFFormat and OWLOntologyFormat). Alternatively, they could be in a new sesame-rio-owlapi module if we add this to sesame through SES-17 [1]. However, I do not want to link to the owlapi-rio module at compile time, as it includes dependencies on owlapi-parsers which defeats the purpose of abstracting those details using an API.

[1] https://openrdf.atlassian.net/browse/SES-17

matthewhorridge commented 11 years ago

It doesn't look like this has made it into a release yet - correct? Just wondering because I like the changes over all, but how about renaming prefix and getPrefix to prefixName and getPrefixName? I'm suggesting this because I'm under the impression that the the prefix is what is now called the "base IRI" e.g. "http://www.w3.org/2002/07/owl#" and the prefix name is the short name used to name the prefix e.g. "owl". I think this is the convention used elsewhere in the OWL API and some of the OWL specs.

ansell commented 11 years ago

No, it hasn't made it into a release yet. Were you thinking of including it in both 3.4.6 and 4?

If you don't mind making the changes yourself you can cherry-pick this commit or I can make the necessary changes and open a pull request for it:

https://github.com/ansell/owlapi/commit/36c81c19f1197b9e5e5ebb1eb21bac37377b1103
matthewhorridge commented 11 years ago

Hi Peter,  I think we're going to have a 3.5 release that will introduce large bits of new functionality (without being backwards incompatible). It seems like this (and some other things) would be a good candidates to include. I'd like to include it. If you want to suggest any other namespaces that would be great too. We might also want to introduce a flag to indicate wether a namespace forms part of the namespaces used in the OWL spec (rdf: rdfs: owl: xsd:).

matthewhorridge commented 11 years ago

What do you prefer with regards to a cherry pick or pull request? I haven't followed the discussion above about the dependencies so I'm not sure what's best.

ansell commented 11 years ago

I opened a pull request for this (including removing the dependency on OpenRDF Sesame).

i included a new flag called "isBuiltIn" for linking to the native/built-in namespaces, in addition to the inUse flag that indicates whether the namespace should be considered obsolete.

There are some private helper boolean variables to make the namespace enum declarations easier to read.

Overall I am fairly sure that these changes are backwards compatible at the source level, and I don't think they have been reordered so they may even be backwards compatible at the binary level, although I am not an expert on the exact effects of adding new fields to enumerations.

matthewhorridge commented 11 years ago

The changes look good to me. Thanks a lot for this.

I just had a quick look at the OWL 2 spec.... if it's o.k. with you we'll change getBaseIRI to getPrefixIRI (see Table 2 in the spec).

ansell commented 11 years ago

Thats fine. I am also adding the namespace definitions from the RDFa Core Initial Context and will open another Pull Request for that and to change the getPrefixIRI

matthewhorridge commented 11 years ago

Great. I've merged it into Master and changed the method name to getPrefixIRI().

matthewhorridge commented 11 years ago

There's a load of other prefix names like foaf, dc, dcterms, geo etc. that we use on a project here. It would be useful to add these but I wonder where to stop. prefix.cc has a good list. Any suggestions welcomed.

ansell commented 11 years ago

The RDFa Core Initial Context has the top ten vocabularies from prefix.cc, along with other common names. It is the only authoritative short-list that I know of, as all of the prefixes there do not need to be defined to be used in RDFa, so they keep the list fairly short, comparatively.

matthewhorridge commented 11 years ago

o.k. sounds good to me. I'll wait for the pull request.

ignazio1977 commented 11 years ago

I'll try to keep up and add these to version 4 too :-)

ignazio1977 commented 11 years ago

This is in master and version 4, I think we can close the ticket