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
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.
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.
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.
pub fn insert_all_reverse<Nodes: Iterator<Item = Indexed<Self>>>(
&mut self,
reverse_prop: Reference<T>,
reverse_values: Nodes
)
pub fn insert_all_reverse<Nodes: Iterator<Item = Indexed<Self>>>(
&mut self,
reverse_prop: Reference<T>,
reverse_values: Nodes
)
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.
Trait Implementations
Converts this value into a K
JSON value using the given
meta
function to convert J::MetaData
into K::MetaData
. Read more
Auto Trait Implementations
impl<J, T> RefUnwindSafe for Node<J, T> where
J: RefUnwindSafe,
T: RefUnwindSafe,
<J as Json>::Number: RefUnwindSafe,
<J as Json>::String: RefUnwindSafe,
impl<J, T> Send for Node<J, T> where
J: Send,
T: Send,
<J as Json>::Number: Send,
<J as Json>::String: Send,
impl<J, T> Sync for Node<J, T> where
J: Sync,
T: Sync,
<J as Json>::Number: Sync,
<J as Json>::String: Sync,
impl<J, T> Unpin for Node<J, T> where
J: Unpin,
T: Unpin,
<J as Json>::Number: Unpin,
<J as Json>::String: Unpin,
impl<J, T> UnwindSafe for Node<J, T> where
J: UnwindSafe,
T: UnwindSafe,
<J as Json>::Number: UnwindSafe,
<J as Json>::String: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn compact_indexed<'a, K, C, L, M>(
&'a Self,
Option<&'a str>,
Inversible<T, &'a C>,
Inversible<T, &'a C>,
Option<&'a str>,
&'a mut L,
Options,
M
) -> Pin<Box<dyn Future<Output = Result<K, Error>> + Send + 'a, Global>> where
K: JsonFrom<J>,
C: ContextMut<T> + Sync + Send,
L: Loader + Sync + Send,
J: 'a,
T: 'a,
M: 'a + Send + Sync + Clone + Fn(Option<&<J as Json>::MetaData>) -> <K as Json>::MetaData,
<C as Context<T>>::LocalContext: Send,
<C as Context<T>>::LocalContext: Sync,
<C as Context<T>>::LocalContext: From<<L as Loader>::Output>,
pub fn compact_indexed<'a, K, C, L, M>(
&'a Self,
Option<&'a str>,
Inversible<T, &'a C>,
Inversible<T, &'a C>,
Option<&'a str>,
&'a mut L,
Options,
M
) -> Pin<Box<dyn Future<Output = Result<K, Error>> + Send + 'a, Global>> where
K: JsonFrom<J>,
C: ContextMut<T> + Sync + Send,
L: Loader + Sync + Send,
J: 'a,
T: 'a,
M: 'a + Send + Sync + Clone + Fn(Option<&<J as Json>::MetaData>) -> <K as Json>::MetaData,
<C as Context<T>>::LocalContext: Send,
<C as Context<T>>::LocalContext: Sync,
<C as Context<T>>::LocalContext: From<<L as Loader>::Output>,
Compact with the given optional index.