Struct json_ld::expanded::ExpandedDocument
source · pub struct ExpandedDocument<T = IriBuf, B = BlankIdBuf>(/* private fields */);
Expand description
Result of the document expansion algorithm.
It is just an alias for a set of (indexed) objects.
Implementations§
source§impl<T, B> ExpandedDocument<T, B>
impl<T, B> ExpandedDocument<T, B>
pub fn new() -> ExpandedDocument<T, B>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn objects(&self) -> &IndexSet<Indexed<Object<T, B>>>
pub fn into_objects(self) -> IndexSet<Indexed<Object<T, B>>>
pub fn iter(&self) -> Iter<'_, Indexed<Object<T, B>>>
pub fn traverse(&self) -> Traverse<'_, T, B> ⓘ
pub fn count(&self, f: impl FnMut(&FragmentRef<'_, T, B>) -> bool) -> usize
sourcepub fn identify_all_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
pub fn identify_all_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
Give an identifier (@id
) to every nodes using the given generator to
generate fresh identifiers for anonymous nodes.
sourcepub fn identify_all<G>(&mut self, generator: &mut G)
pub fn identify_all<G>(&mut self, generator: &mut G)
Give an identifier (@id
) to every nodes using the given generator to
generate fresh identifiers for anonymous nodes.
sourcepub fn relabel_and_canonicalize_with<V, G>(
&mut self,
vocabulary: &mut V,
generator: &mut G
)
pub fn relabel_and_canonicalize_with<V, G>( &mut self, vocabulary: &mut V, generator: &mut G )
Give an identifier (@id
) to every nodes and canonicalize every
literals using the given generator to generate fresh identifiers for
anonymous nodes.
sourcepub fn relabel_and_canonicalize<G>(&mut self, generator: &mut G)
pub fn relabel_and_canonicalize<G>(&mut self, generator: &mut G)
Give an identifier (@id
) to every nodes and canonicalize every
literals using the given generator to generate fresh identifiers for
anonymous nodes.
sourcepub fn relabel_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
pub fn relabel_with<V, G>(&mut self, vocabulary: &mut V, generator: &mut G)
Relabels nodes.
sourcepub fn canonicalize_with(&mut self, buffer: &mut Buffer)
pub fn canonicalize_with(&mut self, buffer: &mut Buffer)
Puts this document literals into canonical form using the given
buffer
.
The buffer is used to compute the canonical form of numbers.
sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Puts this document literals into canonical form.
sourcepub fn blank_ids(&self) -> HashSet<&B>
pub fn blank_ids(&self) -> HashSet<&B>
Returns the set of all blank identifiers in the given document.
sourcepub fn main_node(&self) -> Option<&Node<T, B>>
pub fn main_node(&self) -> Option<&Node<T, B>>
Returns the main node object of the document, if any.
The main node is the unique top level (root) node object. If multiple
node objects are on the root, None
is returned.
sourcepub fn into_main_node(self) -> Option<Node<T, B>>
pub fn into_main_node(self) -> Option<Node<T, B>>
Consumes the document and returns its main node object, if any.
The main node is the unique top level (root) node object. If multiple
node objects are on the root, None
is returned.
source§impl<T, B> ExpandedDocument<T, B>
impl<T, B> ExpandedDocument<T, B>
source§impl<T, B> ExpandedDocument<T, B>
impl<T, B> ExpandedDocument<T, B>
pub fn generate_node_map_with<V, G>(
&self,
vocabulary: &mut V,
generator: G
) -> Result<NodeMap<T, B>, ConflictingIndexes<T, B>>where
V: Vocabulary<Iri = T, BlankId = B>,
G: Generator<V>,
source§impl<I, B> ExpandedDocument<I, B>
impl<I, B> ExpandedDocument<I, B>
pub fn from_interpreted_quads_in<'a, V, T>(
vocabulary: &V,
interpretation: &T,
quads: impl IntoIterator<Item = Quad<&'a <T as Interpretation>::Resource>>,
context: Context<'_, T>
) -> Result<ExpandedDocument<I, B>, SerializationError>where
V: Vocabulary<Iri = I, BlankId = B>,
T: ReverseTermInterpretation<Iri = I, BlankId = B, Literal = <V as LiteralVocabulary>::Literal>,
<T as Interpretation>::Resource: 'a + Ord + Hash,
I: Clone + Eq + Hash,
B: Clone + Eq + Hash,
pub fn from_interpreted_quads<'a, V, T>(
vocabulary: &V,
interpretation: &T,
quads: impl IntoIterator<Item = Quad<&'a <T as Interpretation>::Resource>>
) -> Result<ExpandedDocument<I, B>, SerializationError>where
V: Vocabulary<Iri = I, BlankId = B>,
T: ReverseTermInterpretation<Iri = I, BlankId = B, Literal = <V as LiteralVocabulary>::Literal>,
<T as Interpretation>::Resource: 'a + Ord + Hash,
I: Clone + Eq + Hash,
B: Clone + Eq + Hash,
Trait Implementations§
source§impl<I, B> Borrow<ExpandedDocument<I, B>> for Document<I, B>
impl<I, B> Borrow<ExpandedDocument<I, B>> for Document<I, B>
source§fn borrow(&self) -> &ExpandedDocument<I, B>
fn borrow(&self) -> &ExpandedDocument<I, B>
source§impl<T, B> Clone for ExpandedDocument<T, B>
impl<T, B> Clone for ExpandedDocument<T, B>
source§fn clone(&self) -> ExpandedDocument<T, B>
fn clone(&self) -> ExpandedDocument<T, B>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<I, B> Compact<I, B> for ExpandedDocument<I, B>
impl<I, B> Compact<I, B> for ExpandedDocument<I, B>
source§impl<T, B> Debug for ExpandedDocument<T, B>
impl<T, B> Debug for ExpandedDocument<T, B>
source§impl<T, B> Default for ExpandedDocument<T, B>
impl<T, B> Default for ExpandedDocument<T, B>
source§fn default() -> ExpandedDocument<T, B>
fn default() -> ExpandedDocument<T, B>
source§impl<T, B> Extend<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
impl<T, B> Extend<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
source§fn extend<I>(&mut self, iter: I)
fn extend<I>(&mut self, iter: I)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<I, B> Flatten<I, B> for ExpandedDocument<I, B>
impl<I, B> Flatten<I, B> for ExpandedDocument<I, B>
fn flatten_with<V, G>(
self,
vocabulary: &mut V,
generator: G,
ordered: bool
) -> Result<Vec<Indexed<Node<I, B>>>, ConflictingIndexes<I, B>>where
G: Generator<V>,
V: Vocabulary<Iri = I, BlankId = B>,
fn flatten_unordered_with<V, G>(
self,
vocabulary: &mut V,
generator: G
) -> Result<HashSet<Indexed<Node<I, B>>>, ConflictingIndexes<I, B>>where
G: Generator<V>,
V: Vocabulary<Iri = I, BlankId = B>,
source§impl<T, B> FromIterator<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
impl<T, B> FromIterator<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
source§fn from_iter<I>(iter: I) -> ExpandedDocument<T, B>
fn from_iter<I>(iter: I) -> ExpandedDocument<T, B>
source§impl<'a, T, B> IntoIterator for &'a ExpandedDocument<T, B>
impl<'a, T, B> IntoIterator for &'a ExpandedDocument<T, B>
source§fn into_iter(self) -> <&'a ExpandedDocument<T, B> as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a ExpandedDocument<T, B> as IntoIterator>::IntoIter
source§impl<T, B> IntoIterator for ExpandedDocument<T, B>
impl<T, B> IntoIterator for ExpandedDocument<T, B>
source§impl<T, B> LdQuads<T, B> for ExpandedDocument<T, B>
impl<T, B> LdQuads<T, B> for ExpandedDocument<T, B>
source§impl<T, B, V, I> LinkedData<I, V> for ExpandedDocument<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedData<I, V> for ExpandedDocument<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
source§impl<V, I> LinkedDataDeserialize<V, I> for ExpandedDocument<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
I: ReverseTermInterpretation<Iri = <V as IriVocabulary>::Iri, BlankId = <V as BlankIdVocabulary>::BlankId, Literal = <V as LiteralVocabulary>::Literal>,
V: Vocabulary,
<I as Interpretation>::Resource: Ord + Hash,
<V as IriVocabulary>::Iri: Clone + Eq + Hash,
<V as BlankIdVocabulary>::BlankId: Clone + Eq + Hash,
impl<V, I> LinkedDataDeserialize<V, I> for ExpandedDocument<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>where
I: ReverseTermInterpretation<Iri = <V as IriVocabulary>::Iri, BlankId = <V as BlankIdVocabulary>::BlankId, Literal = <V as LiteralVocabulary>::Literal>,
V: Vocabulary,
<I as Interpretation>::Resource: Ord + Hash,
<V as IriVocabulary>::Iri: Clone + Eq + Hash,
<V as BlankIdVocabulary>::BlankId: Clone + Eq + Hash,
fn deserialize_dataset_in( vocabulary: &V, interpretation: &I, dataset: &(impl TraversableDataset<Resource = <I as Interpretation>::Resource> + PatternMatchingDataset), context: Context<'_, I> ) -> Result<ExpandedDocument<<V as IriVocabulary>::Iri, <V as BlankIdVocabulary>::BlankId>, FromLinkedDataError>
fn deserialize_dataset( vocabulary: &V, interpretation: &I, dataset: &(impl TraversableDataset<Resource = <I as Interpretation>::Resource> + PatternMatchingDataset) ) -> Result<Self, FromLinkedDataError>
source§impl<T, B, V, I> LinkedDataGraph<I, V> for ExpandedDocument<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
impl<T, B, V, I> LinkedDataGraph<I, V> for ExpandedDocument<T, B>where
V: Vocabulary<Iri = T> + IriVocabularyMut,
I: Interpretation,
T: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
B: LinkedDataResource<I, V> + LinkedDataSubject<I, V>,
fn visit_graph<S>(
&self,
visitor: S
) -> Result<<S as GraphVisitor<I, V>>::Ok, <S as GraphVisitor<I, V>>::Error>where
S: GraphVisitor<I, V>,
source§impl<T, B> PartialEq for ExpandedDocument<T, B>
impl<T, B> PartialEq for ExpandedDocument<T, B>
source§impl<T, B, N> PrecomputeSizeWithContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrecomputeSizeWithContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
source§impl<T, B, N> PrintWithContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrintWithContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
source§impl<T, B, N> PrintWithSizeAndContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, N> PrintWithSizeAndContext<N> for ExpandedDocument<T, B>where
N: Vocabulary<Iri = T, BlankId = B>,
source§impl<T, B> RdfQuads<T, B> for ExpandedDocument<T, B>
impl<T, B> RdfQuads<T, B> for ExpandedDocument<T, B>
fn rdf_quads_full<'n, 'g, V, G>(
&self,
vocabulary: &'n mut V,
generator: &'g mut G,
rdf_direction: Option<RdfDirection>,
produce_generalized_rdf: bool
) -> Quads<'_, 'n, 'g, V, G> ⓘwhere
V: Vocabulary<Iri = T, BlankId = B>,
G: Generator<V>,
fn rdf_quads_with<'n, 'g, V, G>(
&self,
vocabulary: &'n mut V,
generator: &'g mut G,
rdf_direction: Option<RdfDirection>
) -> Quads<'_, 'n, 'g, V, G> ⓘwhere
V: Vocabulary<Iri = T, BlankId = B>,
G: Generator<V>,
source§impl<T, B> TryFromJson<T, B> for ExpandedDocument<T, B>
impl<T, B> TryFromJson<T, B> for ExpandedDocument<T, B>
fn try_from_json_in( vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>, value: Value ) -> Result<ExpandedDocument<T, B>, InvalidExpandedJson>
impl<T, B> Eq for ExpandedDocument<T, B>
Auto Trait Implementations§
impl<T, B> Freeze for ExpandedDocument<T, B>
impl<T, B> RefUnwindSafe for ExpandedDocument<T, B>where
T: RefUnwindSafe,
B: RefUnwindSafe,
impl<T, B> Send for ExpandedDocument<T, B>
impl<T, B> Sync for ExpandedDocument<T, B>
impl<T, B> Unpin for ExpandedDocument<T, B>where
T: Unpin,
impl<T, B> UnwindSafe for ExpandedDocument<T, B>where
T: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.