Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rdf Interface Laravel Package

sweetrdf/rdf-interface

Common RDF interfaces for PHP (PSR-7-like): define shared contracts for terms, datasets, parsers/serializers, SPARQL clients, etc., enabling mix-and-match components across libraries. Includes compliance tests and helpers; influenced by RDF/JS.

View on GitHub
Deep Wiki
Context7
3.2.0

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

3.1.0

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 https://github.com/sweetrdf/quickRdfIo/issues/11

3.0.0

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.

2.1.0

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

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 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
0.11.0
0.10.1
0.10.0

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

0.9.0
  • 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.
0.8.1
0.8.0
  • QuadIterator::current() and Dataset::current() allowed to return null making it possible to use constructs like $dataset->copy(filterMatchingUnknownNumberOfQuads)->current() ?? $defaultValue to get any quad in the dataset (coupled with the ?? for handling an empty dataset scenario when needed). Specification now explicitely requires Dataset::current() to return null for empty dataset and a quad on non-empty dataset which hasn't been traversed with the \Iterable interface yet.
  • TermCompare and QuadCompare extends TermCompare interfaces replaced the QuadTemplate interface. This allows flexible implementation of "term template" (especially "quad template") classes as the only thing the rdfInterface enforces on them is to implement equals() and __toString() for term template classes and subject/predicate/object/graph getters for quad template classes. Constructor is no longer enforced (as it was with the QuadTemplate). As a consequence of this change:
    • DataFactory::quadTemplate() method has been dropped.
    • All Dataset methods used to accept QuadTemplate now accept QuadCompare.
    • NamedNode, BlankNode and DefaultGraph interfaces extend TermCompare now.
    • Quad interface extends QuadCompare now.
  • In-code documentation describing expected implementations behavior greatly extended for Literal and Dataset.
    • The Literal constructor is now required to automatically assign a datatype if a value is bool/int/float and the datatype hasn't been specified. This allows to keep the original PHP type of the value by Literal::getValue() (if an implementation supports such a behavior) while avoiding the problem of having many instances of literals which are equal to each other according to the RDF specification.
  • Compliance tests extracted to a separate repository (and composer package).
0.7.1
0.7.0
0.6.0

Yet another approach to the \rdfInterface\Literal. Still shouldn't be considered stable.

0.5.1
0.5.0

This affects rdfInterface\DefaultGraph, rdfInterface\Quad, rdfInterface\QuadInterface and rdfInterface\DataFactory APIs.

0.4.5
0.4.4
  • Tests for terms added.
  • rdfInterface\RdfNamespace documentation provided.
  • Default values of rdfInterface\DataFactory::literal and rdfInterface\Literal constructor made in line.
  • Comments on rdfInterface\Literal::getDatatype() and rdfInterface\Literal::getLang() return type design decisions added.
  • DataFactory tests split into separate methods to allow easier overriding (e.g. if a given library doesn't implement a given kind of term).
  • README updated with an example of test class reuse.
0.4.3
0.4.2

A set of test classes to be used by implementations added.

0.3.1

Set default value of the $iri parameter of rdfInterface::DataFactory::defaultGraph($iri) to null.

0.3.0

The rdfInterface\Parser class constructor takes the rdfInterface\DataFactory instance now allowing a parser to work with any rdfInterface\DataFactory implementation.

0.2.0

Previously there was a Serializer class with serialise() and serialiseStream() methods. Method names are serialize() and serializeStream() now.

0.1.0
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky