0.0.1-master-276197166-b3d74b08 • Published 6 years ago

tripledoc v0.0.1-master-276197166-b3d74b08

Weekly downloads
46
License
MIT
Repository
gitlab
Last release
6 years ago

tripledoc

Read, create and edit Turtle documents on Solid Pods.

Installation

npm install tripledoc

Usage

// TODO

Changelog

See CHANGELOG.

License

MIT © Vincent Tunru

API

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

DeleteStatementsFromStore

Ƭ DeleteStatementsFromStore: function

Defined in deleteStatements.ts:3

Type declaration:

▸ (store: IndexedFormula, updater: UpdateManager, statements: Statement[]): Promise<Statement[]>

Parameters:

NameType
storeIndexedFormula
updaterUpdateManager
statementsStatement[]

FindEntitiesInStore

Ƭ FindEntitiesInStore: function

Defined in getEntities.ts:10

Type declaration:

▸ (store: IndexedFormula, knownEntity1: NodeRef, knownEntity2: NodeRef, document: NodeRef): Array<NodeRef | Literal>

Parameters:

NameType
storeIndexedFormula
knownEntity1NodeRef
knownEntity2NodeRef
documentNodeRef

FindEntityInStore

Ƭ FindEntityInStore: function

Defined in getEntities.ts:4

Type declaration:

▸ (store: IndexedFormula, knownEntity1: NodeRef, knownEntity2: NodeRef, document: NodeRef): NodeRef | Literal | null

Parameters:

NameType
storeIndexedFormula
knownEntity1NodeRef
knownEntity2NodeRef
documentNodeRef

LiteralTypes

Ƭ LiteralTypes: string | number

Defined in index.ts:7


Namespace

Ƭ Namespace: function

Defined in namespace.ts:4

Type declaration:

▸ (identifier: string): NodeRef

Parameters:

NameType
identifierstring

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:

NameType
literalLiteralTypes

Returns: Literal


createDocument

createDocument(ref: NodeRef, statements: Statement[]): Promise<TripleDocument>

Defined in document.ts:15

Initialise a new Turtle document

Parameters:

NameTypeDefaultDescription
refNodeRef-URL where this document should live
statementsStatement[][]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:

NameType
storeIndexedFormula
updaterUpdateManager
statementsStatement[]

Returns: Promise<Statement[]>


fetchDocument

fetchDocument(uri: string): Promise<TripleDocument>

Defined in document.ts:47

Retrieve a document containing RDF triples

Parameters:

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

NameType
subjectRefNodeRef

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:

NameType
storeIndexedFormula
type"subject" | "predicate" | "object"
subjectRefnull | NodeRef
predicateRefnull | NodeRef
objectRefnull | NodeRef
documentNodenull | 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:

NameType
storeIndexedFormula
type"subject" | "predicate" | "object"
subjectRefnull | NodeRef
predicateRefnull | NodeRef
objectRefnull | NodeRef
documentNodenull | 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:

NameType
storeIndexedFormula
subjectRefstring
predicateRefstring
documentNodestring

Returns: null | string | Literal


Const findObjectsInStore

findObjectsInStore(store: IndexedFormula, subjectRef: string, predicateRef: string, documentNode: string): string | Literal[]

Defined in getEntities.ts:34

Parameters:

NameType
storeIndexedFormula
subjectRefstring
predicateRefstring
documentNodestring

Returns: string | Literal[]


Const findPredicateInStore

findPredicateInStore(store: IndexedFormula, subjectRef: string, objectRef: string, documentNode: string): null | string | Literal

Defined in getEntities.ts:24

Parameters:

NameType
storeIndexedFormula
subjectRefstring
objectRefstring
documentNodestring

Returns: null | string | Literal


Const findPredicatesInStore

findPredicatesInStore(store: IndexedFormula, subjectRef: string, objectRef: string, documentNode: string): string | Literal[]

Defined in getEntities.ts:27

Parameters:

NameType
storeIndexedFormula
subjectRefstring
objectRefstring
documentNodestring

Returns: string | Literal[]


Const findSubjectInStore

findSubjectInStore(store: IndexedFormula, predicateRef: string, objectRef: string, documentNode: string): null | string | Literal

Defined in getEntities.ts:17

Parameters:

NameType
storeIndexedFormula
predicateRefstring
objectRefstring
documentNodestring

Returns: null | string | Literal


Const findSubjectsInStore

findSubjectsInStore(store: IndexedFormula, predicateRef: string, objectRef: string, documentNode: string): string | Literal[]

Defined in getEntities.ts:20

Parameters:

NameType
storeIndexedFormula
predicateRefstring
objectRefstring
documentNodestring

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:

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

NameType
uriNodeRef
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:

NameType
documentTripleDocument
subjectRefNodeRef

Returns: TripleSubject


isEntity

isEntity(node: NodeRef | Literal | null): boolean

Defined in getEntities.ts:82

Parameters:

NameType
nodeNodeRef | Literal | null

Returns: boolean


isLiteral

isLiteral<T>(param: T | Literal): boolean

Defined in index.ts:13

Type parameters:

T

Parameters:

NameType
paramT | Literal

Returns: boolean


normaliseEntity

normaliseEntity(entity: Node): NodeRef | Literal | null

Defined in getEntities.ts:73

Parameters:

NameType
entityNode

Returns: NodeRef | Literal | null


update

update(statementsToDelete: Statement[], statementsToAdd: Statement[]): Promise<Object>

Defined in store.ts:18

Parameters:

NameType
statementsToDeleteStatement[]
statementsToAddStatement[]

Returns: Promise<Object>


Const withDocumentPlural

withDocumentPlural(getEntitiesFromStore: FindEntitiesInStore, document: NodeRef): (Anonymous function)

Defined in document.ts:139

Parameters:

NameType
getEntitiesFromStoreFindEntitiesInStore
documentNodeRef

Returns: (Anonymous function)


Const withDocumentSingular

withDocumentSingular(getEntityFromStore: FindEntityInStore, document: NodeRef): (Anonymous function)

Defined in document.ts:134

Parameters:

NameType
getEntityFromStoreFindEntityInStore
documentNodeRef

Returns: (Anonymous function)

API

NewSubjectOptions /

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

TripleDocument /

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:

NameType
options?NewSubjectOptions

findSubject

findSubject: function

Defined in document.ts:33

Type declaration:

▸ (predicateRef: NodeRef, objectRef: NodeRef): TripleSubject | null

Parameters:

NameType
predicateRefNodeRef
objectRefNodeRef

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:

NameType
subjectRefNodeRef

getSubjectsOfType

getSubjectsOfType: function

Defined in document.ts:35

Type declaration:

▸ (typeRef: NodeRef): TripleSubject[]

Parameters:

NameType
typeRefNodeRef

save

save: function

Defined in document.ts:38

Type declaration:

▸ (subjects?: TripleSubject[]): Promise<Array<TripleSubject>>

Parameters:

NameType
subjects?TripleSubject[]

API

TripleSubject /

Interface: TripleSubject

Hierarchy

  • TripleSubject

Index

Properties

Properties

add

add: function

Defined in subject.ts:15

Type declaration:

▸ (predicate: NodeRef, object: NodeRef | Literal): void

Parameters:

NameType
predicateNodeRef
objectNodeRef | Literal

get

get: function

Defined in subject.ts:10

Type declaration:

▸ (predicate: NodeRef): NodeRef | Literal | null

Parameters:

NameType
predicateNodeRef

getAll

getAll: function

Defined in subject.ts:13

Type declaration:

▸ (predicate: NodeRef): Array<NodeRef | Literal>

Parameters:

NameType
predicateNodeRef

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:

NameType
predicateNodeRef

getNodeRef

getNodeRef: function

Defined in subject.ts:12

Type declaration:

▸ (predicate: NodeRef): NodeRef | null

Parameters:

NameType
predicateNodeRef

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:

NameType
predicateNodeRef

save

save: function

Defined in subject.ts:20

Type declaration:

▸ (): Promise<boolean>

4.4.0

5 years ago

4.3.4

6 years ago

4.3.3

6 years ago

4.3.2

6 years ago

4.3.1

6 years ago

4.3.0

6 years ago

4.2.3

6 years ago

4.2.2

6 years ago

4.2.1

6 years ago

4.2.0

6 years ago

4.1.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.1.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago