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> - .setPrefix(prefix, url)
- .getPrefix(prefix) ⇒
string - .query(source, s, p, o, g) ⇒
Array.<N3.Quad> - .queryTurtle(url, turtle, s, p, o, g) ⇒
Array.<N3.Quad> - .parseUrl(url) ⇒
cache.url.<N3.store> - .parse(url, turtle, [options]) ⇒
cache.url.<N3.store> - .addQuad(url, s, p, o, g)
- .removeMatches(url, s, p, o, g)
- .write(url, [options]) ⇒
document.<string> - .writeQuads(quadsArray, options) ⇒
document.<string> - ._getPrefixes(url, options) ⇒
object - ._getTermList(type, quadsArray)
- ._makeRelativeUrl(turtle, url) ⇒
string
- .cache :
cache of N3.store : cache[url] is the store of url example :
- to add a quadsArray to the store : cache[url].addQuads(quadsArray)
- all N3 store functions can be used
Kind: instance property of solidAPI.rdf
Kind: instance method of solidAPI.rdf
| Param | Type |
|---|---|
| prefix | string |
| url | string |
Kind: instance method of solidAPI.rdf
Returns: string - url
| Param | Type |
|---|---|
| prefix | string |
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 -
- {somePrefix:someTerm} somePrefix is then replaced using URLs from solid-namespace the special prefix thisDoc {thisDoc:me} uses current doc as namespace
- N3 quad subject, predicate, object and optional graph
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 |
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 |
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 |
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 |
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 |
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 |
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' |
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 |
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' |
| excludes | options.baseIRI |
baseIRI from prefixes to allow make relative in write |
List of 'namedNode' values for a type of termType
Kind: instance method of solidAPI.rdf
| Param | Type |
|---|---|
| type | "subject" | "predicate" | "object" |
| quadsArray | array |
Make turtle content relative to an url resource
- make absolute paths relative to document
Kind: instance method of solidAPI.rdf
Returns: string - turtle
| Param | Type | Description |
|---|---|---|
| turtle | string |
|
| url | string |
resource url |