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 : (<arc-label> <object> <property-value>).
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 (version 0.91) and DMOZ_RDF. RSS 1.0 is just RDF. DMOZ_RDF is provided because the DMOZ_RDF dump is not technically correct RDF.
e.g., load DMOZ_RDF file 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.
Result Codes:
telnet 209.157.132.197 7001 Connected to govinda.guha.meer.net (209.157.132.197). Escape character is '^]'. create database test1 </> 0 </> insert into test1 (type DanB Person), (name DanB 'Dan Brickley') </> 0 </> insert into test1 (worksFor DanB W3C) (worksFor DanC W3C) </> 0 </> insert into test1 (name DanC 'Dan Connolly') </> 0 </> select ?x from test1 where (worksFor ?x W3C) (name ?x ?y) output variable-list </> ?x = DanC ?y = 'Dan Connolly' ?x = DanB ?y = 'Dan Brickley' 0 </> <quit>Here is a simple www front end browser for the dmoz hierarchy based on rdfDB DBI. Here is the code behind that.