Skip to content

2.0.0

Compare
Choose a tag to compare
@zozlak zozlak released this 13 Feb 11:53
· 2 commits to master since this release

Backward-incompatible changes

  • rdfInterface\DatasetCompareInterface, rdfInterface\DatasetMapReduceInterface and rdfInterface\DatasetQuadPartsInterface merged into rdfInterface\DatasetInterface.
  • rdfInterface\DatasetInterface
    • copyExcept($filter) does not accept null as the $filter. If you want to copy all quads, use the copy() method.
    • delete($filter) does not accept null as the $filter. If you want an empty dataset, just create a new one.
    • offsetExists($offset), offsetGet($offset), offsetSet($offset, $value) and offsetUnset($offset) method now must throw a newly introduced rdfInterface\MultipleQuadsMatchedException if the offset matches multiple quads.

New features

  • rdfInterface\DatasetNodeInterface interface added for a node-oriented RDF graph operations.
    It extends the rdfInterface\DatasetInterface, just methods are (generally) applied only to quads with a subject matching a given rdfInterface\TermInterface term.
  • rdfInterface\TermIteratorInterface extended
    • contains(rdfInterface\TermCompareInterface $term): bool method added allowing to perform in_array-like check.
    • getValues(): array<string> method added.
    • intersect($terms): rdfInterface\TermIteratorInterface method added.
    • skip($terms): rdfInterface\TermIteratorInterface method added.
  • rdfInterface\DatasetNode
    • Static method factory() added as a replacement for the rdfInterface\DatasetNode::__construct(). This follows the convention not to enforce constructor signatures.
    • Getter shorthands added (a reference implementation is provided by the rdfHelpers\DatasetGettersTrait class of the sweetrdf/rdf-helpers package):
      • getSubject(), getPredicate(), getObject(), getGraph() returning an rdfInterface\TermInterface | null
      • getSubjectValue(), getPredicateValue(), getObjectValue(), getGraphValue() returning mixed | null
  • rdfInterface\QuadNoSubjectInterface added for convenient adding quads to the rdfInterface\DatasetNode.
  • rdfInterface\DataFactory
    • quadNoSubject($predicate, $object, $graph): rdfInterface\QuadNoSubjectInterface method added.
  • rdfInterface\MultipleQuadsMatchedException exception added to make it possible to easily distinguish between standard PHP array access errors (the \UnexpectedValueException when an offset does not exist) and rdfInterface-specific "multiple quads matched" error.
  • rdfInterface\QuadInterface::getValue() must throw the \BadMethodCall exception.

Relaxed definitions

  • rdfInterface\BlankNodeInterface, rdfInterface\NamedNodeInterface, rdfInterface\LiteralInterface and rdfInterface\QuadInterface constructor definition dropped. These constructors are anyway not meant to be called directly as terms should be instantiated trough the rdfInterface\DataFactoryInterface class so it makes no sense to enforce their signatures.
  • rdfInterface\DatasetNode:
    • __construct() method dropped. This follows the convention not to enforce constructor signatures. A static factory() method signature is defined instead.
    • add() accepts QuadInterface|\Traversable<rdfInterface\QuadInterface>|array<rdfInterface\QuadInterface> (instead of rdfInterface\QuadInterface|rdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface).
    • forEach($filter) accepts null as a $filter.
  • rdfInterface\SerializerInterface
    • serialize() and serializeStream() accept \Traversable<QuadInterface>|array<QuadInterface> (instead of rdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface).

Minor changes

  • rdfInterface\TermInterface now extends rdfInterface\TermCompareInterface instead of defining equals() and __toString() methods explicitly.
  • rdfInterface\TermCompareInterface, rdfInterface\QuadCompareInterface and rdfInterface\DatasetInterface extend Stringable instead of declaring __toString() explicitly.
  • rdfInterface\QuadCompareInterface methods: getSubject(), getPredicate(), getObject() and getGraph() return type is rdfInterface\TermCompareInterface | null (instead of rdfInterface\TermInterface | rdfInterface\TermCompareInterface | null).