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

Include vocab terms defined with a uri that differs from the namespace uri (without trailing '/' or '#') #315

Closed
cdchapman opened this issue Aug 16, 2016 · 4 comments

Comments

@cdchapman
Copy link

cdchapman commented Aug 16, 2016

There are a few vocabs (e.g. http://purl.org/vocommons/voaf, https://www.w3.org/ns/adms) that define an ontology at a URI slightly different than the namespace URI (i.e. without the trailing / or #). It would be useful to include some of the extra terms that describe the ontology, and right now these statements are not being included in the generated vocabularies.

The extra terms for these vocabularies are being filtered out here, but I think I would need to dig in a little more into the current implementation to know how best to accommodate these vocabularies. Any thoughts?

@no-reply
Copy link
Member

+1. Think about adding an option to include a list of other IRIs (base IRIs?) to pass over when filtering.

@gkellogg
Copy link
Member

My thought here is that we add an #ontology method, with an #iri property that allows us to add any owl:Ontology type to be serialized similar to other terms. In the case that the ontology is the same as the namespace IRI, it would be serialized both as an empty germ and using #ontology, otherwise we loose backwards compatibility.

For example:

module RDF
  # @!parse
  #   # Vocabulary for <http://purl.org/vocommons/voaf#>
  #   class  < RDF::Vocabulary
  #   end
  class  < RDF::Vocabulary("http://purl.org/vocommons/voaf#")

    # Class definitions
    term :DatasetOccurrences,
      comment: %(Class used to store the number of occurences of a vocabulary in a particular dataset).freeze,
      label: "Dataset occurrences".freeze,
      :"rdfs:isDefinedBy" => %(http://purl.org/vocommons/voaf).freeze,
      type: "owl:Class".freeze,
      :"vs:term_status" => %(testing).freeze

    ...

    ontology iri: "http://purl.org/vocommons/voaf",
      :"cc:license" => %(http://creativecommons.org/licenses/by/3.0/).freeze,
      :"dc:contributor" => [%(http://data.semanticweb.org/person/lise-rozat).freeze, %(http://data.semanticweb.org/person/pierre-yves-vandenbussche).freeze],
      :"dc:creator" => %(http://data.semanticweb.org/person/bernard-vatant).freeze,
      :"dc:description" => %(A vocabulary to describe linked data vocabularies and their relations.).freeze,
      :"dc:issued" => %(2011-03-11).freeze,
      :"dc:modified" => %(2013-05-24).freeze,
      :"dc:publisher" => %(http://dbpedia.org/resource/Open_Knowledge_Foundation).freeze,
      :"dc:title" => %(Vocabulary of a Friend).freeze,
      :"http://purl.org/vocab/frbr/core#realization" => [%(http://purl.org/vocommons/voaf/v1.0).freeze, %(http://purl.org/vocommons/voaf/v1.1).freeze, %(http://purl.org/vocommons/voaf/v2.0).freeze, %(http://purl.org/vocommons/voaf/v2.1).freeze, %(http://purl.org/vocommons/voaf/v2.2).freeze, %(http://purl.org/vocommons/voaf/v2.3).freeze],
      :"http://purl.org/vocab/vann/preferredNamespacePrefix" => %(voaf).freeze,
      :"http://purl.org/vocab/vann/preferredNamespaceUri" => %(http://purl.org/vocommons/voaf#).freeze,
      :"http://purl.org/vocommons/voaf#exampleDataset" => %(http://lov.okfn.org/dataset/lov/lov.rdf).freeze,
      label: "".freeze,
      type: ["http://purl.org/vocommons/voaf#Vocabulary".freeze, "owl:Ontology".freeze]

This does leave out other things defined in the ontology (e.g., http://purl.org/vocommons/voaf/v1.0), but is certainly a step in the right direction.

I'm certainly open to other proposals on how this might be described.

@gkellogg
Copy link
Member

While we're at it, we may remove the explicit .freeze on strings, as we use the frozen_string_literal pragma, and that will simplify and shorten the serialization.

@no-reply
Copy link
Member

Let's keep the .freeze until we drop support for Ruby 2.2. frozen_string_literal was introduced in 2.3.

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

3 participants