pub struct Node<J: JsonHash, T: Id = IriBuf> { /* private fields */ }
Expand description

Node object.

A node object represents zero or more properties of a node in the graph serialized by a JSON-LD document. A node is defined by its identifier (@id field), types, properties and reverse properties. In addition, a node may represent a graph (@graph field) and includes nodes (@included field).

Implementations

Creates a new empty node.

Creates a new empty node with the given id.

Checks if the node object has the given term as key.

Example

// Checks if the JSON object representation of the node has an `@id` key.
if node.has_key(&Term::Keyword(Keyword::Id)) {
  // ...
}

Get the identifier of the node.

This correspond to the @id field of the JSON object.

Get the node’s as an IRI if possible.

Returns the node’s IRI id if any. Returns None otherwise.

Get the node’s id, is any, as a string slice.

Returns None if the node has no @id field.

Get the list of the node’s types.

Checks if the node has the given type.

Tests if the node is empty.

It is empty is every field other than @id is empty.

Tests if the node is a graph object (has a @graph field, and optionally an @id field). Note that node objects may have a @graph entry, but are not considered graph objects if they include any other entries other than @id.

Tests if the node is a simple graph object (a graph object without @id field)

If the node is a graph object, get the graph.

If the node is a graph object, get the mutable graph.

Set the graph.

Get the set of nodes included by this node.

This correspond to the @included field in the JSON representation.

Get the mutable set of nodes included by this node.

This correspond to the @included field in the JSON representation.

Set the set of nodes included by the node.

Returns a reference to the properties of the node.

Returns a reference to the reverse properties of the node.

Get all the objects associated to the node with the given property.

Get one of the objects associated to the node with the given property.

If multiple objects are attached to the node with this property, there are no guaranties on which object will be returned.

Associates the given object to the node through the given property.

Associates all the given objects to the node through the given property.

If there already exists objects associated to the given reverse property, reverse_value is added to the list. Duplicate objects are not removed.

Associates the given node to the reverse property.

If there already exists nodes associated to the given reverse property, reverse_value is added to the list. Duplicate nodes are not removed.

Associates all the given nodes to the reverse property.

Tests if the node is an unnamed graph object.

Returns true is the only field of the object is a @graph field. Returns false otherwise.

Returns the node as an unnamed graph, if it is one.

The unnamed graph is returned as a set of indexed objects. Fails and returns itself if the node is not an unnamed graph.

Trait Implementations

Converts this value into a K JSON value using the given meta function to convert J::MetaData into K::MetaData. Read more

Converts this value into a K JSON value. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compact with the given optional index.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.