Skip to content

Commit f013dc8

Browse files
author
Benjamin Forster
committed
Add documentation for new features
1 parent 053205b commit f013dc8

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

readme.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ db.put(triple, function (err) {
3939

4040
Returns an instance of hyper-graph-db. Arguments are passed directly to hyperdb, look at its constructor [API](https://github.com/mafintosh/hyperdb#var-db--hyperdbstorage-key-options) for configuration options.
4141

42+
Extra Options:
43+
```js
44+
{
45+
index: 'hex' || 'tri', // 6 or 3 indices, default 'hex'
46+
name: string, // name that prefixes blank nodes
47+
prefixes: { // an object representing RDF namespace prefixes
48+
[sorthand]: string,
49+
},
50+
}
51+
```
52+
53+
The prefix option can be used to further reduce db size, as it will auto replace namespaced values with their prefered prefix.
54+
55+
For example: `{ vcard: 'http://www.w3.org/2006/vcard/ns#' }` will store `http://www.w3.org/2006/vcard/ns#given-name` as `vcard:given-name`.
56+
57+
**Note:** `index`, `name`, and `prefixes` can only be set when a graph db is first created. When loading an existing graph these values are also loaded from the db.
4258

4359
#### `db.on('ready')`
4460

@@ -65,7 +81,7 @@ Returns a writable stream.
6581

6682
Returns all entries that match the triple. This allows for partial pattern-matching. For example `{ subject: 'a' })`, will return all triples with subject equal to 'a'.
6783

68-
Allowed options:
84+
Options:
6985
```js
7086
{
7187
limit: number, // limit number of triples returned
@@ -178,3 +194,20 @@ db.put([{
178194
#### `var stream = db.searchStream(queries)`
179195

180196
Returns search results as a stream.
197+
198+
#### `db.graphVersion()`
199+
200+
Returns the version of hyper-graph-db that created the db.
201+
202+
#### `db.indexType()`
203+
204+
Returns the type of index which the graph is configured to use: `hex` or `tri`.
205+
206+
#### `db.name()`
207+
208+
Returns the name used for blank nodes when searching the db.
209+
210+
#### `db.prefixes()`
211+
212+
Returns an object representing the RDF prefixes used by the db.
213+

0 commit comments

Comments
 (0)