Tripledoc

Tripledoc

  • Docs
  • API reference
  • Cheatsheet

›Interfaces

Introduction

  • Globals

Interfaces

  • LocalTripleDocumentForContainer
  • LocalTripleDocumentWithRef
  • TripleDocument
  • TripleSubject

TripleDocument

Globals › 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

  • LocalTripleDocumentWithRef

  • 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:

NameTypeDescription
options?NewSubjectOptionsBy 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:

NameTypeDescription
predicateRefReferenceThe Predicate that must match for the desired Subject.
objectRefReferenceThe 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:

NameTypeDescription
predicateRefReferenceThe Predicate that must match for the desired Subjects.
objectRefReferenceThe 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:

NameTypeDescription
typeRefReferenceIRI 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:

NameTypeDescription
subjectRefReferenceIRI 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:

NameTypeDescription
subjectReferenceThe 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:

NameTypeDescription
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.
← LocalTripleDocumentWithRefTripleSubject →
  • Hierarchy
  • Index
    • Properties
  • Properties
    • addSubject
    • asRef
    • findSubject
    • findSubjects
    • getAllSubjectsOfType
    • getStatements
    • getSubject
    • removeSubject
    • save
Tripledoc
Docs
Writing a Solid AppAPI ReferenceCheatsheet
More
Source codeRelease notes
Copyright © 2021 Inrupt