Skip to content

Release 3.0.0

Compare
Choose a tag to compare
@gkellogg gkellogg released this 31 Dec 23:44
· 72 commits to develop since this release

Ruby RDF 3.0.0 release

I'm happy to announce release 3.0.0 of RDF.rb and related gems. Detailed information on changes are in the RDF.rb release nodes. Unlike the 2.0 release, 3.0 does not bring substantial new features, but deprecates problematic methods that were interfering with Ruby 2.0 keyword arguments. In particular, the #to_hash, and #to_ary methods are automatically invoked, in certain circumstances, to automatically turn objects implementing these methods into Hashes and Arrays respectively. The 3.0 release is needed for semantic versioning purposes as they technically cause an incompatibility with 2.x versions. Prior to this change, a call such as RDF::Query.new(pattern) could have implicitly turned the pattern into a hash, as pattern implemented #to_hash. By removing RDF::Statement#to_hash, this no longer happens. Note that RDF::Statement, and other classes, continue to implement #to_h (and #to_a) so that appropriate conversions can still be made, they just need to be explicit.

Other notable changes:

Support for Ruby 2.5

With the exception of the SPARQL gem, this release is fully compatible with Ruby 2.5. The SPARQL gem has issues related to a reported bug.

Greater support for encoded vocabularies.

RDF::Vocabulary.from_graph now retains Blank-node values, rather than dropping them. The RDF::Vocabulary::Writer, which is used to generate Ruby-described vocabularies, such as those maintained in the rdf-vocab gem, are able to encode OWL and SKOS vocabularies that often make use of such blank nodes.

For example, from the DOAP vocabulary serialization:

property :module,
  comment: [%(Jméno modulu v CVS, BitKeeper nebo Arch úložišti.).freeze, %(Modul-Name eines Subversion, CVS, BitKeeper oder Arch Repositorys.).freeze, %(Module name of a Subversion, CVS, BitKeeper or Arch repository.).freeze, %(Nom du module d'un dépôt Subversion, CVS, BitKeeper ou Arch.).freeze, %(Nombre del módulo de un repositorio Subversion, CVS, BitKeeper o Arch.).freeze, %(Nome do módulo de um repositório Subversion, CVS, BitKeeper ou Arch.).freeze],
  domain: term(
      unionOf: list("doap:CVSRepository".freeze, "doap:ArchRepository".freeze, "doap:BKRepository".freeze),
      type: "owl:Class".freeze
    ),
  isDefinedBy: "doap:".freeze,
  label: ["Modul".freeze, "modul".freeze, "module".freeze, "module".freeze, "módulo".freeze, "módulo".freeze],
  type: "rdf:Property".freeze

This derives from the original Turtle encoding:

doap:module a rdf:Property;
  rdfs:comment "Module name of a Subversion, CVS, BitKeeper or Arch repository."@en;
  rdfs:label "module"@en;
  rdfs:domain [a owl:Class owl:unionOf (doap:Csvrepository doap:ArchRepository doap:BKRepository)];
  rdfs:isDefinedBy doap: .

Vocabulary term accessors use native RDF Values

Vocabulary term method accessors are implicitly turned into RDF Values, including RDF::Vocabulary::Term instances when accessed through their getters, using #attribute_value, or #properties.

For example, RDF::Vocab::DOAP.module.isDefinedBy now returns an array of values, which can be dereferenced, in this case: [#<RDF::Vocabulary::Term:0x3ff1ab8c97cc ID:http://usefulinc.com/ns/doap#>].

This allows such vocabularies to be navigated using Ruby method accessors.

More direct vocabulary term accessors

To make this more useful, a greater set of vocabulary term accessors are defined:

  • allValuesFrom - owl:allValuesFrom
  • altLabel - skos:altLabel
  • broader - skos:broader
  • cardinality - owl:cardinality
  • comment - rdfs:comment
  • definition - skos:definition
  • domain - rdfs:domain
  • domainIncludes - schema:domainIncludes
  • editorialNote - skos:editorialNote
  • equivalentClass - owl:equivalentClass
  • equivalentProperty - owl:equivalentProperty
  • exactMatch - skos:exactMatch
  • hasTopConcept - skos:hasTopConcept
  • intersectionOf - owl:intersectionOf
  • inverseOf- owl:inverseOf
  • isDefinedBy - rdfs:isDefinedBy
  • label - rdfs:label
  • maxCardinality - owl:maxCardinality
  • member - skos:member
  • minCardinality - owl:minCardinality
  • narrower - skos:narrower
  • notation - skos:notation
  • note - skos:note
  • onProperty - owl:onProperty
  • prefLabel - skos:prefLabel
  • range - rdfs:range
  • rangeIncludes - schema:rangeIncludes
  • related - skos:related
  • someValuesFrom - owl:someValuesFrom
  • subClassOf - rdfs:subClassOf
  • subPropertyOf - rdfs:subPropertyOf
  • type - rdf:type
  • unionOf - owl:unionOf

Note that the rdf-reasoner gem does not yet reason over these terms.

RDF::Format.each takes filter parameters

Most of the filter parameters used by RDF::Format.for can now be used by RDF::Format.each, which will return all formats satisfying the criteria. This is useful, for example, in rack-linkeddata to try multiple serializations associated with the HTTP Accept header.

SPARQL 3.0 gem

  • Make sure BIND variables are not used in BGP. (Issue 29)
  • Account for GroupGraphPatternSub having multiple queries (0, 1, or 2), rather than just 0 or 1. This can happen with a property path after a query. (Issue 29)

SPARQL-Client 3.0 gem

  • Allow VALUES to be specified using Query#values. (Issue 37)

Other gems

Not all related gems have been updated to 3.0, this will happen over time as new releases are warranted. All dependencies have been updated to allow the use of RDF.rb 3.0 in such cases.