Documentation

DatasetNode
in package
implements DatasetNodeInterface uses DatasetGettersTrait

Description of DatasetNode

Tags
author

zozlak

Table of Contents

Interfaces

DatasetNodeInterface
Node-oriented graph API interface.

Properties

$dataset  : DatasetInterface
$node  : TermInterface

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

Methods

__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
string

copy()

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
DatasetNodeInterface

copyExcept()

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
DatasetNodeInterface

delete()

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
$other : DatasetInterface|TermCompareInterface|DatasetNodeInterface
Return values
bool

factory()

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
throws
BadMethodCallException
Return values
DatasetNodeInterface

forEach()

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
DatasetInterface

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
QuadIteratorInterface

getValue()

Returns dataset node node's value

public getValue() : mixed

map()

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
DatasetNodeInterface

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

xor()

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
DatasetNodeInterface

copyNode()

private copyNode([bool $indexed = false ]) : Dataset
Parameters
$indexed : bool = false
Return values
Dataset

        
On this page

Search results