Index | OAT homepage | OpenLink Software

# OATDOCrdfstore

- OATDOCrdfstore
- _ _ rdfstore.js
- _ _ _ _ Objects
- _ _ _ _ _ _ OAT.RDFStore(callback, options)
- _ _ _ _ Properties
- _ _ _ _ _ _ OAT.RDFStore::data.triples
- _ _ _ _ _ _ OAT.RDFStore::data.all
- _ _ _ _ _ _ OAT.RDFStore::data.structured
- _ _ _ _ Methods
- _ _ _ _ _ _ OAT.RDFStore::addURL(url, onstart, onend)
- _ _ _ _ _ _ OAT.RDFStore::addTriples(triplesArray, url)
- _ _ _ _ _ _ OAT.RDFStore::addXmlDoc(xmlDoc, url)
- _ _ _ _ _ _ OAT.RDFStore::getTitle(itemReference)
- _ _ _ _ _ _ OAT.RDFStore::simplify(string)
- _ _ _ _ _ _ OAT.RDFStore::addFilter(type, value1, [value2])
- _ _ _ _ _ _ OAT.RDFStore::removeFilter(type, value1, [value2])
- _ _ _ _ _ _ OAT.RDFStore::disable(url)
- _ _ _ _ _ _ OAT.RDFStore::enable(url)
- _ _ _ _ Constants
- _ _ _ _ _ _ OAT.RDFStoreData.FILTER_PROPERTY
- _ _ _ _ _ _ OAT.RDFStoreData.FILTER_URI
- _ _ _ _ CSS IDs
- _ _ _ _ _ _ rdf_side
- _ _ _ _ _ _ rdf_cache
- _ _ _ _ _ _ rdf_filter
- _ _ _ _ _ _ rdf_tabs
- _ _ _ _ _ _ rdf_content
- _ _ _ _ Examples
- _ _ _ _ _ _ Example 1
- _ _ _ _ _ _ Example 2

## rdfstore.js

Client-side RDF store. (see RDF Browser )

### Objects

#### OAT.RDFStore(callback, options)

Creates the object. Argument `callback` is executed every time store's contents change. Available `options` (properties of options object) are:

- `ajaxStart` - function to be executed when dereferencing starts
- `ajaxEnd` - function to be executed when dereferencing stops

### Properties

#### OAT.RDFStore::data.triples

All loaded data in a big array of triples (array of arrays).

#### OAT.RDFStore::data.all

All loaded data in a complex JSON object, as shown in the Example.

#### OAT.RDFStore::data.structured

Loaded data after filters have been applied. Same structure as `data.all` .

### Methods

#### OAT.RDFStore::addURL(url, onstart, onend)

Dereferences `url` and adds its contents to store. `onstart` and `onend` arguments are used to override global `ajaxStart` and `ajaxEnd` parameters, respectively.

#### OAT.RDFStore::addTriples(triplesArray, url)

Adds an array of triples (triplesArray) to storage. The `url` specifies the address where these triples originate.

#### OAT.RDFStore::addXmlDoc(xmlDoc, url)

Adds an XML document ( `xmlDoc` , fetched by `OAT.AJAX.GET` for instance) to storage. The `url` specifies the address where this document originates.

#### OAT.RDFStore::getTitle(itemReference)

Returns a reasonable title (falls back to URI) of an item in storage.

#### OAT.RDFStore::simplify(string)

Simplifies an URI by removing as much as possible (leaving the part after '#' or '/').

#### OAT.RDFStore::addFilter(type, value1, [value2])

Applies a pass filter to store contents. Filter type is specified as one of available constants.
For `FILTER_PROPERTY` , both 2nd and 3rd arguments should be used: these specify `predicate value` and `object value` (only resources having this P and O will pass).

For `FILTER_URI` , only 2nd argument should be used: this `value` specifies an URI to be filtered (only resources having this URI as O or S will pass).

#### OAT.RDFStore::removeFilter(type, value1, [value2])

Removes a previously set filter; syntax is the same as in `addFilter` .

#### OAT.RDFStore::disable(url)

Temporarily disables (removes) all triples originating from `URL` from the store. URL must be dereferenced.

#### OAT.RDFStore::enable(url)

Re-enables previously disabled `URL` , so its contents are loaded in a store. URL must be dereferenced.

### Constants

#### OAT.RDFStoreData.FILTER_PROPERTY

ToBeDone

#### OAT.RDFStoreData.FILTER_URI

ToBeDone

### CSS IDs

#### rdf_side

ToBeDone

#### rdf_cache

ToBeDone

#### rdf_filter

ToBeDone

#### rdf_tabs

ToBeDone

#### rdf_content

ToBeDone

### Examples

#### Example 1

    [
        {
            preds:{
                "http://www.w3.org/1999/02/22-rdf-syntax-ns#type":[
                    "http://www.w3.org/2000/10/swap/pim/contact#Male",
                    "http://xmlns.com/foaf/0.1/Person"
                ],
                "http://www.w3.org/2000/01/rdf-schema#label":["Tim Berners-Lee"],
                "http://www.w3.org/2000/10/swap/pim/contact#assistant":[{...}],
                "http://www.w3.org/2000/10/swap/pim/contact#homePage":["./"],
                "http://www.w3.org/2000/10/swap/pim/contact#office":[{...}]
            },
            ouri:"samples/tbl.xml",
            type:"http://xmlns.com/foaf/0.1/PersonalProfileDocument",
            uri:"_:832_0",
            back:[{...}]
        },
        ...
    ]

#### Example 2

    var callback = function() {
        alert("Store contents have changed, check them out!");
    }
    var store = new OAT.RDFStore(callback, {});
    store.addURL("myRDF.n3");

Copyright (C) 2005-2008 OpenLink Software