tripledoc v0.0.1-master-276197166-b3d74b08
tripledoc
Read, create and edit Turtle documents on Solid Pods.
Installation
npm install tripledocUsage
// TODOChangelog
See CHANGELOG.
License
MIT © Vincent Tunru
API
Index
Interfaces
Type aliases
Variables
- acl
- arg
- cal
- contact
- dc
- dct
- doap
- fetcher
- foaf
- http
- httph
- icalTZ
- ldp
- link
- log
- meeting
- mo
- owl
- pad
- patch
- qu
- rdf
- rdfs
- rss
- sched
- schema
- sioc
- solid
- space
- stat
- store
- tab
- trip
- ui
- updater
- vcard
- wf
- xsd
Functions
- asLiteral
- createDocument
- deleteStatementsFromStore
- fetchDocument
- fetchSubject
- findEntitiesInStore
- findEntityInStore
- findObjectInStore
- findObjectsInStore
- findPredicateInStore
- findPredicatesInStore
- findSubjectInStore
- findSubjectsInStore
- generateNamespace
- getFetcher
- getLocalDocument
- getStore
- getUpdater
- initialiseSubject
- isEntity
- isLiteral
- normaliseEntity
- update
- withDocumentPlural
- withDocumentSingular
Type aliases
DeleteStatementsFromStore
Ƭ DeleteStatementsFromStore: function
Defined in deleteStatements.ts:3
Type declaration:
▸ (store: IndexedFormula, updater: UpdateManager, statements: Statement[]): Promise<Statement[]>
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
updater | UpdateManager |
statements | Statement[] |
FindEntitiesInStore
Ƭ FindEntitiesInStore: function
Defined in getEntities.ts:10
Type declaration:
▸ (store: IndexedFormula, knownEntity1: NodeRef, knownEntity2: NodeRef, document: NodeRef): Array<NodeRef | Literal>
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
knownEntity1 | NodeRef |
knownEntity2 | NodeRef |
document | NodeRef |
FindEntityInStore
Ƭ FindEntityInStore: function
Defined in getEntities.ts:4
Type declaration:
▸ (store: IndexedFormula, knownEntity1: NodeRef, knownEntity2: NodeRef, document: NodeRef): NodeRef | Literal | null
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
knownEntity1 | NodeRef |
knownEntity2 | NodeRef |
document | NodeRef |
LiteralTypes
Ƭ LiteralTypes: string | number
Defined in index.ts:7
Namespace
Ƭ Namespace: function
Defined in namespace.ts:4
Type declaration:
▸ (identifier: string): NodeRef
Parameters:
| Name | Type |
|---|---|
identifier | string |
NodeRef
Ƭ NodeRef: string
Defined in index.ts:32
Variables
Const acl
• acl: Namespace = generateNamespace('http://www.w3.org/ns/auth/acl#')
Defined in namespace.ts:15
Const arg
• arg: Namespace = generateNamespace('http://www.w3.org/ns/pim/arg#')
Defined in namespace.ts:16
Const cal
• cal: Namespace = generateNamespace('http://www.w3.org/2002/12/cal/ical#')
Defined in namespace.ts:17
Const contact
• contact: Namespace = generateNamespace('http://www.w3.org/2000/10/swap/pim/contact#')
Defined in namespace.ts:18
Const dc
• dc: Namespace = generateNamespace('http://purl.org/dc/elements/1.1/')
Defined in namespace.ts:19
Const dct
• dct: Namespace = generateNamespace('http://purl.org/dc/terms/')
Defined in namespace.ts:20
Const doap
• doap: Namespace = generateNamespace('http://usefulinc.com/ns/doap#')
Defined in namespace.ts:21
Const fetcher
• fetcher: Fetcher = new $rdf.Fetcher(store, undefined)
Defined in store.ts:4
Const foaf
• foaf: Namespace = generateNamespace('http://xmlns.com/foaf/0.1/')
Defined in namespace.ts:22
Const http
• http: Namespace = generateNamespace('http://www.w3.org/2007/ont/http#')
Defined in namespace.ts:23
Const httph
• httph: Namespace = generateNamespace('http://www.w3.org/2007/ont/httph#')
Defined in namespace.ts:24
Const icalTZ
• icalTZ: Namespace = generateNamespace('http://www.w3.org/2002/12/cal/icaltzd#')
Defined in namespace.ts:25
Const ldp
• ldp: Namespace = generateNamespace('http://www.w3.org/ns/ldp#')
Defined in namespace.ts:26
Const link
• link: Namespace = generateNamespace('http://www.w3.org/2007/ont/link#')
Defined in namespace.ts:27
Const log
• log: Namespace = generateNamespace('http://www.w3.org/2000/10/swap/log#')
Defined in namespace.ts:28
Const meeting
• meeting: Namespace = generateNamespace('http://www.w3.org/ns/pim/meeting#')
Defined in namespace.ts:29
Const mo
• mo: Namespace = generateNamespace('http://purl.org/ontology/mo/')
Defined in namespace.ts:30
Const owl
• owl: Namespace = generateNamespace('http://www.w3.org/2002/07/owl#')
Defined in namespace.ts:31
Const pad
• pad: Namespace = generateNamespace('http://www.w3.org/ns/pim/pad#')
Defined in namespace.ts:32
Const patch
• patch: Namespace = generateNamespace('http://www.w3.org/ns/pim/patch#')
Defined in namespace.ts:33
Const qu
• qu: Namespace = generateNamespace('http://www.w3.org/2000/10/swap/pim/qif#')
Defined in namespace.ts:34
Const rdf
• rdf: Namespace = generateNamespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
Defined in namespace.ts:36
Const rdfs
• rdfs: Namespace = generateNamespace('http://www.w3.org/2000/01/rdf-schema#')
Defined in namespace.ts:37
Const rss
• rss: Namespace = generateNamespace('http://purl.org/rss/1.0/')
Defined in namespace.ts:38
Const sched
• sched: Namespace = generateNamespace('http://www.w3.org/ns/pim/schedule#')
Defined in namespace.ts:39
Const schema
• schema: Namespace = generateNamespace('http:/schema.org/')
Defined in namespace.ts:40
Const sioc
• sioc: Namespace = generateNamespace('http://rdfs.org/sioc/ns#')
Defined in namespace.ts:41
Const solid
• solid: Namespace = generateNamespace('http://www.w3.org/ns/solid/terms#')
Defined in namespace.ts:42
Const space
• space: Namespace = generateNamespace('http://www.w3.org/ns/pim/space#')
Defined in namespace.ts:43
Const stat
• stat: Namespace = generateNamespace('http://www.w3.org/ns/posix/stat#')
Defined in namespace.ts:44
Const store
• store: IndexedFormula = $rdf.graph()
Defined in store.ts:3
Const tab
• tab: Namespace = generateNamespace('http://www.w3.org/2007/ont/link#')
Defined in namespace.ts:45
Const trip
• trip: Namespace = generateNamespace('http://www.w3.org/ns/pim/trip#')
Defined in namespace.ts:35
Const ui
• ui: Namespace = generateNamespace('http://www.w3.org/ns/ui#')
Defined in namespace.ts:46
Const updater
• updater: UpdateManager = new $rdf.UpdateManager(store)
Defined in store.ts:5
Const vcard
• vcard: Namespace = generateNamespace('http://www.w3.org/2006/vcard/ns#')
Defined in namespace.ts:47
Const wf
• wf: Namespace = generateNamespace('http://www.w3.org/2005/01/wf/flow#')
Defined in namespace.ts:48
Const xsd
• xsd: Namespace = generateNamespace('http://www.w3.org/2001/XMLSchema#')
Defined in namespace.ts:49
Functions
asLiteral
▸ asLiteral(literal: LiteralTypes): Literal
Defined in index.ts:8
Parameters:
| Name | Type |
|---|---|
literal | LiteralTypes |
Returns: Literal
createDocument
▸ createDocument(ref: NodeRef, statements: Statement[]): Promise<TripleDocument>
Defined in document.ts:15
Initialise a new Turtle document
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
ref | NodeRef | - | URL where this document should live |
statements | Statement[] | [] | Initial statements to be included in this document |
Returns: Promise<TripleDocument>
Const deleteStatementsFromStore
▸ deleteStatementsFromStore(store: IndexedFormula, updater: UpdateManager, statements: Statement[]): Promise<Statement[]>
Defined in deleteStatements.ts:9
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
updater | UpdateManager |
statements | Statement[] |
Returns: Promise<Statement[]>
fetchDocument
▸ fetchDocument(uri: string): Promise<TripleDocument>
Defined in document.ts:47
Retrieve a document containing RDF triples
Parameters:
| Name | Type | Description |
|---|---|---|
uri | string | Where the document lives |
Returns: Promise<TripleDocument>
Representation of triples in the document at uri
fetchSubject
▸ fetchSubject(subjectRef: NodeRef): Promise<TripleSubject>
Defined in subject.ts:25
Parameters:
| Name | Type |
|---|---|
subjectRef | NodeRef |
Returns: Promise<TripleSubject>
findEntitiesInStore
▸ findEntitiesInStore(store: IndexedFormula, type: "subject" | "predicate" | "object", subjectRef: null | NodeRef, predicateRef: null | NodeRef, objectRef: null | NodeRef, documentNode: null | NodeRef): Array<NodeRef | Literal>
Defined in getEntities.ts:57
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
type | "subject" | "predicate" | "object" |
subjectRef | null | NodeRef |
predicateRef | null | NodeRef |
objectRef | null | NodeRef |
documentNode | null | NodeRef |
Returns: Array<NodeRef | Literal>
findEntityInStore
▸ findEntityInStore(store: IndexedFormula, type: "subject" | "predicate" | "object", subjectRef: null | NodeRef, predicateRef: null | NodeRef, objectRef: null | NodeRef, documentNode: null | NodeRef): NodeRef | Literal | null
Defined in getEntities.ts:38
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
type | "subject" | "predicate" | "object" |
subjectRef | null | NodeRef |
predicateRef | null | NodeRef |
objectRef | null | NodeRef |
documentNode | null | NodeRef |
Returns: NodeRef | Literal | null
Const findObjectInStore
▸ findObjectInStore(store: IndexedFormula, subjectRef: string, predicateRef: string, documentNode: string): null | string | Literal
Defined in getEntities.ts:31
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
subjectRef | string |
predicateRef | string |
documentNode | string |
Returns: null | string | Literal
Const findObjectsInStore
▸ findObjectsInStore(store: IndexedFormula, subjectRef: string, predicateRef: string, documentNode: string): string | Literal[]
Defined in getEntities.ts:34
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
subjectRef | string |
predicateRef | string |
documentNode | string |
Returns: string | Literal[]
Const findPredicateInStore
▸ findPredicateInStore(store: IndexedFormula, subjectRef: string, objectRef: string, documentNode: string): null | string | Literal
Defined in getEntities.ts:24
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
subjectRef | string |
objectRef | string |
documentNode | string |
Returns: null | string | Literal
Const findPredicatesInStore
▸ findPredicatesInStore(store: IndexedFormula, subjectRef: string, objectRef: string, documentNode: string): string | Literal[]
Defined in getEntities.ts:27
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
subjectRef | string |
objectRef | string |
documentNode | string |
Returns: string | Literal[]
Const findSubjectInStore
▸ findSubjectInStore(store: IndexedFormula, predicateRef: string, objectRef: string, documentNode: string): null | string | Literal
Defined in getEntities.ts:17
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
predicateRef | string |
objectRef | string |
documentNode | string |
Returns: null | string | Literal
Const findSubjectsInStore
▸ findSubjectsInStore(store: IndexedFormula, predicateRef: string, objectRef: string, documentNode: string): string | Literal[]
Defined in getEntities.ts:20
Parameters:
| Name | Type |
|---|---|
store | IndexedFormula |
predicateRef | string |
objectRef | string |
documentNode | string |
Returns: string | Literal[]
generateNamespace
▸ generateNamespace(prefix: string): Namespace
Defined in namespace.ts:12
This function can be used to generate helpers for namespaces that will be commonly used in an app.
Parameters:
| Name | Type | Description |
|---|---|---|
prefix | string | The general prefix used for this namespace, e.g. http://www.w3.org/2006/vcard/ns# |
Returns: Namespace
A helper function that can be used to refer to terms in that namespace, e.g. vcard('role') to generate a reference to http://www.w3.org/2006/vcard/ns#role.
getFetcher
▸ getFetcher(): Fetcher
Defined in store.ts:11
Returns: Fetcher
getLocalDocument
▸ getLocalDocument(uri: NodeRef, aclUri?: NodeRef): TripleDocument
Defined in document.ts:64
Parameters:
| Name | Type |
|---|---|
uri | NodeRef |
aclUri? | NodeRef |
Returns: TripleDocument
getStore
▸ getStore(): IndexedFormula
Defined in store.ts:7
Returns: IndexedFormula
getUpdater
▸ getUpdater(): UpdateManager
Defined in store.ts:15
Returns: UpdateManager
initialiseSubject
▸ initialiseSubject(document: TripleDocument, subjectRef: NodeRef): TripleSubject
Defined in subject.ts:30
Parameters:
| Name | Type |
|---|---|
document | TripleDocument |
subjectRef | NodeRef |
Returns: TripleSubject
isEntity
▸ isEntity(node: NodeRef | Literal | null): boolean
Defined in getEntities.ts:82
Parameters:
| Name | Type |
|---|---|
node | NodeRef | Literal | null |
Returns: boolean
isLiteral
▸ isLiteral<T>(param: T | Literal): boolean
Defined in index.ts:13
Type parameters:
▪ T
Parameters:
| Name | Type |
|---|---|
param | T | Literal |
Returns: boolean
normaliseEntity
▸ normaliseEntity(entity: Node): NodeRef | Literal | null
Defined in getEntities.ts:73
Parameters:
| Name | Type |
|---|---|
entity | Node |
Returns: NodeRef | Literal | null
update
▸ update(statementsToDelete: Statement[], statementsToAdd: Statement[]): Promise<Object>
Defined in store.ts:18
Parameters:
| Name | Type |
|---|---|
statementsToDelete | Statement[] |
statementsToAdd | Statement[] |
Returns: Promise<Object>
Const withDocumentPlural
▸ withDocumentPlural(getEntitiesFromStore: FindEntitiesInStore, document: NodeRef): (Anonymous function)
Defined in document.ts:139
Parameters:
| Name | Type |
|---|---|
getEntitiesFromStore | FindEntitiesInStore |
document | NodeRef |
Returns: (Anonymous function)
Const withDocumentSingular
▸ withDocumentSingular(getEntityFromStore: FindEntityInStore, document: NodeRef): (Anonymous function)
Defined in document.ts:134
Parameters:
| Name | Type |
|---|---|
getEntityFromStore | FindEntityInStore |
document | NodeRef |
Returns: (Anonymous function)
API
Interface: NewSubjectOptions
Hierarchy
- NewSubjectOptions
Index
Properties
Properties
Optional identifier
• identifier? : undefined | string
Defined in document.ts:25
Optional identifierPrefix
• identifierPrefix? : undefined | string
Defined in document.ts:26
API
Interface: TripleDocument
Hierarchy
- TripleDocument
Index
Properties
Properties
addSubject
• addSubject: function
Defined in document.ts:32
Add a subject — note that it is not written to the Pod until explicitly told to
Type declaration:
▸ (options?: NewSubjectOptions): TripleSubject
Parameters:
| Name | Type |
|---|---|
options? | NewSubjectOptions |
findSubject
• findSubject: function
Defined in document.ts:33
Type declaration:
▸ (predicateRef: NodeRef, objectRef: NodeRef): TripleSubject | null
Parameters:
| Name | Type |
|---|---|
predicateRef | NodeRef |
objectRef | NodeRef |
getAcl
• getAcl: function
Defined in document.ts:36
Type declaration:
▸ (): NodeRef | null
getIri
• getIri: function
Defined in document.ts:37
Type declaration:
▸ (): NodeRef
getSubject
• getSubject: function
Defined in document.ts:34
Type declaration:
▸ (subjectRef: NodeRef): TripleSubject
Parameters:
| Name | Type |
|---|---|
subjectRef | NodeRef |
getSubjectsOfType
• getSubjectsOfType: function
Defined in document.ts:35
Type declaration:
▸ (typeRef: NodeRef): TripleSubject[]
Parameters:
| Name | Type |
|---|---|
typeRef | NodeRef |
save
• save: function
Defined in document.ts:38
Type declaration:
▸ (subjects?: TripleSubject[]): Promise<Array<TripleSubject>>
Parameters:
| Name | Type |
|---|---|
subjects? | TripleSubject[] |
API
Interface: TripleSubject
Hierarchy
- TripleSubject
Index
Properties
Properties
add
• add: function
Defined in subject.ts:15
Type declaration:
▸ (predicate: NodeRef, object: NodeRef | Literal): void
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
object | NodeRef | Literal |
get
• get: function
Defined in subject.ts:10
Type declaration:
▸ (predicate: NodeRef): NodeRef | Literal | null
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
getAll
• getAll: function
Defined in subject.ts:13
Type declaration:
▸ (predicate: NodeRef): Array<NodeRef | Literal>
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
getDocument
• getDocument: function
Defined in subject.ts:8
Type declaration:
▸ (): TripleDocument
getIri
• getIri: function
Defined in subject.ts:21
Type declaration:
▸ (): NodeRef
getLiteral
• getLiteral: function
Defined in subject.ts:11
Type declaration:
▸ (predicate: NodeRef): LiteralTypes | null
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
getNodeRef
• getNodeRef: function
Defined in subject.ts:12
Type declaration:
▸ (predicate: NodeRef): NodeRef | null
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
getStatements
• getStatements: function
Defined in subject.ts:9
Type declaration:
▸ (): Statement[]
has
• has: function
Defined in subject.ts:14
Type declaration:
▸ (predicate: NodeRef): boolean
Parameters:
| Name | Type |
|---|---|
predicate | NodeRef |
save
• save: function
Defined in subject.ts:20
Type declaration:
▸ (): Promise<boolean>
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago