Dataset
in package
implements
DatasetInterface
uses
DatasetGettersTrait
Description of Graph
Tags
Table of Contents
Interfaces
- DatasetInterface
- Main, edge(quad) and Dataset-oriented Dataset API
Properties
- $graphIdx : SplObjectStorage<TermInterface, mixed>
- $indexed : bool
- $objectIdx : SplObjectStorage<TermInterface, mixed>
- $predicateIdx : SplObjectStorage<TermInterface, mixed>
- $quads : SplObjectStorage<QuadInterface, mixed>
- $subjectIdx : SplObjectStorage<TermInterface, mixed>
Methods
- __construct() : mixed
- __toString() : string
- add() : void
- Adds quad(s) to the dataset.
- any() : bool
- Checks if any quad in the dataset matches a given filter.
- copy() : DatasetInterface
- Creates a copy of the dataset.
- copyExcept() : DatasetInterface
- Creates a copy of the dataset.
- count() : int
- delete() : DatasetInterface
- In-place removes quads from the dataset.
- deleteExcept() : DatasetInterface
- In-place removes quads from the dataset.
- equals() : bool
- every() : bool
- Checks if all quads in the dataset match a given filter.
- factory() : Dataset
- forEach() : void
- In-place modifies all dataset quads using a given callback.
- getGraph() : TermInterface|null
- Fetches graph of a first quad matching a given filter or null if no quad matches the filter.
- getGraphValue() : mixed
- Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
- getIterator() : QuadIteratorInterface
- Returns QuadIteratorInterface iterating over dataset's quads.
- getObject() : TermInterface|null
- Fetches object of a first quad matching a given filter or null if no quad matches the filter.
- getObjectValue() : mixed
- Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
- getPredicate() : TermInterface|null
- Fetches subject of a first quad matching a given filter or null if no quad matches the filter.
- getPredicateValue() : mixed
- Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
- getSubject() : TermInterface|null
- Fetches subject of a first quad matching a given filter or null if no quad matches the filter.
- getSubjectValue() : mixed
- Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
- listGraphs() : TermIteratorInterface
- Fetches an iterator over unique set of dataset quad graphs optionally matching a given filter.
- listObjects() : TermIteratorInterface
- Fetches an iterator over unique set of dataset quad objects optionally matching a given filter.
- listPredicates() : TermIteratorInterface
- Fetches an iterator over unique set of dataset quad predicates optionally matching a given filter.
- listSubjects() : TermIteratorInterface
- Fetches an iterator over unique set of dataset quad subjects optionally matching a given filter.
- map() : DatasetInterface
- Returns a new dataset from quads processed with a given callback function.
- none() : bool
- Checks if no quad in the dataset matches a given filter.
- offsetExists() : bool
- Checks if a given offset exists.
- offsetGet() : QuadInterface
- Returns a quad matching the $offset.
- offsetSet() : void
- Assigns a new value to the quad matching the $offset.
- offsetUnset() : void
- Removes a quad matching the $offset.
- reduce() : mixed
- Performs a reduce operation on the dataset quads.
- union() : DatasetInterface
- Returns a new dataset being a union of the current one and the $other one.
- xor() : DatasetInterface
- Returns a new dataset being a symmetric difference of the current dataset and the $other one.
- checkIterator() : QuadInterface|null
- exists() : bool
- findByIndices() : Generator<string|int, QuadInterface>
- findMatchingQuads() : Generator<string|int, QuadInterface>
- findNotMatchingQuads() : Generator<string|int, QuadInterface>
- get() : QuadInterface
- index() : void
- listQuadElement() : TermIteratorInterface
- set() : void
- unindex() : void
- unset() : void
Properties
$graphIdx
private
SplObjectStorage<TermInterface, mixed>
$graphIdx
$indexed
private
bool
$indexed
$objectIdx
private
SplObjectStorage<TermInterface, mixed>
$objectIdx
$predicateIdx
private
SplObjectStorage<TermInterface, mixed>
$predicateIdx
$quads
private
SplObjectStorage<QuadInterface, mixed>
$quads
$subjectIdx
private
SplObjectStorage<TermInterface, mixed>
$subjectIdx
Methods
__construct()
public
__construct([bool $indexed = true ]) : mixed
Parameters
- $indexed : bool = true
__toString()
public
__toString() : string
Return values
stringadd()
Adds quad(s) to the dataset.
public
add(QuadInterface|Traversable<string|int, QuadInterface>|array<string|int, QuadInterface> $quads) : void
Parameters
- $quads : QuadInterface|Traversable<string|int, QuadInterface>|array<string|int, QuadInterface>
any()
Checks if any quad in the dataset matches a given filter.
public
any(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter) : bool
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable
Return values
boolcopy()
Creates a copy of the dataset.
public
copy([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $indexed = false ]) : DatasetInterface
If $filter is provided, the copy contains only quads matching the $filter.
The $filter can be specified as:
- An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single Quad)
- An object implementing the \rdfInterface\QuadIteratorInterface or the \rdfInterface\QuadIteratorAggregateInterface (e.g. another Dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
An in-place equivalent of a call using the $filter is the deleteExcept() method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
- $indexed : bool = false
Return values
DatasetInterfacecopyExcept()
Creates a copy of the dataset.
public
copyExcept(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter[, bool $indexed = false ]) : DatasetInterface
If $filter is provided, the copy contains only quads not matching the The $filter.
The $filter can be specified as:
- An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single quad)
- An object implementing the \rdfInterface\QuadIteratorInterface or the \rdfInterface\QuadIteratorAggregateInterface (e.g. another dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
An in-place equivalent of a call using the $filter is the delete() method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null
- $indexed : bool = false
Return values
DatasetInterfacecount()
public
count() : int
Return values
intdelete()
In-place removes quads from the dataset.
public
delete([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $indexed = false ]) : DatasetInterface
All quads matching the $filter parameter are removed.
The $filter can be specified as:
- An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single quad)
- An object implementing the \rdfInterface\QuadIteratorInterface or the \rdfInterface\QuadIteratorAggregateInterface (e.g. another dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
An immputable equivalent is the copyExcept($filter) method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
- $indexed : bool = false
Return values
DatasetInterface —a dataset containing removed quads.
deleteExcept()
In-place removes quads from the dataset.
public
deleteExcept(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter[, bool $indexed = false ]) : DatasetInterface
All quads but ones matching the $filter parameter are removed.
The $filter can be specified as:
- An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single quad)
- An object implementing the \rdfInterface\QuadIteratorInterface or the \rdfInterface\QuadIteratorAggregateInterface (e.g. another dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
An immputable equivalent is the copy($filter) method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable
- $indexed : bool = false
Return values
DatasetInterface —a dataset containing removed quads.
equals()
public
equals(DatasetInterface $other) : bool
Parameters
- $other : DatasetInterface
Return values
boolevery()
Checks if all quads in the dataset match a given filter.
public
every(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter) : bool
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable
Return values
boolfactory()
public
static factory([bool $indexed = true ]) : Dataset
Parameters
- $indexed : bool = true
Return values
DatasetforEach()
In-place modifies all dataset quads using a given callback.
public
forEach(callable $fn[, QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : void
All quads matching the $filter parameter are modified.
The $filter can be specified as:
-
null
which matches all quads. - An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single quad)
- An object implementing the \rdfInterface\QuadIteratorInterface or the \rdfInterface\QuadIteratorAggregateInterface (e.g. another dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
If the callback returns null, the quad should be removed from the dataset.
Parameters
- $fn : callable
-
a callback with signature
fn(\rdfInterface\Quad, \rdfInterface\Dataset): \rdfInterface\Quad|null
modyfying a single quad - $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
getGraph()
Fetches graph of a first quad matching a given filter or null if no quad matches the filter.
public
getGraph([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermInterface|null
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermInterface|nullgetGraphValue()
Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
public
getGraphValue([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : mixed
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
getIterator()
Returns QuadIteratorInterface iterating over dataset's quads.
public
getIterator([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : QuadIteratorInterface
If $filter is provided, the iterator includes only quads matching the filter.
$filter can be specified as:
- An object implementing the \rdfInterface\QuadCompareInterface (e.g. a single Quad)
- An object implementing the \rdfInterface\QuadIteratorInterface (e.g. another Dataset)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
QuadIteratorInterfacegetObject()
Fetches object of a first quad matching a given filter or null if no quad matches the filter.
public
getObject([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermInterface|null
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermInterface|nullgetObjectValue()
Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
public
getObjectValue([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : mixed
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
getPredicate()
Fetches subject of a first quad matching a given filter or null if no quad matches the filter.
public
getPredicate([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermInterface|null
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermInterface|nullgetPredicateValue()
Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
public
getPredicateValue([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : mixed
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
getSubject()
Fetches subject of a first quad matching a given filter or null if no quad matches the filter.
public
getSubject([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermInterface|null
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermInterface|nullgetSubjectValue()
Returns result of calling the getValue() method on a subject of a first quad matching a given filter or null if no quad matches the filter.
public
getSubjectValue([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : mixed
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
listGraphs()
Fetches an iterator over unique set of dataset quad graphs optionally matching a given filter.
public
listGraphs([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermIteratorInterface
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermIteratorInterfacelistObjects()
Fetches an iterator over unique set of dataset quad objects optionally matching a given filter.
public
listObjects([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermIteratorInterface
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermIteratorInterfacelistPredicates()
Fetches an iterator over unique set of dataset quad predicates optionally matching a given filter.
public
listPredicates([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermIteratorInterface
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermIteratorInterfacelistSubjects()
Fetches an iterator over unique set of dataset quad subjects optionally matching a given filter.
public
listSubjects([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : TermIteratorInterface
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
Return values
TermIteratorInterfacemap()
Returns a new dataset from quads processed with a given callback function.
public
map(callable $fn[, QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $indexed = false ]) : DatasetInterface
Parameters
- $fn : callable
-
function applied to every quad with signature
fn(QuadInterface, DatasetInterface)
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
- $indexed : bool = false
Return values
DatasetInterfacenone()
Checks if no quad in the dataset matches a given filter.
public
none(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter) : bool
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable
Return values
booloffsetExists()
Checks if a given offset exists.
public
offsetExists(QuadCompareInterface|callable|int<0, 0> $offset) : bool
Parameters
- $offset : QuadCompareInterface|callable|int<0, 0>
Tags
Return values
booloffsetGet()
Returns a quad matching the $offset.
public
offsetGet(QuadCompareInterface|callable|int<0, 0> $offset) : QuadInterface
Parameters
- $offset : QuadCompareInterface|callable|int<0, 0>
Tags
Return values
QuadInterfaceoffsetSet()
Assigns a new value to the quad matching the $offset.
public
offsetSet(QuadCompareInterface|callable|null $offset, QuadInterface $value) : void
Parameters
- $offset : QuadCompareInterface|callable|null
- $value : QuadInterface
Tags
offsetUnset()
Removes a quad matching the $offset.
public
offsetUnset(QuadCompareInterface|callable $offset) : void
Parameters
- $offset : QuadCompareInterface|callable
Tags
reduce()
Performs a reduce operation on the dataset quads.
public
reduce(callable $fn[, mixed $initialValue = null ][, QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : mixed
The reduce operation consist of calling a given callback function on all matching quads. The first call is made with the $initialValue passed as the callback's $prevValue. Following calls pass previous callback's call return value as the next callback's call $prevValue. The return value of the last callback function call is the return value of the reduce() method.
Parameters
- $fn : callable
-
aggregate function with signature
fn(mixed $prevValue, QuadInterface, DatasetInterface)
- $initialValue : mixed = null
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
union()
Returns a new dataset being a union of the current one and the $other one.
public
union(QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface $other[, bool $indexed = false ]) : DatasetInterface
For a in-place union use add().
Parameters
- $other : QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface
- $indexed : bool = false
Return values
DatasetInterfacexor()
Returns a new dataset being a symmetric difference of the current dataset and the $other one.
public
xor(QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface $other[, bool $indexed = false ]) : DatasetInterface
There is no in-place equivalent.
Parameters
- $other : QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface
- $indexed : bool = false
Return values
DatasetInterfacecheckIterator()
private
checkIterator(Iterator<string|int, QuadInterface> $i, bool $errorOrInvalid) : QuadInterface|null
Parameters
- $i : Iterator<string|int, QuadInterface>
- $errorOrInvalid : bool
Tags
Return values
QuadInterface|nullexists()
private
exists(QuadCompareInterface|callable|int $offset) : bool
Parameters
- $offset : QuadCompareInterface|callable|int
Return values
boolfindByIndices()
private
findByIndices(QuadCompareInterface $template[, bool $match = true ]) : Generator<string|int, QuadInterface>
Parameters
- $template : QuadCompareInterface
- $match : bool = true
Return values
Generator<string|int, QuadInterface>findMatchingQuads()
private
findMatchingQuads(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|int<0, 0>|null $offset) : Generator<string|int, QuadInterface>
Parameters
- $offset : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|int<0, 0>|null
Tags
Return values
Generator<string|int, QuadInterface>findNotMatchingQuads()
private
findNotMatchingQuads(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $offset) : Generator<string|int, QuadInterface>
Parameters
- $offset : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null
Return values
Generator<string|int, QuadInterface>get()
private
get(QuadCompareInterface|callable|int $offset) : QuadInterface
Parameters
- $offset : QuadCompareInterface|callable|int
Return values
QuadInterfaceindex()
private
index(QuadInterface $quad) : void
Parameters
- $quad : QuadInterface
listQuadElement()
private
listQuadElement(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter, string $elementFn) : TermIteratorInterface
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null
- $elementFn : string
Return values
TermIteratorInterfaceset()
private
set(QuadCompareInterface|callable $offset, QuadInterface $value) : void
Parameters
- $offset : QuadCompareInterface|callable
- $value : QuadInterface
unindex()
private
unindex(QuadInterface $quad) : void
Parameters
- $quad : QuadInterface
unset()
private
unset(QuadCompareInterface|callable $offset) : void
Parameters
- $offset : QuadCompareInterface|callable