README.rdoc in redlander-0.4.0 vs README.rdoc in redlander-0.5.0
- old
+ new
@@ -57,10 +57,24 @@
$ m.statements.first.subject # => (Redlander::Node)
Please refer to Redlander::Node API doc for details.
+You can also use different query languages supported by librdf ("SPARQL 1.0" being a default):
+
+ $ m.query("SELECT ?s ?p ?o WHERE {}") # => [{"s" => ..., "p" => ..., "o" => ...}, ...]
+
+"ASK" queries return true/false, "SELECT" queries return arrays of binding hashes,
+"CONSTRUCT" queries return an instance of a new memory-based model comprised from
+the statements constructed by the query.
+You can also supply a block to Model#query, which is ignored by ASK queries, but
+yields the statements constructed by CONSTRUCT queries and yields the binding
+hash for SELECT queries. Binding hash values are instances of Redlander::Node.
+
+For query options and available query languages refer to Model#query documentation.
+
+
== Parsing Input
You can fill your model with statements by parsing some external sources like plain or streamed data.
$ data = File.read("data.xml")
@@ -70,10 +84,10 @@
$ source = URI("http://example.com/data.nt")
$ m.from(source, :format => "ntriples")
If you want to get the data from a local file, you can use "file://" schema for your URI
-(or Redlander::Uri) or use "from_file" method with a local file name (without schema):
+or use "from_file" method with a local file name (without schema):
$ m.from_file("../data.ttl", :format => "turtle")
Most frequently used parsing methods are aliased to save you some typing:
"from_rdfxml", "from_ntriples", "from_turtle", "from_uri/from_file".