solid-file-client

A Javascript library for creating and managing files and folders in Solid data stores

View the Project on GitHub jeff-zucker/solid-file-client

solidAPI.rdf

minimal class to query, edit and write rdf files content in N3 store using solid-namespace to access namedNode, literal

Kind: global class

solidAPI.rdf.cache : Object.<string, N3.N3Store>

cache of N3.store : cache[url] is the store of url example :

Kind: instance property of solidAPI.rdf

solidAPI.rdf.setPrefix(prefix, url)

Kind: instance method of solidAPI.rdf

Param Type
prefix string
url string

solidAPI.rdf.getPrefix(prefix) ⇒ string

Kind: instance method of solidAPI.rdf
Returns: string - url

Param Type
prefix string

solidAPI.rdf.query(source, s, p, o, g) ⇒ Array.<N3.Quad>

loads a Turtle file, parses it, returns an array of quads expects URL of a source file, if empty, uses previously loaded file expects Turtle strings for subject, predicate, object, & optional graph supports this non-standard syntax for Turtle strings -

Kind: instance method of solidAPI.rdf

Param Type Description
source string url to the turtle file
s null | string | object subject
p null | string | object predicate
o null | string | object object
g null | string | object graph

solidAPI.rdf.queryTurtle(url, turtle, s, p, o, g) ⇒ Array.<N3.Quad>

Kind: instance method of solidAPI.rdf

Param Type Description
url string of cache[url]
turtle string  
s null | string | object subject
p null | string | object predicate
o null | string | object object
g null | string | object graph

solidAPI.rdf.parseUrl(url) ⇒ cache.url.<N3.store>

fetch url, parse and create cache[url]=N3.store

Kind: instance method of solidAPI.rdf
Returns: cache.url.<N3.store> - store=cache[url]

Param Type
url string

solidAPI.rdf.parse(url, turtle, [options]) ⇒ cache.url.<N3.store>

parse RDF and create cache[url]=N3.store

Kind: instance method of solidAPI.rdf
Returns: cache.url.<N3.store> - store=cache[url]

Param Type Description
url string  
turtle string  
[options] object for N3.parser

Properties

Name Type Description
document options.baseIRI url
allowed options.format RDF format

solidAPI.rdf.addQuad(url, s, p, o, g)

add quad to cache[url] store with special solid syntax

Kind: instance method of solidAPI.rdf

Param Type Description
url string of cache[url]
s null | string | object subject
p null | string | object predicate
o null | string | object object
g null | string | object graph

solidAPI.rdf.removeMatches(url, s, p, o, g)

remove matching quads from cache[url] store using special solid syntax

Kind: instance method of solidAPI.rdf

Param Type Description
url string of cache[url]
s null | string | object subject
p null | string | object predicate
o null | string | object object
g null | string | object graph

solidAPI.rdf.write(url, [options]) ⇒ document.<string>

Write RDF content from cache[url] store with N3.writer using relative notation to baseIRI

Kind: instance method of solidAPI.rdf
Returns: document.<string> - RDF document

Param Type Description
url string : to access cache[url]
[options] object  

Properties

Name Type Description
N3.witer options.format.<string> allowed rdf contentType default ‘text/turtle’
N3.writer options.prefixes.<object> prefixes
one options.prefix.<string> of termType used to build automatic prefixes default ‘predicate’
document options.baseIRI.<string> baseIRI to use relative notation with ‘text/turtle’

solidAPI.rdf.writeQuads(quadsArray, options) ⇒ document.<string>

Write RDF content from regular array of quads

Kind: instance method of solidAPI.rdf
Returns: document.<string> - RDF document

Param Type Description
quadsArray array  
options object for N3.Writer

Properties

Type
options.format
options.prefixes

solidAPI.rdf._getPrefixes(url, options) ⇒ object

get the list of NamedNode prefixes using solidNames for an url or cache[url] store example : list of NamedNode predicates

Kind: instance method of solidAPI.rdf
Returns: object - prefixes

Param Type
url string
options object

Properties

Name Type Description    
‘subject’ ‘predicate’ ‘object’ options.prefix  
excludes options.baseIRI baseIRI from prefixes to allow make relative in write    

solidAPI.rdf._getTermList(type, quadsArray)

List of ‘namedNode’ values for a type of termType

Kind: instance method of solidAPI.rdf

Param Type
type "subject" | "predicate" | "object"
quadsArray array

solidAPI.rdf._makeRelativeUrl(turtle, url) ⇒ string

Make turtle content relative to an url resource

Kind: instance method of solidAPI.rdf
Returns: string - turtle

Param Type Description
turtle string  
url string resource url