Releases: sweetrdf/rdfInterface
Release list
ParserInterface: add the BLANK_NODES_PRESERVE constant
There are some corner cases (e.g. parsing reference test outputs for the RDF-XML parser) where it is required to preserve blank node identifiers from the input data source. In such a case the rdfInterface\ParserInterface::BLANK_NODES_PRESERVE should be passed as the $baseUri parameter to the rdfInterface\ParserInterface::parse()/rdfInterface\ParserInterface::parseStream().
ParserInterface: allow to specify document base URI
To properly parse blank nodes the parser has to be aware of the URI of the document being parsed.
So far there was no way to provide this information.
Not the rdfInterface\ParserInterface::parse() and rdfInterface\ParserInterface::parseStream() take optional second parameter string $baseUri allowing to specify the document URI.
See also sweetrdf/quickRdfIo#11
Narrow down getPredicate() return type
rdfInterface\DatesetInterface::getPredicate() and rdfInterface\DatesetNodeInterface::getPredicate() return type narrowed down to rdfInterface\NamedNodeInterface|null.
While technically this is a backward-incompatible change and thus marks major version bump, there is no known RDF extension nor implementation which would depend on the getPredicate() method returning anything else than NamedNodeIterface|null.
DatasetInterface::delete() filter relaxed
rdfInterface\DatasetInterface::delete($filter) now accepts null as a $filter. Also, null is now a default $filter parameter value.
2.0.0
Backward-incompatible changes
rdfInterface\DatasetCompareInterface,rdfInterface\DatasetMapReduceInterfaceandrdfInterface\DatasetQuadPartsInterfacemerged intordfInterface\DatasetInterface.rdfInterface\DatasetInterfacecopyExcept($filter)does not acceptnullas the$filter. If you want to copy all quads, use thecopy()method.delete($filter)does not acceptnullas the$filter. If you want an empty dataset, just create a new one.offsetExists($offset),offsetGet($offset),offsetSet($offset, $value)andoffsetUnset($offset)method now must throw a newly introducedrdfInterface\MultipleQuadsMatchedExceptionif the offset matches multiple quads.
New features
rdfInterface\DatasetNodeInterfaceinterface added for a node-oriented RDF graph operations.
It extends therdfInterface\DatasetInterface, just methods are (generally) applied only to quads with a subject matching a givenrdfInterface\TermInterfaceterm.rdfInterface\TermIteratorInterfaceextendedcontains(rdfInterface\TermCompareInterface $term): boolmethod added allowing to performin_array-like check.getValues(): array<string>method added.intersect($terms): rdfInterface\TermIteratorInterfacemethod added.skip($terms): rdfInterface\TermIteratorInterfacemethod added.
rdfInterface\DatasetNode- Static method
factory()added as a replacement for therdfInterface\DatasetNode::__construct(). This follows the convention not to enforce constructor signatures. - Getter shorthands added (a reference implementation is provided by the
rdfHelpers\DatasetGettersTraitclass of the sweetrdf/rdf-helpers package):getSubject(),getPredicate(),getObject(),getGraph()returning anrdfInterface\TermInterface | nullgetSubjectValue(),getPredicateValue(),getObjectValue(),getGraphValue()returningmixed | null
- Static method
rdfInterface\QuadNoSubjectInterfaceadded for convenient adding quads to therdfInterface\DatasetNode.rdfInterface\DataFactoryquadNoSubject($predicate, $object, $graph): rdfInterface\QuadNoSubjectInterfacemethod added.
rdfInterface\MultipleQuadsMatchedExceptionexception added to make it possible to easily distinguish between standard PHP array access errors (the\UnexpectedValueExceptionwhen an offset does not exist) and rdfInterface-specific "multiple quads matched" error.rdfInterface\QuadInterface::getValue()must throw the\BadMethodCallexception.
Relaxed definitions
rdfInterface\BlankNodeInterface,rdfInterface\NamedNodeInterface,rdfInterface\LiteralInterfaceandrdfInterface\QuadInterfaceconstructor definition dropped. These constructors are anyway not meant to be called directly as terms should be instantiated trough therdfInterface\DataFactoryInterfaceclass so it makes no sense to enforce their signatures.rdfInterface\DatasetNode:__construct()method dropped. This follows the convention not to enforce constructor signatures. A staticfactory()method signature is defined instead.add()acceptsQuadInterface|\Traversable<rdfInterface\QuadInterface>|array<rdfInterface\QuadInterface>(instead ofrdfInterface\QuadInterface|rdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface).forEach($filter)acceptsnullas a$filter.
rdfInterface\SerializerInterfaceserialize()andserializeStream()accept\Traversable<QuadInterface>|array<QuadInterface>(instead ofrdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface).
Minor changes
rdfInterface\TermInterfacenow extendsrdfInterface\TermCompareInterfaceinstead of definingequals()and__toString()methods explicitly.rdfInterface\TermCompareInterface,rdfInterface\QuadCompareInterfaceandrdfInterface\DatasetInterfaceextendStringableinstead of declaring__toString()explicitly.rdfInterface\QuadCompareInterfacemethods:getSubject(),getPredicate(),getObject()andgetGraph()return type isrdfInterface\TermCompareInterface | null(instead ofrdfInterface\TermInterface | rdfInterface\TermCompareInterface | null).
Dependencies fixes
Allow both psr/http-message ^1 and ^2
1.0.0
Backward-incompatible changes
- All interfaces have been renamed so that their name ends with
Interfaceto follow an interface naming convention which is predominant in modern PHP. rdfInterface\DatasetInterfaceextendsrdfInterface\QuadIteratorAggregateInterface(a strongly-typedIteratorAggregatewith an optional filtering) instad ofrdfInterface\QuadIteratorInterface(a strongly-typedIterator) which laregely decouples implementation of the iterator from the dataset implementation.
New features
- Allowing
rdfInterface\Dataset::getOffset(0)andrdfInterface\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] ?? $defaultQuadsyntax for safely getting a single quad out of a dataset. rdfInterface\QuadIteratorAggregateInterfaceadded.
1.0.0-RC1
Allow both resource and \Psr\Http\Message\StreamInterface for Serializer and Parser
0.11.0 Merge branch 'master' of github.com:zozlak/rdfInterface
Type hints fixes
0.10.1 Merge branch 'master' of github.com:zozlak/rdfInterface