TripleDocument
Local representation of a Document in a Pod.
A TripleDocument gives you access to the values in the respective Document located on a Pod. They
can be accessed as TripleSubjects, which will allow you to manipulate their properties using
its get*
, add*
, set*
and remove*
methods — these changes will be applied to the Pod when
you call save on this Document.
Note that these changes can not be read from this TripleDocument; they will be available on the TripleDocument that is returned when you call save.
Hierarchy
TripleDocument
Index
Properties
- addSubject
- asRef
- findSubject
- findSubjects
- getAllSubjectsOfType
- getStatements
- getSubject
- removeSubject
- save
Properties
addSubject
• addSubject: function
Inherited from void
Add a Subject — note that it is not written to the Pod until you call save.
returns
A TripleSubject instance that can be used to define its properties.
Type declaration:
▸ (options?
: NewSubjectOptions): TripleSubject
Parameters:
Name | Type | Description |
---|---|---|
options? | NewSubjectOptions | By default, Tripledoc will automatically generate an identifier with which this Subject can be identified within the Document, and which is likely to be unique. The options parameter has a number of optional properties. The first, identifier , takes a string. If set, Tripledoc will not automatically generate an identifier. Instead, the value of this parameter will be used as the Subject's identifier. The second optional parameter, identifierPrefix , is also a string. If set, it will be prepended before this Subject's identifier, whether that's autogenerated or not. |
asRef
• asRef: function
Inherited from LocalTripleDocumentWithRef.asRef
returns
The IRI of this Document.
Type declaration:
▸ (): Reference
findSubject
• findSubject: function
Find a Subject which has the value of objectRef
for the Predicate predicateRef
.
returns
null
if no Subject matching predicateRef
and objectRef
is found,
a random one of the matching Subjects otherwise.
Type declaration:
▸ (predicateRef
: Reference, objectRef
: Reference): TripleSubject | null
Parameters:
Name | Type | Description |
---|---|---|
predicateRef | Reference | The Predicate that must match for the desired Subject. |
objectRef | Reference | The Object that must match for the desired Subject. |
findSubjects
• findSubjects: function
Find Subjects which have the value of objectRef
for the Predicate predicateRef
.
returns
An array with every matching Subject, and an empty array if none match.
Type declaration:
▸ (predicateRef
: Reference, objectRef
: Reference): TripleSubject[]
Parameters:
Name | Type | Description |
---|---|---|
predicateRef | Reference | The Predicate that must match for the desired Subjects. |
objectRef | Reference | The Object that must match for the desired Subjects. |
getAllSubjectsOfType
• getAllSubjectsOfType: function
Get all Subjects in this Document of a given type.
returns
All Subjects in this Document that are of the given type.
Type declaration:
▸ (typeRef
: Reference): TripleSubject[]
Parameters:
Name | Type | Description |
---|---|---|
typeRef | Reference | IRI of the type the desired Subjects should be of. |
getStatements
• getStatements: function
deprecated
Replaced by [[getTriples]]
Type declaration:
▸ (): Quad[]
getSubject
• getSubject: function
Given the IRI of a Subject, return an instantiated TripleSubject representing its values.
returns
Instantiation of the Subject at subjectRef
, ready for inspection.
Type declaration:
▸ (subjectRef
: Reference): TripleSubject
Parameters:
Name | Type | Description |
---|---|---|
subjectRef | Reference | IRI of the Subject to inspect. |
removeSubject
• removeSubject: function
Remove a Subject - note that it is not removed from the Pod until you call save.
Type declaration:
▸ (subject
: Reference): void
Parameters:
Name | Type | Description |
---|---|---|
subject | Reference | The IRI of the Subject to remove. |
save
• save: function
Inherited from LocalTripleDocumentForContainer.save
Persist Subjects in this Document to the Pod.
returns
The updated Document with persisted Subjects.
Type declaration:
▸ (subjects?
: TripleSubject[]): Promise‹TripleDocument›
Parameters:
Name | Type | Description |
---|---|---|
subjects? | TripleSubject[] | Optional array of specific Subjects within this Document that should be written to the Pod, i.e. excluding Subjects not in this array. |