Skip to content

Instantly share code, notes, and snippets.

@dajobe
Created November 5, 2011 21:03
Show Gist options
  • Save dajobe/1342019 to your computer and use it in GitHub Desktop.
Save dajobe/1342019 to your computer and use it in GitHub Desktop.
Test that TSV can be generated from librdf
diff --git a/examples/example8.c b/examples/example8.c
index 408da74..62108da 100644
--- a/examples/example8.c
+++ b/examples/example8.c
@@ -96,8 +96,9 @@ main(int argc, char *argv[])
if(librdf_query_results_is_bindings(results) ||
librdf_query_results_is_boolean(results)) {
- string = librdf_query_results_to_counted_string2(results, format,
- NULL, NULL, NULL, &length);
+ librdf_uri* format_uri = librdf_new_uri(world, (const unsigned char*)format);
+ string = librdf_query_results_to_counted_string2(results, NULL,
+ NULL, format_uri, NULL, &length);
if(!string) {
fprintf(stderr, "%s: Failed to turn query results to format '%s'\n",
program, format);
$ cd examples
$ make example8
...
$ ./example8 file:../redland.rdf http://www.w3.org/ns/formats/SPARQL_Results_TSV 'select * WHERE { ?s ?p ?o }' 2>/dev/null
?s ?p ?o
_:r1320526985r28312r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#name> "Redland librdf RDF API Library"
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#homepage> <http://librdf.org/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#created> "2000-06-21"
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#shortdesc> "\n A library for the Resource Description Framework (RDF) allowing\n it to be parsed from XML, stored, queried and manipulated.\n "@en
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#description> "\n Redland librdf is a library that provides a high-level\n interface for the Resource Description Framework (RDF) allowing\n the RDF graph to be parsed from XML, stored, queried and\n manipulated. Redland librdf implements each of the RDF\n concepts in its own class via an object based API, reflected\n into the language APIs, currently C#, Java, Perl, PHP, Python,\n Ruby and Tcl. Several classes providing functionality such as\n for parsers, storage are built as modules that can be loaded at\n compile or run-time as required.\n "@en
_:r1320526985r28312r2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>
_:r1320526985r28312r2 <http://xmlns.com/foaf/0.1/name> "Dave Beckett"
_:r1320526985r28312r2 <http://xmlns.com/foaf/0.1/homepage> <http://www.dajobe.org/>
_:r1320526985r28312r2 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "970987f991961f2553a1bf2574166fa29befbccb"
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#maintainer> _:r1320526985r28312r2
_:r1320526985r28312r3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Version>
_:r1320526985r28312r3 <http://usefulinc.com/ns/doap#name> "stable"
_:r1320526985r28312r3 <http://usefulinc.com/ns/doap#created> "2011-01-22"
_:r1320526985r28312r3 <http://usefulinc.com/ns/doap#revision> "1.0.15"
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#release> _:r1320526985r28312r3
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#mailing-list> <http://lists.usefulinc.com/mailman/listinfo/redland-dev>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#mailing-list> <http://lists.usefulinc.com/mailman/listinfo/redland-announce>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#mailing-list> <http://lists.usefulinc.com/mailman/listinfo/redland-commits>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#download-page> <http://download.librdf.org/sources/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#download-mirror> <http://sourceforge.net/projects/librdf/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://software.freshmeat.net/browse/67/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://software.freshmeat.net/browse/93/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://software.freshmeat.net/browse/809/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://software.freshmeat.net/browse/810/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://software.freshmeat.net/browse/868/>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#category> <http://sourceforge.net/softwaremap/trove_list.php?form_cat=237>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#license> <http://usefulinc.com/doap/licenses/gpl>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#license> <http://usefulinc.com/doap/licenses/lgpl>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#license> <http://usefulinc.com/doap/licenses/asl20>
_:r1320526985r28312r4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#GitRepository>
_:r1320526985r28312r4 <http://usefulinc.com/ns/doap#anon-root> "git://github.com/dajobe/librdf.git"
_:r1320526985r28312r4 <http://usefulinc.com/ns/doap#module> "librdf"
_:r1320526985r28312r4 <http://usefulinc.com/ns/doap#browse> <https://github.com/dajobe/librdf>
_:r1320526985r28312r1 <http://usefulinc.com/ns/doap#repository> _:r1320526985r28312r4
_:r1320526985r28312r5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>
_:r1320526985r28312r5 <http://xmlns.com/foaf/0.1/name> "Dave Beckett"
_:r1320526985r28312r5 <http://xmlns.com/foaf/0.1/homepage> <http://www.dajobe.org/>
_:r1320526985r28312r5 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "970987f991961f2553a1bf2574166fa29befbccb"
<file:../redland.rdf> <http://xmlns.com/foaf/0.1/maker> _:r1320526985r28312r5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment