Class jQuery.rdf.databank
Represents a triplestore, holding a bunch of jQuery.rdf.triples.
Defined in: jquery.rdf.js.
Constructor Attributes | Constructor Name and Description |
---|---|
jQuery.rdf.databank(triples, options)
Creates a new jQuery.rdf.databank object. |
Method Attributes | Method Name and Description |
---|---|
add(triple, options)
Adds a triple to the jQuery.rdf.databank or another jQuery.rdf.databank object to create a union.
|
|
base(base)
Sets or returns the base URI of the jQuery.rdf.databank.
|
|
describe(resources)
Provides simple concise bounded descriptions of the resources that are passed in the argument.
|
|
dump(options)
Dumps the triples in the databank into a format that can be shown to the user or sent to a server.
|
|
except(data)
Creates a new databank containing all the triples in this jQuery.rdf.databank except those in the jQuery.rdf.databank passed as the argument.
|
|
load(data, opts)
Loads some data into the databank.
|
|
prefix(prefix, namespace)
Sets or returns a namespace binding on the jQuery.rdf.databank.
|
|
remove(triple, options)
Removes a triple from the jQuery.rdf.databank.
|
|
size()
Tells you how many triples the databank contains.
|
|
toString()
Provides a string representation of the databank which simply specifies how many triples it contains.
|
|
triples()
Provides a jQuery object containing the triples held in this jQuery.rdf.databank.
|
Class Detail
jQuery.rdf.databank(triples, options)
Creates a new jQuery.rdf.databank object. This should be invoked as a method rather than constructed using new; indeed you will not usually want to generate these objects directly, but manipulate them through a jQuery.rdf object.
- Parameters:
- {(String|jQuery.rdf.triple)[]} triples Optional, Default: []
- An array of triples to store in the databank.
- {Object} options Optional
- Initialisation of the databank.
- {Object} options.namespaces Optional
- An object representing a set of namespace bindings used when interpreting the CURIEs in strings representing triples. Rather than passing this in when you construct the jQuery.rdf.databank instance, you will usually want to use the jQuery.rdf.databank#prefix method.
- {String|jQuery.uri} options.base Optional
- The base URI used to interpret any relative URIs used within the strings representing triples.
- Returns:
- {jQuery.rdf.databank} The newly-created databank.
- See:
- jQuery.rdf
Method Detail
{jQuery.rdf.databank}
add(triple, options)
Adds a triple to the jQuery.rdf.databank or another jQuery.rdf.databank object to create a union.
- Parameters:
- {String|jQuery.rdf.triple|jQuery.rdf.databank} triple
- The triple or jQuery.rdf.databank object to be added to this one. If the triple is a jQuery.rdf.databank object, the two databanks are unioned together. If the triple is a string, it's parsed as a jQuery.rdf.triple.
- {Object} options Optional
- {Object} options.namespaces Optional
- An object representing a set of namespace bindings used to interpret CURIEs within the triple. Defaults to the namespace bindings defined on the jQuery.rdf.databank.
- {String|jQuery.uri} options.base Optional
- The base URI used to interpret any relative URIs used within the triple. Defaults to the base URI defined on the jQuery.rdf.databank.
- {Integer} options.depth Optional
- The number of links to traverse to gather more information about the subject, property and object of the triple.
- Returns:
- {jQuery.rdf.databank} This jQuery.rdf.databank object.
- See:
- jQuery.rdf#add
base(base)
Sets or returns the base URI of the jQuery.rdf.databank.
- Parameters:
- {String|jQuery.uri} base Optional
- Returns:
- A jQuery.uri if no base URI is specified, otherwise returns this jQuery.rdf.databank object.
- See:
- jQuery.rdf#base
{jQuery}
describe(resources)
Provides simple concise bounded descriptions of the resources that are passed in the argument. This mirrors the DESCRIBE form in SPARQL.
- Parameters:
- {(String|jQuery.rdf.resource)[]} resources
- An array that can contain strings, jQuery.rdf.resources or a mixture of the two.
- Returns:
- {jQuery} A jQuery object holding the jQuery.rdf.triples that describe the listed resources.
- See:
- jQuery.rdf#describe
{Object|Node|String}
dump(options)
Dumps the triples in the databank into a format that can be shown to the user or sent to a server.
- Parameters:
- {Object} options Optional
- Options that control the formatting of the triples. See jQuery.rdf.dump for details.
- Returns:
- {Object|Node|String}
- See:
- jQuery.rdf.dump
{jQuery.rdf.databank}
except(data)
Creates a new databank containing all the triples in this jQuery.rdf.databank except those in the jQuery.rdf.databank passed as the argument.
var old = $('html').rdf().databank; ...some processing occurs... var new = $('html').rdf().databank; var added = new.except(old); var removed = old.except(new);
- Parameters:
- {jQuery.rdf.databank} data
- The other jQuery.rdf.databank
- Returns:
- {jQuery.rdf.databank} A new jQuery.rdf.databank containing the triples in this jQuery.rdf.databank except for those in the data parameter.
{jQuery.rdf.databank}
load(data, opts)
Loads some data into the databank.
- Parameters:
- {Node|Object|String} data
- If the data is a string and starts with 'http://' then it's taken to be a URI and data is loaded from that URI via the proxy specified in the options. If it doesn't start with 'http://' then it's taken to be a serialized version of some format capable of representing RDF, parsed and interpreted. If the data is a node, it's interpreted to be an RDF/XML syntax document and will be parsed as such. Otherwise, it's taken to be a RDF/JSON object.
- {Object} opts
- Options governing the loading of the data.
- {String} opts.format Optional
- The mime type of the format the data is in, particularly useful if you're supplying the data as a string. If unspecified, the data will be sniffed to see if it might be HTML, RDF/XML, RDF/JSON or Turtle.
- {boolean} opts.async Optional, Default: true
- When loading data from a URI, this determines whether it will be done synchronously or asynchronously.
- {Function} opts.success Optional
- When loading data from a URI, a function that will be called after the data is successfully loaded.
- {Function} opts.error Optional
- When loading data from a URI, a function that will be called if there's an error when accessing the URI.
- {String} opts.proxy Optional, Default: 'http://www.jenitennison.com/rdfquery/proxy.php'
- The URI for a server-side proxy through which the data can be accessed. This does not have to be hosted on the same server as this Javascript, the HTML page or the remote data. The proxy must accept id, url and depth parameters and respond with some Javascript that will invoke the jQuery.rdf.databank.load function. Example proxies that do the right thing are available. If you are intending to use this facility a lot, please do not use the default proxy.
- {integer} opts.depth Optional, Default: 0
- Triggers recursive loading of located resources, to the depth specified. This is useful for automatically populating a databank with linked data.
- Returns:
- {jQuery.rdf.databank} The jQuery.rdf.databank itself.
- See:
- jQuery.rdf#load
{Object|jQuery.uri|jQuery.rdf}
prefix(prefix, namespace)
Sets or returns a namespace binding on the jQuery.rdf.databank.
- Parameters:
- {String} prefix Optional
- {String} namespace Optional
- Returns:
- {Object|jQuery.uri|jQuery.rdf} If no prefix or namespace is specified, returns an object providing all namespace bindings on the jQuery.rdf#databank. If a prefix is specified without a namespace, returns the jQuery.uri associated with that prefix. Otherwise returns this jQuery.rdf object after setting the namespace binding.
- See:
- jQuery.rdf#prefix
{jQuery.rdf.databank}
remove(triple, options)
Removes a triple from the jQuery.rdf.databank.
- Parameters:
- {String|jQuery.rdf.triple} triple
- The triple to be removed.
- {Object} options Optional
- {Object} options.namespaces Optional
- An object representing a set of namespace bindings used to interpret any CURIEs within the triple. Defaults to the namespace bindings defined on the jQuery.rdf.databank.
- {String|jQuery.uri} options.base Optional
- The base URI used to interpret any relative URIs used within the triple. Defaults to the base URI defined on the jQuery.rdf.databank.
- Returns:
- {jQuery.rdf.databank} The jQuery.rdf.databank object itself.
- See:
- jQuery.rdf#remove
{Integer}
size()
Tells you how many triples the databank contains.
$('html').rdf().databank.size();
- Returns:
- {Integer} The number of triples in the jQuery.rdf.databank.
{String}
toString()
Provides a string representation of the databank which simply specifies how many triples it contains.
- Returns:
- {String}
{jQuery}
triples()
Provides a jQuery object containing the triples held in this jQuery.rdf.databank.
- Returns:
- {jQuery} A jQuery object containing jQuery.rdf.triple objects.