Name
DB.DBA.RDF_TRIPLES_TO_TTL — Serializes vector of triples into a session, in TURTLE syntax.
Synopsis
DB.DBA.RDF_TRIPLES_TO_TTL
(
|
inout triples any , |
inout
ses
any
) ; |
Description
Serializes vector of triples into a session, in TURTLE syntax. In current version, every triple is printed in separate top-level record (say, in rdf:Description tag), without any pretty-print or nesting optimization.
Parameters
triples
vector of triples in 'long valmode'.
ses
an output stream in server default encoding
Examples
Example 24.271. Simple example
SQL>create procedure RDFXML2N3 (in _rdfxml varchar) { declare triples, ses any; declare STRG varchar; result_names (STRG); delete from RDF_QUAD where G=DB.DBA.RDF_MAKE_IID_OF_QNAME ('http://fake.example.org/graph/'); DB.DBA.RDF_LOAD_RDFXML_MT (_rdfxml, 'http://fake.example.org/base/', 'http://fake.example.org/graph/' ); for (sparql define output:valmode "LONG" select ?s ?p ?o where { graph <http://fake.example.org/graph/> { ?s ?p ?o } } order by ?s ?p ?o) do { ses := string_output (); DB.DBA.RDF_TRIPLES_TO_TTL (vector (vector ("s", "p", "o")), ses); result (sprintf ('%s\t%d %d', replace (string_output_string (ses), '\n', ' '), rdf_box_type ("o"), rdf_box_data_tag ("o"))); } } Done. -- 0 msec. SQL>RDFXML2N3(' <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"> <ex:editor> <rdf:Description> <ex:fullName>Dave Beckett</ex:fullName> </rdf:Description> </ex:editor> </rdf:Description> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"> <ex:editor> <rdf:Description> <ex:homePage> <rdf:Description rdf:about="http://purl.org/net/dajobe/"> </rdf:Description> </ex:homePage> </rdf:Description> </ex:editor> </rdf:Description> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"> <dc:title>RDF/XML Syntax Specification (Revised)</dc:title> </rdf:Description> </rdf:RDF>') STRG VARCHAR _______________________________________________________________________________ <http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:b1000010000 . 257 243 <http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:b1000010001 . 257 243 <http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)". 257 182 _:b1000010000 <http://example.org/stuff/1.0/fullName> "Dave Beckett" . 257 182 _:b1000010001 <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> . 257 243 5 Rows. -- 0 msec.