API Docs for:
Show:

Triplestore Class

Triplestore wrapper for HTML5 WebStorage.

Constructor

Triplestore

()

Methods

add

(
  • subject
  • property
  • value
)

Add a triple to localStorage. If the property has already values, the new value is concatenated to them.

Parameters:

  • subject String

    subject

  • property String

    property

  • value String

    value

Example:

st.add("http://sample.org/bob", "foaf:name", "Bob");

getProjection

(
  • subject
)
Projection

Retrieves a Projection given a subject

Parameters:

  • subject String

    subject

Returns:

Projection: projection

Example:

st.getProjection("http://sample.org/bob");

getProperties

(
  • [subject]
)
Array

Retrieves a list of DOMStrings which are IRI identifiers for properties given an optional subject to match against.

Parameters:

  • [subject] String optional

    subject

Returns:

Array: Sequence<DOMString>

Example:

st.getProperties("http://sample.org/bob");

getSubjects

(
  • [property]
  • [value]
)
Array

Retrieves a list of DOMStrings which are IRI identifiers for subjects given an optional property and value to match against.

Parameters:

  • [property] String optional

    property

  • [value] String optional

    value

Returns:

Array: Sequence<DOMString>

Example:

st.getSubjects("foaf:name", "Bob");

getValues

(
  • [subject]
  • [property]
)
Array

Retrieves a list of mixed types given an optional subject and property to match against.

Parameters:

  • [subject] String optional

    subject

  • [property] String optional

    property

Returns:

Array: Sequence<any>

Example:

st.getValues("http://sample.org/bob", "foaf:name");

remove

(
  • [subject]
  • [property]
)

Remove an subject or a property from internal storage to match against.

Parameters:

  • [subject] String optional

    subject

  • [property] String optional

    property

Example:

st.remove("http://sample.org/bob", "foaf:name");

set

(
  • subject
  • property
  • value
)

Set a triple to localStorage. The old value of the property is overwritten.

Parameters:

  • subject String

    subject

  • property String

    property

  • value String

    value

Example:

st.set("http://sample.org/bob", "foaf:name", "Bob");

setMapping

(
  • mapping
  • iri
)

Sets a mapping given a mapping and a URI to map.

Parameters:

  • mapping String

    mapping

  • iri String

    iri

Example:

st.setMapping("foaf", "http://xmlns.com/foaf/0.1/");

show

()

Print the content of the storage.