Node
    
            
            in package
            
        
    
            
            implements
                            NodeInterface,                             JsonLdSerializable                    
    
    
A Node represents a node in a JSON-LD graph.
Tags
Table of Contents
Interfaces
- NodeInterface
- A generic interface for nodes in a JSON-LD graph.
- JsonLdSerializable
- The JsonLdSerializable interface
Constants
- TYPE = '@type'
- The @type constant.
Properties
- $graph : GraphInterface
- $id : string
- $properties : array<string|int, mixed>
- $revProperties : array<string|int, mixed>
- An associative array holding all reverse properties of this node, i.e., a pointers to all nodes that link to this node.
Methods
- __construct() : mixed
- Constructor
- addPropertyValue() : self
- Adds a value to a property of the node
- addType() : self
- Add a type to this node
- equals() : bool
- Compares this node object to the specified value.
- getGraph() : null|GraphInterface
- Get the graph the node belongs to
- getId() : string|null
- Get ID
- getNodesWithThisType() : array<string|int, NodeInterface>
- Get the nodes which have this node as their type
- getProperties() : array<string|int, mixed>
- Get the properties of this node
- getProperty() : mixed
- Get the value of a property
- getReverseProperties() : array<string|int, mixed>
- Get the reverse properties of this node
- getReverseProperty() : null|NodeInterface|array<string|int, NodeInterface>
- Get the nodes of a reverse property
- getType() : null|NodeInterface|array<string|int, NodeInterface>
- Get node type
- isBlankNode() : bool
- Is this node a blank node
- removeFromGraph() : self
- Removes the node from the graph
- removeProperty() : self
- Removes a property and all it's values
- removePropertyValue() : self
- Removes a property value
- removeType() : self
- Remove a type from this node
- setProperty() : self
- Set a property of the node
- setType() : self
- Set the node type
- toJsonLd() : mixed
- Convert to expanded and flattened JSON-LD
- addReverseProperty() : mixed
- Add a reverse property.
- equalValues() : bool
- Checks whether the two specified values are the same.
- isValidPropertyValue() : bool
- Checks whether a value is a valid property value.
- normalizePropertyValue() : NodeInterface|Value
- Normalizes a property value by converting scalars to Value objects.
- removeReverseProperty() : mixed
- Remove a reverse property.
- doMergeIntoProperty() : mixed
- Merge a value into a set of existing values.
Constants
TYPE
The @type constant.
    public
        mixed
    TYPE
    = '@type'
    
    
    
    
Properties
$graph
        private
            GraphInterface
    $graph
    
    
        The graph the node belongs to.
$id
        private
            string
    $id
    
    
        The ID of the node
$properties
        private
            array<string|int, mixed>
    $properties
     = array()
    
        An associative array holding all properties of the node except it's ID
$revProperties
An associative array holding all reverse properties of this node, i.e., a pointers to all nodes that link to this node.
        private
            array<string|int, mixed>
    $revProperties
     = array()
    
    
    
    
    
Methods
__construct()
Constructor
    public
                    __construct(GraphInterface $graph[, null|string $id = null ]) : mixed
    Parameters
- $graph : GraphInterface
- 
                    The graph the node belongs to. 
- $id : null|string = null
- 
                    The ID of the node. 
addPropertyValue()
Adds a value to a property of the node
    public
                    addPropertyValue(mixed $property, mixed $value) : self
    Parameters
- $property : mixed
- 
                    The name of the property. 
- $value : mixed
- 
                    The value of the property. This MUST NOT be an array. 
Return values
selfaddType()
Add a type to this node
    public
                    addType(NodeInterface $type) : self
    Parameters
- $type : NodeInterface
Return values
selfequals()
Compares this node object to the specified value.
    public
                    equals(NodeInterface $other) : bool
    Parameters
- $other : NodeInterface
- 
                    The value this instance should be compared to. 
Return values
bool —Returns true if the passed value is the same as this instance; false otherwise.
getGraph()
Get the graph the node belongs to
    public
                    getGraph() : null|GraphInterface
    Return values
null|GraphInterface —Returns the graph the node belongs to or null if the node doesn't belong to any graph.
getId()
Get ID
    public
                    getId() : string|null
    Return values
string|null —The ID of the node or null.
getNodesWithThisType()
Get the nodes which have this node as their type
    public
                    getNodesWithThisType() : array<string|int, NodeInterface>
    Return values
array<string|int, NodeInterface> —Returns the node(s) having this node as their type.
getProperties()
Get the properties of this node
    public
                    getProperties() : array<string|int, mixed>
    Return values
array<string|int, mixed> —Returns an associative array containing all properties of this node. The key is the property name whereas the value is the property's value.
getProperty()
Get the value of a property
    public
                    getProperty(mixed $property) : mixed
    Parameters
- $property : mixed
- 
                    The name of the property. 
Return values
mixed —Returns the value of the property or null if the property doesn't exist.
getReverseProperties()
Get the reverse properties of this node
    public
                    getReverseProperties() : array<string|int, mixed>
    Return values
array<string|int, mixed> —Returns an associative array containing all reverse properties of this node. The key is the property name whereas the value is an array of nodes linking to this instance via that property.
getReverseProperty()
Get the nodes of a reverse property
    public
                    getReverseProperty(mixed $property) : null|NodeInterface|array<string|int, NodeInterface>
    Parameters
- $property : mixed
- 
                    The name of the reverse property. 
Return values
null|NodeInterface|array<string|int, NodeInterface> —Returns the node(s) pointing to this instance via the specified property or null if no such node exists.
getType()
Get node type
    public
                    getType() : null|NodeInterface|array<string|int, NodeInterface>
    Return values
null|NodeInterface|array<string|int, NodeInterface> —Returns the type(s) of this node.
isBlankNode()
Is this node a blank node
    public
                    isBlankNode() : bool
    Return values
bool —Returns true if the node is a blank node, otherwise false.
removeFromGraph()
Removes the node from the graph
    public
                    removeFromGraph() : self
    Return values
selfremoveProperty()
Removes a property and all it's values
    public
                    removeProperty(mixed $property) : self
    Parameters
- $property : mixed
- 
                    The name of the property to remove. 
Return values
selfremovePropertyValue()
Removes a property value
    public
                    removePropertyValue(mixed $property, mixed $value) : self
    Parameters
- $property : mixed
- 
                    The name of the property. 
- $value : mixed
- 
                    The value of the property. This MUST NOT be an array. 
Return values
selfremoveType()
Remove a type from this node
    public
                    removeType(NodeInterface $type) : self
    Parameters
- $type : NodeInterface
Return values
selfsetProperty()
Set a property of the node
    public
                    setProperty(mixed $property, mixed $value) : self
    Parameters
- $property : mixed
- 
                    The name of the property. 
- $value : mixed
- 
                    The value of the property. This MUST NOT be an array. Use null to remove the property. 
Return values
selfsetType()
Set the node type
    public
                    setType(mixed $type) : self
    Parameters
- $type : mixed
Return values
selftoJsonLd()
Convert to expanded and flattened JSON-LD
    public
                    toJsonLd([mixed $useNativeTypes = true ]) : mixed
    Parameters
- $useNativeTypes : mixed = true
- 
                    If set to true, native types are used for xsd:integer, xsd:double, and xsd:boolean, otherwise typed strings will be used instead. 
Return values
mixed —Returns data which can be serialized by JsonLD::toString() (which is a value of any type other than a resource) to expanded JSON-LD.
addReverseProperty()
Add a reverse property.
    protected
                    addReverseProperty(string $property, NodeInterface $node) : mixed
    Parameters
- $property : string
- 
                    The name of the property. 
- $node : NodeInterface
- 
                    The node which has a property pointing to this node instance. 
equalValues()
Checks whether the two specified values are the same.
    protected
                    equalValues(mixed $value1, mixed $value2) : bool
    Scalars and nodes are checked for identity, value objects for equality.
Parameters
- $value1 : mixed
- 
                    Value 1. 
- $value2 : mixed
- 
                    Value 2. 
Return values
bool —Returns true if the two values are equals; otherwise false.
isValidPropertyValue()
Checks whether a value is a valid property value.
    protected
                    isValidPropertyValue(mixed $value) : bool
    Parameters
- $value : mixed
- 
                    The value to check. 
Return values
bool —Returns true if the value is a valid property value; false otherwise.
normalizePropertyValue()
Normalizes a property value by converting scalars to Value objects.
    protected
                    normalizePropertyValue(mixed $value) : NodeInterface|Value
    Parameters
- $value : mixed
- 
                    The value to normalize. 
Return values
NodeInterface|Value —The normalized value.
removeReverseProperty()
Remove a reverse property.
    protected
                    removeReverseProperty(string $property, NodeInterface $node) : mixed
    Parameters
- $property : string
- 
                    The name of the property. 
- $node : NodeInterface
- 
                    The node which has a property pointing to this node instance. 
doMergeIntoProperty()
Merge a value into a set of existing values.
    private
                    doMergeIntoProperty(string $property, array<string|int, mixed> $existingValues, mixed $value) : mixed
    Parameters
- $property : string
- 
                    The name of the property. 
- $existingValues : array<string|int, mixed>
- 
                    The existing values. 
- $value : mixed
- 
                    The value to merge into the existing values. This MUST NOT be an array.