%META:TOPICPARENT{name="OATDOCIndex"}%
---+ rdfstore.js
Client-side RDF store. (see [[OATDOCrdfbrowser][RDF Browser]])
%TOC%
---++ 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 byOAT.AJAX.GETfor 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");
CategoryDocumentation CategoryOAT CategoryOpenSource CategoryToBeDone