You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* `TermWrapper` is one of the two central constructs of this library. It is the base class of all models that represent a mapping from RDF to JavaScript. It _is_ an {@link Term | RDF/JS term} (or node) that also has a reference to both the dataset (or graph) that is the context of (i.e. contains) the term and to a factory that can be used to create additional terms.
6
+
*
7
+
* @remarks
8
+
* This class contains all members of all types derived from {@link Term}. This is so instances of this class can be used _as_ instances of any term type. See relevant example.
9
+
*
10
+
* @example Basic usage
11
+
* The basic pattern of working with this class is to simply extend it and add accessors and mutators (both optional) that expose data from the underlying RDF:
this.original=typeofterm==="string" ? factory.namedNode(term) : term
97
+
this._dataset=dataset
98
+
this._factory=factory
11
99
}
12
100
101
+
/**
102
+
* The dataset that contains this term.
103
+
*
104
+
* This accessor provides access to the underlying RDF graph that is the containing context of a node mapped to JavaScript by instances of this class.
105
+
*
106
+
* @remarks
107
+
* RDF/JS, like many other RDF frameworks, keeps terms and datasets separate. This means that terms do not hold a reference to a dataset they reside in (or were found in). This, in turn, means that a dataset must always be available, separate from the term, if either changes to the underlying data or further traversal of the underlying data is called for. In an object-oriented context however, where property chaining is idiomatic (i.e. `instance.property1.property2`), there is no way to supply the dataset when dereferencing a link in the chain.
108
+
*
109
+
* This property solves the problem by keeping a reference to the dataset.
110
+
*
111
+
* @exmaple
112
+
* Using the dataset to modify information related to this node in the underlying data:
* Note: The above example operates on a low level to explain this property. Library users are more likely to interact with {@link OptionalAs}, {@link RequiredAs} and {@link LiteralFrom} for a better experience.
128
+
*
129
+
* @exmaple
130
+
* Using the dataset to modify data related to this node in the underlying data:
0 commit comments