Skip to content

Releases: sweetrdf/rdfInterface

DatasetInterface::delete() filter relaxed

22 Nov 19:13
Compare
Choose a tag to compare

rdfInterface\DatasetInterface::delete($filter) now accepts null as a $filter. Also, null is now a default $filter parameter value.

2.0.0

13 Feb 11:53
Compare
Choose a tag to compare

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).

Dependencies fixes

21 Jul 08:29
Compare
Choose a tag to compare

Allow both psr/http-message ^1 and ^2

1.0.0

01 Nov 09:28
Compare
Choose a tag to compare

Backward-incompatible changes

  • All interfaces have been renamed so that their name ends with Interface to follow an interface naming convention which is predominant in modern PHP.
  • rdfInterface\DatasetInterface extends rdfInterface\QuadIteratorAggregateInterface (a strongly-typed IteratorAggregate with an optional filtering) instad of rdfInterface\QuadIteratorInterface (a strongly-typed Iterator) which laregely decouples implementation of the iterator from the dataset implementation.

New features

  • Allowing rdfInterface\Dataset::getOffset(0) and rdfInterface\Dataset::offsetExists(0) as a syntax for getting any quad out of a dataset and checking if a dataset is not empty.
    This allows the $dataset[0] ?? $defaultQuad syntax for safely getting a single quad out of a dataset.
  • rdfInterface\QuadIteratorAggregateInterface added.

1.0.0-RC1

01 Nov 07:24
Compare
Choose a tag to compare
SerializerInterface::serializeStream(): fix parameter type hint

Allow both resource and \Psr\Http\Message\StreamInterface for Serializer and Parser

25 May 16:49
Compare
Choose a tag to compare
0.11.0

Merge branch 'master' of github.com:zozlak/rdfInterface

Type hints fixes

26 May 17:47
Compare
Choose a tag to compare
0.10.1

Merge branch 'master' of github.com:zozlak/rdfInterface

TermIterator interface added

13 Apr 17:03
Compare
Choose a tag to compare

It's worth noting rdfInterface\DatasetListQuadParts methods now return rdfInterface\TermIterator.

Dataset interface changes

06 Apr 17:42
Compare
Choose a tag to compare
  • rdfInterface\Dataset::map(), rdfInterface\Dataset::reduce() and rdfInterface\Dataset::forEach() take optional QuadCompare | QuadIterator | callable $filter = null parameter. As exactly the same filter parameter is already a part of many other dataset method signature it shouldn't make dataset implementation harder and it allows user to prepare much simple callbacks when quads filtering is needed.
  • rdfInterface\DatasetCompare::every() signature is now the same as all other rdfInterface\DatasetCompare method signatures.
  • rdfInterface\DatasetMapReduce::map() returns an instance of rdfInterface\DatasetMapReduce now.
  • rdfInterface\DatasetListQuadParts interface added allowing simple ordered dataset traversal.

Reguire $filter in Dataset::copyExcept

24 Mar 06:38
Compare
Choose a tag to compare
0.8.1

EasyRdfReadme.md updated