All operations revolve around the concept of a "triple". A triple is intended to model the concept of a object with a property value. It consists of
The triple is written using the predicate logic syntax : (<subject> <predicate> <object>).
A collection of triples forms a database. There are no constraints on the set of triples that constitutes the database. (Some other RDF implementation refer to the concept of database as a "model").
Database Operations are divided into the following categories:
The available file types are RDF_XML, RSS, NTRIPLES and TURTLE. Please note that the current RSS support is most likely different from the old RSS support, see the Raptor site for more details.
e.g., load rdf_xml <http://dmoz.org/rdf/structure.rdf> into dmoz </>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dmoz="http://dmoz.org/rdf"> <rdf:Description rdf:about="http://dmoz.org/Auto/CarSeats"> <dmoz:relatedTo rdf:resource="http://dmoz.org/Children/Safety"/> </rdf:Description> </rdf:RDF>The triple that is added to the database is
(http://dmoz.org/rdf#relatedTo http://dmoz.org/Auto/CarSeats http://dmoz.org/Children/Safety)In order to simplify the statement of queries, one can set a namespace prefix to correspond to a namespace uri.
Variables are syntactically designated by symbols starting with the character '?'. e.g., ?name, ?foo.
A constraint is of the form (arc-label source target) where any one or more of arc-label, source or target can be a variable or resource and in the case of the target, also an integer or string. The same variable can appear in multiple constraints.
e.g., select ?x ?y from dmoz where (title ?x ?y), (createdBy ?x RichSkrenta), (type ?x Topic)
List the id's and titles of all objects of type Topic created by RichSkrenta.
The query can optionally specify the output format by adding output {output-format} to the query. The supported output formats are "tab-limited" and "variable-list". I hope to add "javascript" and "rdf-xml" as supported output formats. The default is "tab-limited".
Result structure: The result contains zero or more lines of answers followed by the
result code line. The syntax of the answer line depends on the chosen
output format. In the case of the "variable-list" format (the default), there is one line
per variable binding set which has the syntax
variable1=value1TABvariable2=value2...
In the case of "tab-limited", there is one line with tab-separated variable names,
and all following lines are variable values set which has the syntax
value1TABvalue2...
where the order of the values is in the order of the variables in the query.
Please note that EACH value is followed by a tab (that includes the last value).
The Win32 port allows optional triples, these are specified by preceding a constraint triple with a questionmark, like this (note the questionmark in front of the second triple):
select ?x ?y from test1 where (?x <worksFor> <W3C>) ?(?x <name> ?y) </>By using this RDFDB will return all resources with worksFor property value of W3C, in addition to their names if they have one (if they don't RDFDB will return nothing, although it will still output a tab). A possible output would be:
?x[TAB]?y[TAB] <DanB>[TAB]"Dan Brickley"[TAB] <DanC>[TAB][TAB] #0
Result Codes: