Releases: sweetrdf/rdfInterface
Releases · sweetrdf/rdfInterface
DatasetInterface::delete() filter relaxed
2.0.0
Backward-incompatible changes
rdfInterface\DatasetCompareInterface
,rdfInterface\DatasetMapReduceInterface
andrdfInterface\DatasetQuadPartsInterface
merged intordfInterface\DatasetInterface
.rdfInterface\DatasetInterface
copyExcept($filter)
does not acceptnull
as the$filter
. If you want to copy all quads, use thecopy()
method.delete($filter)
does not acceptnull
as 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\MultipleQuadsMatchedException
if the offset matches multiple quads.
New features
rdfInterface\DatasetNodeInterface
interface 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\TermInterface
term.rdfInterface\TermIteratorInterface
extendedcontains(rdfInterface\TermCompareInterface $term): bool
method added allowing to performin_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 therdfInterface\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 anrdfInterface\TermInterface | null
getSubjectValue()
,getPredicateValue()
,getObjectValue()
,getGraphValue()
returningmixed | null
- Static method
rdfInterface\QuadNoSubjectInterface
added for convenient adding quads to therdfInterface\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
andrdfInterface\QuadInterface
constructor definition dropped. These constructors are anyway not meant to be called directly as terms should be instantiated trough therdfInterface\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 staticfactory()
method signature is defined instead.add()
acceptsQuadInterface|\Traversable<rdfInterface\QuadInterface>|array<rdfInterface\QuadInterface>
(instead ofrdfInterface\QuadInterface|rdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface
).forEach($filter)
acceptsnull
as a$filter
.
rdfInterface\SerializerInterface
serialize()
andserializeStream()
accept\Traversable<QuadInterface>|array<QuadInterface>
(instead ofrdfInterface\QuadIteratorInterface|rdfInterface\QuadIteratorAggregateInterface
).
Minor changes
rdfInterface\TermInterface
now extendsrdfInterface\TermCompareInterface
instead of definingequals()
and__toString()
methods explicitly.rdfInterface\TermCompareInterface
,rdfInterface\QuadCompareInterface
andrdfInterface\DatasetInterface
extendStringable
instead of declaring__toString()
explicitly.rdfInterface\QuadCompareInterface
methods: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
Interface
to follow an interface naming convention which is predominant in modern PHP. rdfInterface\DatasetInterface
extendsrdfInterface\QuadIteratorAggregateInterface
(a strongly-typedIteratorAggregate
with 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] ?? $defaultQuad
syntax for safely getting a single quad out of a dataset. rdfInterface\QuadIteratorAggregateInterface
added.
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
TermIterator interface added
It's worth noting rdfInterface\DatasetListQuadParts
methods now return rdfInterface\TermIterator
.
Dataset interface changes
rdfInterface\Dataset::map()
,rdfInterface\Dataset::reduce()
andrdfInterface\Dataset::forEach()
take optionalQuadCompare | 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 otherrdfInterface\DatasetCompare
method signatures.rdfInterface\DatasetMapReduce::map()
returns an instance ofrdfInterface\DatasetMapReduce
now.rdfInterface\DatasetListQuadParts
interface added allowing simple ordered dataset traversal.
Reguire $filter in Dataset::copyExcept
0.8.1 EasyRdfReadme.md updated