Skip to content

Release 2.1.1

Compare
Choose a tag to compare
@gkellogg gkellogg released this 11 Dec 18:12
· 586 commits to develop since this release

Repository/Dataset improvements

  • Implement Transaction#mutated?
    • #mutated? must return true when the transaction would change the repository if executed against it's state at transaction start time. We allow implementations to return true in other cases, as well; there is no guarantee that a false result will be returned in any specific circumstances (or ever).
    • For the base transaction, we simply check whether @changes is empty. This can give false positives, but avoids a worst-case linear check.
    • For subclasses with no custom implementation, we raise a NotImplementedError.
    • For the SerializableTransaction included in the default RepositoryImplementation, we use #equal? on the Hamster::Hash instances. This will always give a correct response for the actual implementation, moreover, it is guaranteed not to give false negatives even if a user messes with the snapshot using #send.
  • Make Dataset concrete
    • RDF::Dataset previously served as little more than an abstract class. Instantiating one was possible, but didn't provide any useful functionality. This implements a basic RDF::Dataset as an Enumerable/Queryable over a static dataset specified at initialization.
    • Clarifies handling of the default graph, adopting the ususal definition of an RDF/SPARQL dataset for RDF::Dataset and its subclasses (e.g. RDF::Repository). Normal Enumerable/Queryable objects continue to not behave like RDF datasets. The accompanying changes to rdf-spec reflect this while running the shared examples over such a generic Queryable.
  • Avoid expensive hash comparison on Hamster::Hash
    • In practice, these objects are either #equal? or won't be #==. This avoids potentially expensive #to_hash calls and comparisons.
  • Inherit the correct isolation level with #snapshot. Fix a typo in RDF::Repository#isolation_level to inherit the correct level when snapshot is implemented. This affects Repositories implementing snapshots, but not overriding the default #isolation_level.
  • Fix RDF::Repository::Implementation#supports?(:literal_equality).
    • Adds :literal_equality flag to the default repository implementation.

Vocabulary related changes

  • Implement RDF.enum_for and RDF.to_enum. Fixes #314.
  • Add .ontology to vocabulary, and use for defining ontologies. This allows ontology statements that are not the same as the namespace (e.g., missing trailing '/' or '#'). Fixes #315.
  • When parsing "extra" arguments for vocabulary writer, make sure all keys are symbolized.
  • Allow Vocabulary#from_graph to take an existing vocabulary for class_name to re-define it.

Other improvements

  • Define RDF::Statement#hash to support comparison operations in e.g. Array#-
  • Dispatch Enumerator#to_ary with alias There's no need to use #method_missing to dispatch this. Preferring alias_method over alias, contrary to Ruby Style Guide. We want dynamic dispatch of the aliased method.
  • Added Literal#squish and #squish! to remove leading/trailing whitespace and multiple internal whitespace characters from the value of a literal.
  • Support :inferred option to Statement#initialize and use when responding to #inferred?. This allows a reasoner to mark inferred/entailed statements.
  • Add Format.accept_types and Format.accept_type. This allows Format.content_type to be provided with priority parameters for the type, and aliases. These are stripped out to allow Format.reader_types and so-forth, to continue to return values without parameters. Fixes #327.
  • Require rest-client ~> 2.0. Update redirection logic based on changed interface in rest-client 2.0.0. Fixes #331.
  • Move #start_with from URI to Value and add specs.

Misclaneous bug fixes

  • Fix typo in IRI grammar
    • Typo A-z allows matches for a wide range of invalid schemes, including common blank node id formats like "_:123".
  • CLI does not set @readers when evaluating from the command line, causing exception.
  • Reset memoized hash values when canonicalizing RDF::URI and RDF::Statement.
  • Add more hacks to set quality level in Accept content header. This is related to structured-data/linter#38 and #327.
  • Do not consider case when validating double values.
  • Remove code climate, as it's changed it's requirements and isn't particularly useful anyway.
  • Fix a bug where RDF::Literal::Integer.new("0123") was interpreted as an Octal value.