DatasetNode
in package
implements
DatasetNodeInterface
uses
DatasetGettersTrait
Description of DatasetNode
Tags
Table of Contents
Interfaces
- DatasetNodeInterface
- Node-oriented graph API interface.
Properties
Methods
- __construct() : mixed
- __toString() : string
- Should return:
- add() : void
- Adds quad(s) to the dataset.
- any() : bool
- Checks if any quad of a dataset node with subject matching dataset node's node match a given filter.
- copy() : DatasetNodeInterface
- Creates a copy of the dataset node.
- copyExcept() : DatasetNodeInterface
- Creates a copy of the dataset node.
- count() : int
- delete() : DatasetInterface
- In-place removes quads from the dataset node.
- deleteExcept() : DatasetInterface
- In-place removes quads from the dataset node.
- equals() : bool
- Depending on the type of the $termOrDataset:
- every() : bool
- Checks if all quads of a dataset node with subject matching dataset node's node match a given filter.
- factory() : DatasetNodeInterface
- Creates a DatasetNodeInterface object.
- forEach() : void
- In-place modifies all dataset node quads using a given callback.
- getDataset() : DatasetInterface
- The actual dataset should be returned.
- 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 an iterator over datase node's quads having subject matching dataset node's node and optionally matching a given filter.
- getNode() : TermInterface
- Returns the node associated with a given DatasetNodeInterface object
- 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.
- getValue() : mixed
- Returns dataset node node's value
- listGraphs() : TermIteratorInterface
- Fetches an iterator over unique set of dataset node quad graphs having subject matching dataset node's node and optionally matching a given filter.
- listObjects() : TermIteratorInterface
- Fetches an iterator over unique set of dataset node quad objects having subject matching dataset node's node and optionally matching a given filter.
- listPredicates() : TermIteratorInterface
- Fetches an iterator over unique set of dataset node quad predicates having subject matching dataset node's node and optionally matching a given filter.
- listSubjects() : TermIteratorInterface
- Fetches an iterator over unique set of dataset quad subjects having subject matching dataset node's node and optionally matching a given filter.
- map() : DatasetNodeInterface
- Returns a new dataset node from quads processed with a given callback function.
- none() : bool
- Checks if none of quads of a dataset node with subject matching dataset node's node match a given filter.
- offsetExists() : bool
- Checks if a given offset exists. The check is performed only among quads which subject matching dataset node's node.
- offsetGet() : QuadInterface
- Returns a quad matching the $offset and having a subject matching dataset node's node.
- offsetSet() : void
- Assigns a new value to the quad matching the $offset and having subject matching dataset node's node.
- offsetUnset() : void
- Removes a quad matching the $offset and having subject matching dataset node's node.
- reduce() : mixed
- Performs a reduce operation on the dataset node quads with subject matching the dataset node's node.
- union() : DatasetNodeInterface
- Returns a new dataset node being a union of the current one (including both quads matching and not matching dataset node's node) and quads from the $other mathing the dataset node's node.
- withDataset() : DatasetNodeInterface
- Returns a new dataset node sharing the node with the current one but using a given dataset.
- withNode() : DatasetNodeInterface
- Returns a new dataset node which shares the underlaying dataset with the current one but has another node.
- xor() : DatasetNodeInterface
- Returns a new dataset node containing:
- copyNode() : Dataset
- copyOther() : Dataset
Properties
$dataset
private
DatasetInterface
$dataset
$node
private
TermInterface
$node
Methods
__construct()
public
__construct(TermInterface $node[, QuadIteratorInterface|QuadIteratorAggregateInterface|null $quads = null ][, bool $indexed = true ]) : mixed
Parameters
- $node : TermInterface
- $quads : QuadIteratorInterface|QuadIteratorAggregateInterface|null = null
- $indexed : bool = true
__toString()
Should return:
public
__toString() : string
- an URI for named nodes and blank nodes
- a value in lexical form for literals
For all other kind of terms the return value depends on the implementation
Return values
stringadd()
Adds quad(s) to the dataset.
public
add(QuadInterface|QuadNoSubjectInterface|Traversable<string|int, QuadInterface|QuadNoSubjectInterface>|array<string|int, QuadInterface|QuadNoSubjectInterface> $quads) : void
Parameters
- $quads : QuadInterface|QuadNoSubjectInterface|Traversable<string|int, QuadInterface|QuadNoSubjectInterface>|array<string|int, QuadInterface|QuadNoSubjectInterface>
Tags
any()
Checks if any quad of a dataset node with subject matching dataset node's node match 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 node.
public
copy([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $includeOther = true ][, bool $indexed = false ]) : DatasetNodeInterface
If $filter is provided, quads with subject matching DatasetNodeInterface's node and not matching the $filter are skipped.
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 or dataset node)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
Quads with subject other than dataset node's node are copied based on the $includeOther parameter value;
An in-place equivalent of a call using the $filter is the deleteExcept() method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
- $includeOther : bool = true
-
should quads with subject other than dataset node's node be copied
- $indexed : bool = false
Return values
DatasetNodeInterfacecopyExcept()
Creates a copy of the dataset node.
public
copyExcept(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter[, bool $includeOther = true ][, bool $indexed = false ]) : DatasetNodeInterface
If $filter is provided, the copy contains only quads with subject matching dateset node's node and not 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 or dataset node)
- A callable with signature
fn(\rdfInterface\QuadInterface, \rdfInterface\DatasetInterface): bool
All quads for which the callable returns true are copied.
Quads with subject other than dataset node's node are copied based on the $includeOther parameter value;
An in-place equivalent of a call using the $filter is the delete() method.
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null
- $includeOther : bool = true
-
should quads with subject other than dataset node's node be copied
- $indexed : bool = false
Return values
DatasetNodeInterfacecount()
public
count() : int
Return values
intdelete()
In-place removes quads from the dataset node.
public
delete([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $indexed = false ]) : DatasetInterface
All quads matching the $filter parameter and having a subject matching dataset node's node are removed.
The $filter can be specified as:
-
null
meaning "remove all". - 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 or dataset node)
- 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 node.
public
deleteExcept(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter[, bool $indexed = false ]) : DatasetInterface
All quads with subject matching dataset node's node 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 or dataset node)
- 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()
Depending on the type of the $termOrDataset:
public
equals(DatasetInterface|TermCompareInterface|DatasetNodeInterface $other) : bool
- If $termOrDataset is a TermCompareInterface, compares against the DatasetNodeInterface's node.
- If $termOrDataset is a DatasetInterface or DatasetNodeInterface, compares between the DatasetNodeInterface node's quads (quads having the node as their subject) between the DatasetNodeInterface object and the $termOrDataset object.
Parameters
Return values
boolevery()
Checks if all quads of a dataset node with subject matching dataset node's node match a given filter.
public
every(QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable $filter) : bool
Parameters
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable
Return values
boolfactory()
Creates a DatasetNodeInterface object.
public
static factory([TermInterface|null $node = null ][, QuadInterface|QuadNoSubjectInterface|Traversable<string|int, QuadInterface|QuadNoSubjectInterface>|array<string|int, QuadInterface|QuadNoSubjectInterface>|null $quads = null ]) : DatasetNodeInterface
Parameters
- $node : TermInterface|null = null
- $quads : QuadInterface|QuadNoSubjectInterface|Traversable<string|int, QuadInterface|QuadNoSubjectInterface>|array<string|int, QuadInterface|QuadNoSubjectInterface>|null = null
Tags
Return values
DatasetNodeInterfaceforEach()
In-place modifies all dataset node quads using a given callback.
public
forEach(callable $fn[, QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : void
All quads with subject matching dataset node's node and 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 or dataset node)
- 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 node.
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
getDataset()
The actual dataset should be returned.
public
getDataset() : DatasetInterface
This means if quads are in-place added/removed to/from the returned object, these changes are shared with the DatasetNodeInterface object.
Return values
DatasetInterfacegetGraph()
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 an iterator over datase node's quads having subject matching dataset node's node and optionally matching a given filter.
public
getIterator([QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ]) : QuadIteratorInterface
The $filter can be specified as:
-
null
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 or dataset node)
- 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
QuadIteratorInterfacegetNode()
Returns the node associated with a given DatasetNodeInterface object
public
getNode() : TermInterface
Return values
TermInterfacegetObject()
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
getValue()
Returns dataset node node's value
public
getValue() : mixed
listGraphs()
Fetches an iterator over unique set of dataset node quad graphs having subject matching dataset node's node and 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 node quad objects having subject matching dataset node's node and 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 node quad predicates having subject matching dataset node's node and 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 having subject matching dataset node's node and 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 node from quads processed with a given callback function.
public
map(callable $fn[, QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null $filter = null ][, bool $includeOther = true ][, bool $indexed = false ]) : DatasetNodeInterface
Parameters
- $fn : callable
-
function applied to every quad with signature
fn(\rdfInterface\QuadInterfca, \rdfInterface\DatasetNodeInterface)
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
- $includeOther : bool = true
-
should quads with subject other than dataset node's node be copied
- $indexed : bool = false
Return values
DatasetNodeInterfacenone()
Checks if none of quads of a dataset node with subject matching dataset node's node match 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. The check is performed only among quads which subject matching dataset node's node.
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 and having a subject matching dataset node's node.
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 and having subject matching dataset node's node.
public
offsetSet(QuadCompareInterface|callable|null $offset, QuadInterface $value) : void
Parameters
- $offset : QuadCompareInterface|callable|null
- $value : QuadInterface
Tags
offsetUnset()
Removes a quad matching the $offset and having subject matching dataset node's node.
public
offsetUnset(QuadCompareInterface|callable $offset) : void
Parameters
- $offset : QuadCompareInterface|callable
Tags
reduce()
Performs a reduce operation on the dataset node quads with subject matching the dataset node's node.
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, \rdfInterface\QuadInterface, \rdfInterface\DatasetInterface)
- $initialValue : mixed = null
- $filter : QuadCompareInterface|QuadIteratorInterface|QuadIteratorAggregateInterface|callable|null = null
union()
Returns a new dataset node being a union of the current one (including both quads matching and not matching dataset node's node) and quads from the $other mathing the dataset node's node.
public
union(QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface $other[, bool $indexed = false ]) : DatasetNodeInterface
For an in-place union use add().
Parameters
- $other : QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface
- $indexed : bool = false
Return values
DatasetNodeInterface —$see add()
withDataset()
Returns a new dataset node sharing the node with the current one but using a given dataset.
public
withDataset(DatasetInterface $dataset) : DatasetNodeInterface
The reference to the $dataset is kept so that changes made to it outside of the DatasetNodeInterface object are reflected in the new dataset node object.
Parameters
- $dataset : DatasetInterface
Return values
DatasetNodeInterfacewithNode()
Returns a new dataset node which shares the underlaying dataset with the current one but has another node.
public
withNode(TermInterface $node) : DatasetNodeInterface
Parameters
- $node : TermInterface
Return values
DatasetNodeInterfacexor()
Returns a new dataset node containing:
public
xor(QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface $other[, bool $indexed = false ]) : DatasetNodeInterface
- all quads of the dataset node with subject other than the node
- xor between triples of the dataset node quads with subject matching its node and quads of the $other
Parameters
- $other : QuadInterface|QuadIteratorInterface|QuadIteratorAggregateInterface
- $indexed : bool = false
Return values
DatasetNodeInterfacecopyNode()
private
copyNode([bool $indexed = false ]) : Dataset
Parameters
- $indexed : bool = false
Return values
DatasetcopyOther()
private
copyOther(bool $indexed) : Dataset
Parameters
- $indexed : bool