relpipe-data/examples-rdf-sparql.xml
author František Kučera <franta-hg@frantovo.cz>
Tue, 04 Aug 2020 00:58:46 +0200
branchv_0
changeset 312 0a65e49a076f
parent 310 aeda3cb4528d
permissions -rw-r--r--
examples: Querying an RDF triplestore using SPARQL: @id for the turtle part
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
310
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
<stránka
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
	
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
	<nadpis>Querying an RDF triplestore using SPARQL</nadpis>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
	<perex>use SQL-DK with Jena JDBC driver or a custom script to gather linked data</perex>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
	<m:pořadí-příkladu>04300</m:pořadí-příkladu>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
	<text xmlns="http://www.w3.org/1999/xhtml">
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
			In the Resource Description Framework (<a href="https://www.w3.org/RDF/">RDF</a>) world, there are no relations.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
			The data model is quite different.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
			It is built on top of triples: subject – predicate – object.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
			Despite there are no tables (compared to relational databases), RDF is not a schema-less clutter – 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
			actually RDF has a schema (ontology, vocabulary), just differently shaped.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
			Subjects and predicates are identified by <a href="https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier">IRI</a>s
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
			(or formerly <a href="https://en.wikipedia.org/wiki/Uniform_Resource_Identifier">URI</a>s)
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
			that are globally unique (compared to primary keys in relational databases that are almost never globally unique).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
			Objects are also identified by IRIs (and yes, one can be both subject and object) or they can be a primitive values like a text string or a number.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
		<m:diagram orientace="vodorovně">
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
			node [fontname = "Latin Modern Sans, sans-serif"];
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
			edge [fontname = "Latin Modern Sans, sans-serif"];
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
			subject	->	object [ label = "predicate"];
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
		</m:diagram>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
			This <em>triple</em> is also called a <em>statement</em>.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
			In the following statement:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
		<blockquote>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
			<m:name/> tools are released under the GNU GPL license.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
		</blockquote>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
		<p>we recognize:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
		<ul>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
			<li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
				Subject: <i>					
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
					<m:name/> tools</i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
			</li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
			<li>Predicate: <i>is released under license</i></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
			<li>Object: <i>GNU GPL</i></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
		</ul>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
			This data model is seemingly simple: just a graph, two kinds of nodes and edges connecting them together.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
			Or a flat list of statements (triples).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
			But it can be also very complicated, depending on how we use it and how rich ontologies we design.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
			RDF can be studied for years and is a great topic for diploma thesis and dissertations,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
			but in this example, we will keep it as simple as possible.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
			Collections of statements are stored in special databases called triplestores.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
			The data inside can be queried using the 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
			<a href="https://www.w3.org/TR/sparql11-overview/">SPARQL</a> language through the endpoint provided by the triplestore.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
			Popular implementations are 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
			<a href="https://jena.apache.org/">Jena</a>,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
			<a href="http://vos.openlinksw.com/owiki/wiki/VOS">Virtuoso</a> and
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
			<a href="https://rdf4j.org/about/">RDF4J</a>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
			(all free software).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
			Relational model can be easily mapped to RDF.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
			We can just simply add a prefix to the primary keys to make them globally unique IRIs.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
			The attributes will become predicates (also prefixed).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    72
			And the values will become objects (either primitive values or IRIs in case of foreign keys).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    73
			Of course, more complex transformation can be done – this is the most straightforward way.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    74
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    77
			Mapping RDF data to relational model is bit more difficult.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    78
			Sometimes easy, sometimes very cumbersome.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    79
			We can always design some kind of EAV (entity – attribute – value) model in the relational database
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    80
			or we can create a relation for each predicate…
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    81
			If we do some universal automatic mapping and retain the flexibility of RDF and richness of the original ontology,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    82
			we usually lose the performance and simplicity of our relational queries.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    83
			Good mapping that will feel natural and idiomatic in the relational world and will perform well usually poses some hard work.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    84
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    85
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    86
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    87
			But mapping mere results of a SPARQL query obtained from an RDF endpoint is a different story.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    88
			These results can be seen as records and processed using our relational tools,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    89
			stored, transformed or converted to other formats, displayed in GUI windows or safely passed to shell scripts.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    90
			This example shows how we can bridge the RDF and relational worlds.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    91
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    92
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    93
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    94
		<h2>Several ways of connecting to an RDF triplestore</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    95
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    96
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    97
			Currently there is no official <code>relpipe-in-rdf</code> or <code>relpipe-in-sparql</code> tool.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    98
			It will be probably part of some future release of <m:name/>.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    99
			But until then, despite this lack, we still have several options how to join the RDF world
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   100
			and let the data from an RDF triplestore flow through our relational pipelines:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   101
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   102
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   103
		<ul>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
			<li>SQL-DK + Jena JDBC driver + <code>relpipe-in-xml</code></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
			<li>ODBC-JDBC bridge + Jena JDBC driver + <code>relpipe-in-sql</code></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   106
			<li>A native SPARQL ODBC driver + <code>relpipe-in-sql</code></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   107
			<li>A shell script + <code>relpipe-in-csv</code> or <code>relpipe-in-xml</code></li>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   108
		</ul>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   109
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   110
		<p>In this example, we will look at the first and the last option.</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   111
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   112
		<h2>SQL-DK + Jena JDBC driver</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   113
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   114
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   115
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   116
			Apache Jena is not only a triplestore,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   117
			it is a framework consisting of several parts
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   118
			and provides also a special JDBC driver that is ready to use
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   119
			(despite this <a href="https://issues.apache.org/jira/browse/JENA-1939">small bug</a>).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   120
			Thanks to this driver, we can use existing Java tools and run SPARQL queries instead of SQL ones.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   121
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   122
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   123
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   124
			Such a tool that uses this standard API (JDBC)
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   125
			is <a href="https://sql-dk.globalcode.info/">SQL-DK</a>.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   126
			This tool integrates well with <m:name/> because it can output results in the XML format (or alternatively the Recfile format)
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   127
			that can be directly consumed by <code>relpipe-in-xml</code> (or alternatively <code>relpipe-in-recfile</code>).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   128
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   129
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   130
		<p>First we download Jena source codes:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   131
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   132
		<m:pre jazyk="bash"><![CDATA[mkdir -p ~/src; cd ~/src
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   133
git clone https://gitbox.apache.org/repos/asf/jena.git]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   134
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   135
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   136
			and apply the <a href="https://git-zaloha.frantovo.cz/gitbox.apache.org/repos/asf/jena.git/commit/?h=JENA-1939_updateCount&amp;id=bdb5439d22b80b2909258449d82fb7b5003fd64c">patch</a>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   137
			for abovementioned bug (if not already merged in the upstream).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   138
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   139
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   140
		<p>n.b. As always when doing such experiments, we would probably run this under a separate user account or in a virtual machine.</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   141
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   142
		<p>Then we will compile the JDBC driver:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   143
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   144
		<m:pre jazyk="bash"><![CDATA[cd ~/src/jena/jena-jdbc/
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   145
mvn clean install]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   146
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   147
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   148
			Now we will install SQL-DK (either from sources or from <code>.deb</code> or <code>.rpm</code> package)
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   149
			and run it for the first time (which creates the configuration directory and files):
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   150
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   151
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   152
		<pre>sql-dk --list-databases</pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   153
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   154
		<p>Then we will register the previously compiled Jena JDBC driver in the <code>~/.sql-dk/environment.sh</code></p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   155
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   156
		<m:pre jazyk="bash"><![CDATA[CUSTOM_JDBC=(
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   157
	~/src/jena/jena-jdbc/jena-jdbc-driver-bundle/target/jena-jdbc-driver-bundle-*.jar
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   158
);]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   159
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   160
		<p>And we should see it among other drivers:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   161
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   162
		<pre><![CDATA[$ sql-dk --list-jdbc-drivers 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   163
 ╭──────────────────────────────────────────────────┬───────────────────┬─────────────────┬─────────────────┬──────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   164
 │ class                                  (VARCHAR) │ version (VARCHAR) │ major (INTEGER) │ minor (INTEGER) │ jdbc_compliant (BOOLEAN) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   165
 ├──────────────────────────────────────────────────┼───────────────────┼─────────────────┼─────────────────┼──────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   166
 │ org.postgresql.Driver                            │ 9.4               │               9 │               4 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   167
 │ com.mysql.jdbc.Driver                            │ 5.1               │               5 │               1 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   168
 │ org.sqlite.JDBC                                  │ 3.25              │               3 │              25 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   169
 │ org.apache.jena.jdbc.mem.MemDriver               │ 1.0               │               1 │               0 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   170
 │ org.apache.jena.jdbc.remote.RemoteEndpointDriver │ 1.0               │               1 │               0 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   171
 │ org.apache.jena.jdbc.tdb.TDBDriver               │ 1.0               │               1 │               0 │                    false │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   172
 ╰──────────────────────────────────────────────────┴───────────────────┴─────────────────┴─────────────────┴──────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   173
Record count: 6]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   174
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   175
		<p>The driver seems present so we can configure the connection in the <code>~/.sql-dk/config.xml</code> file:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   176
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   177
		<m:pre jazyk="xml"><![CDATA[<database>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   178
	<name>rdf-dbpedia</name>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   179
	<url>jdbc:jena:remote:query=http://dbpedia.org/sparql</url>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   180
	<userName></userName>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   181
	<password></password>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   182
</database>]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   183
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   184
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   185
			This will connect us to the DBpedia endpoint (more datasources are mentioned in the chapter below).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   186
			We can test the connection:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   187
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   188
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   189
		<pre><![CDATA[$ sql-dk --test-connection rdf-dbpedia 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   190
 ╭─────────────────────────┬──────────────────────┬─────────────────────┬────────────────────────┬───────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   191
 │ database_name (VARCHAR) │ configured (BOOLEAN) │ connected (BOOLEAN) │ product_name (VARCHAR) │ product_version (VARCHAR) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   192
 ├─────────────────────────┼──────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   193
 │ rdf-dbpedia             │                 true │                true │                        │                           │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   194
 ╰─────────────────────────┴──────────────────────┴─────────────────────┴────────────────────────┴───────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   195
Record count: 1]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   196
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   197
		<p>and run our first SPARQL query:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   198
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   199
		<pre><![CDATA[$ sql-dk --db rdf-dbpedia --formatter tabular-prefetching --sql "SELECT * WHERE { ?subject ?predicate ?object . } LIMIT 8"
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   200
 ╭──────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬─────────────────────────────────────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   201
 │ subject                                         (org.apache.jena.graph.Node) │ predicate          (org.apache.jena.graph.Node) │ object                     (org.apache.jena.graph.Node) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   202
 ├──────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   203
 │ http://www.openlinksw.com/virtrdf-data-formats#default-iid                   │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   204
 │ http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable          │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   205
 │ http://www.openlinksw.com/virtrdf-data-formats#default-iid-nonblank          │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   206
 │ http://www.openlinksw.com/virtrdf-data-formats#default-iid-nonblank-nullable │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   207
 │ http://www.openlinksw.com/virtrdf-data-formats#default                       │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   208
 │ http://www.openlinksw.com/virtrdf-data-formats#default-nullable              │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   209
 │ http://www.openlinksw.com/virtrdf-data-formats#sql-varchar                   │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   210
 │ http://www.openlinksw.com/virtrdf-data-formats#sql-varchar-nullable          │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   211
 ╰──────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────┴─────────────────────────────────────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   212
Record count: 8]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   213
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   214
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   215
			Not a big fun yet, but it proves that the connection is working and we are getting some results from the endpoint.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   216
			We will run some more interesting queries later.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   217
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   218
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   219
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   220
			When we switch to the <code>--formatter xml</code> we can pipe the stream from SQL-DK
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   221
			to <code>relpipe-in-xml</code> and then process it using relational tools.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   222
			We can also use the <code>--sql-in</code> option of SQL-DK which reads the query from STDIN (instead of from command line argument)
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   223
			and then wrap it as a reusable script that reads SPARQL and outputs relational data:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   224
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   225
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   226
		<m:pre jazyk="bash">sql-dk --db "rdf-dbpedia" --formatter "xml" --sql-in | relpipe-in-xml</m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   227
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   228
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   229
			For accessing remote SPARQL endpoint this is a bit overkill with lot of dependencies (so we will use different approach in the next chapter).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   230
			But Jena JDBC driver is not only for accessing remote endpoints – we can use it as an embedded database,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   231
			either an in-memory one or regular DB backed by persistent files.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   232
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   233
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   234
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   235
			The in-memory database loads some initial data and then operates on them.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   236
			So we configure such connection:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   237
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   238
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   239
		<m:pre jazyk="xml"><![CDATA[<database>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   240
	<name>rdf-in-memory</name>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   241
	<url>jdbc:jena:mem:dataset=/tmp/rdf-initial-data.ttl</url>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   242
	<userName></userName>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   243
	<password></password>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   244
</database>]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   245
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   246
		<p>It runs fine, but <a href="https://en.wikipedia.org/wiki/Turtle_(syntax)">turtles</a> are not at home:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   247
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   248
		<pre><![CDATA[$ echo > /tmp/rdf-initial-data.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   249
$ echo "SELECT * WHERE { ?subject ?predicate ?object . }" | sql-dk --db rdf-in-memory --formatter tabular-prefetching --sql-in 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   250
 ╭──────────────────────────────────────┬────────────────────────────────────────┬─────────────────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   251
 │ subject (org.apache.jena.graph.Node) │ predicate (org.apache.jena.graph.Node) │ object (org.apache.jena.graph.Node) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   252
 ├──────────────────────────────────────┼────────────────────────────────────────┼─────────────────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   253
 ╰──────────────────────────────────────┴────────────────────────────────────────┴─────────────────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   254
Record count: 0]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   255
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   256
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   257
			If we are in a desperate need of turtles and have installed any <a href="https://lv2plug.in/">LV2</a> plugins,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   258
			we can find some and put them in our initial data file or reconfigure the database connection:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   259
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   260
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   261
		<pre><![CDATA[$ find /usr/lib -name '*.ttl' | head
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   262
/usr/lib/lv2/fil4.lv2/manifest.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   263
/usr/lib/lv2/fil4.lv2/fil4.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   264
/usr/lib/ardour5/LV2/a-fluidsynth.lv2/manifest.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   265
/usr/lib/ardour5/LV2/a-fluidsynth.lv2/a-fluidsynth.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   266
/usr/lib/ardour5/LV2/reasonablesynth.lv2/manifest.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   267
/usr/lib/ardour5/LV2/reasonablesynth.lv2/reasonablesynth.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   268
/usr/lib/ardour5/LV2/a-delay.lv2/manifest.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   269
/usr/lib/ardour5/LV2/a-delay.lv2/presets.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   270
/usr/lib/ardour5/LV2/a-delay.lv2/a-delay.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   271
/usr/lib/ardour5/LV2/a-eq.lv2/manifest.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   272
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   273
$ cat /usr/lib/lv2/fil4.lv2/manifest.ttl > /tmp/rdf-initial-data.ttl
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   274
$ sed s@/tmp/rdf-initial-data.ttl@/usr/lib/lv2/fil4.lv2/manifest.ttl@g -i ~/.sql-dk/config.xml]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   275
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   276
		<p>and look through Jena/RDF/SPARQL what is inside:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   277
			
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   278
		<pre><![CDATA[$ echo "SELECT * WHERE { ?subject ?predicate ?object . }" | sql-dk --db rdf-in-memory --formatter xml --sql-in | relpipe-in-xml | relpipe-out-tabular 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   279
r1:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   280
 ╭───────────────────────────────────────┬─────────────────────────────────────────────────┬───────────────────────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   281
 │ subject                      (string) │ predicate                              (string) │ object                           (string) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   282
 ├───────────────────────────────────────┼─────────────────────────────────────────────────┼───────────────────────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   283
 │ http://gareus.org/oss/lv2/fil4#ui_gl  │ http://www.w3.org/2000/01/rdf-schema#seeAlso    │ file:///usr/lib/lv2/fil4.lv2/fil4.ttl     │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   284
 │ http://gareus.org/oss/lv2/fil4#ui_gl  │ http://lv2plug.in/ns/extensions/ui#binary       │ file:///usr/lib/lv2/fil4.lv2/fil4UI_gl.so │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   285
 │ http://gareus.org/oss/lv2/fil4#ui_gl  │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://lv2plug.in/ns/extensions/ui#X11UI  │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   286
 │ http://gareus.org/oss/lv2/fil4#mono   │ http://www.w3.org/2000/01/rdf-schema#seeAlso    │ file:///usr/lib/lv2/fil4.lv2/fil4.ttl     │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   287
 │ http://gareus.org/oss/lv2/fil4#mono   │ http://lv2plug.in/ns/lv2core#binary             │ file:///usr/lib/lv2/fil4.lv2/fil4.so      │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   288
 │ http://gareus.org/oss/lv2/fil4#mono   │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://lv2plug.in/ns/lv2core#Plugin       │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   289
 │ http://gareus.org/oss/lv2/fil4#stereo │ http://www.w3.org/2000/01/rdf-schema#seeAlso    │ file:///usr/lib/lv2/fil4.lv2/fil4.ttl     │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   290
 │ http://gareus.org/oss/lv2/fil4#stereo │ http://lv2plug.in/ns/lv2core#binary             │ file:///usr/lib/lv2/fil4.lv2/fil4.so      │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   291
 │ http://gareus.org/oss/lv2/fil4#stereo │ http://www.w3.org/1999/02/22-rdf-syntax-ns#type │ http://lv2plug.in/ns/lv2core#Plugin       │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   292
 ╰───────────────────────────────────────┴─────────────────────────────────────────────────┴───────────────────────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   293
Record count: 9]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   294
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   295
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   296
			Now we can be sure that LV2 uses the Turtle format for plugin configurations,
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   297
			which is quite ingenious and inspirational – 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   298
			such configuration is well structured and its options (predicates in general) have globally unique identifiers (IRIs).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   299
			Also plugins are identified by IRIs which is great, because it avoids name collisions.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   300
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   301
		
312
0a65e49a076f examples: Querying an RDF triplestore using SPARQL: @id for the turtle part
František Kučera <franta-hg@frantovo.cz>
parents: 310
diff changeset
   302
		<p id="turtle">
310
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   303
			Let us make some own turtles.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   304
			Reconfigure the database connection back:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   305
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   306
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   307
		<pre>sed s@/usr/lib/lv2/fil4.lv2/manifest.ttl@/tmp/rdf-initial-data.ttl@g -i ~/.sql-dk/config.xml</pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   308
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   309
		<p>and fill the <code>/tmp/rdf-initial-data.ttl</code> with some new data:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   310
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   311
		<m:pre jazyk="turtle"><![CDATA[<http://example.org/person/you>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   312
	<http://example.org/predicate/have>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   313
	<http://example.org/thing/nice-day> .]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   314
	
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   315
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   316
			Turtle is a simple format that contains statements.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   317
			Subjects, predicates and objects are separated by spaces (tabs and line-ends are here just to make it more readable for us).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   318
			And statements end with <i>full stop</i> like ordinary sentences.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   319
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   320
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   321
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   322
			To avoid repeating common parts of IRIs we can declare namespace prefixes:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   323
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   324
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   325
		<m:pre jazyk="turtle"><![CDATA[@prefix person:     <http://example.org/person/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   326
@prefix predicate:  <http://example.org/predicate/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   327
@prefix thing:      <http://example.org/thing/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   328
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   329
person:you
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   330
	predicate:have
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   331
		thing:nice-day .]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   332
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   333
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   334
			This format is very concise.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   335
			If we describe the same subject, we use <i>semicolon</i> to avoid repeating it.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   336
			And if even the predicate is the same (multiple values), we use <i>comma</i>:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   337
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   338
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   339
		<m:pre jazyk="turtle"><![CDATA[@prefix person:     <http://example.org/person/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   340
@prefix predicate:  <http://example.org/predicate/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   341
@prefix thing:      <http://example.org/thing/> .
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   342
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   343
person:you
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   344
	predicate:have
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   345
		thing:nice-day, thing:much-fun;
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   346
	predicate:read-about
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   347
		thing:relational-pipes .]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   348
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   349
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   350
			Jena will parse our file and respond to our basic query with these data:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   351
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   352
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   353
		<pre><![CDATA[$ echo "SELECT * WHERE { ?subject ?predicate ?object . }" | sql-dk --db rdf-in-memory --formatter xml --sql-in --relation rdf_results | relpipe-in-xml | relpipe-out-tabular 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   354
rdf_results:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   355
 ╭───────────────────────────────┬─────────────────────────────────────────┬───────────────────────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   356
 │ subject              (string) │ predicate                      (string) │ object                           (string) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   357
 ├───────────────────────────────┼─────────────────────────────────────────┼───────────────────────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   358
 │ http://example.org/person/you │ http://example.org/predicate/read-about │ http://example.org/thing/relational-pipes │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   359
 │ http://example.org/person/you │ http://example.org/predicate/have       │ http://example.org/thing/much-fun         │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   360
 │ http://example.org/person/you │ http://example.org/predicate/have       │ http://example.org/thing/nice-day         │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   361
 ╰───────────────────────────────┴─────────────────────────────────────────┴───────────────────────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   362
Record count: 3]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   363
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   364
		<p>Or if we prefer more vertical formats like Recfile:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   365
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   366
		<pre><![CDATA[$ echo "SELECT * WHERE { ?subject ?predicate ?object . }" | sql-dk --db rdf-in-memory --formatter xml --sql-in --relation rdf_results | relpipe-in-xml | relpipe-out-recfile 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   367
%rec: rdf_results
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   368
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   369
subject: http://example.org/person/you
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   370
predicate: http://example.org/predicate/read-about
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   371
object: http://example.org/thing/relational-pipes
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   372
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   373
subject: http://example.org/person/you
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   374
predicate: http://example.org/predicate/have
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   375
object: http://example.org/thing/much-fun
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   376
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   377
subject: http://example.org/person/you
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   378
predicate: http://example.org/predicate/have
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   379
object: http://example.org/thing/nice-day]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   380
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   381
		<p>Let us create some more data:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   382
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   383
		<m:pre jazyk="turtle" src="examples/rdf-heathers.ttl"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   384
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   385
		<p>list them as statements:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   386
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   387
		<m:pre jazyk="text" src="examples/rdf-heathers.txt"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   388
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   389
		<p>and run some more SPARQL queries…</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   390
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   391
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   392
			Note:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   393
			<em>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   394
				we use <a href="https://tools.ietf.org/html/rfc4151">The tag: URI scheme</a> for our IRIs.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   395
				It makes URIs (IRIs) globally unique not only in space but also in time (domain owners change during time).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   396
				Which is great.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   397
				In the semantic web and linked data world, it is not common and locators (URLs) are used rather than pure identifiers (URIs, IRIs).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   398
				But here we want to emphasise that we work strictly with our local data
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   399
				and make it clear that we do not depend on any on-line resources and nothing will be downloaded from remote servers.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   400
				And in a real project, we should use existing ontologies / vocabularies as much as possible instead of inventing new ones.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   401
				But we keep this example rather isolated from the complexity of the outer world and bit synthetic.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   402
			</em>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   403
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   404
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   405
		<p>Find all quotes and names of their authors:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   406
		<m:sparql-example name="examples/rdf-heathers-quotes"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   407
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   408
		<p>List groups and counts of their members:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   409
		<m:sparql-example name="examples/rdf-heathers-members"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   410
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   411
		<p>Filter by a regular expression and list actor names rather than characters:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   412
		<m:sparql-example name="examples/rdf-heathers-much"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   413
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   414
		<p>Now imagine semantic model of Twin Peaks… How very!</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   415
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   416
		<h2>Improvised relpipe-in-sparql tool</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   417
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   418
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   419
			Starting the JVM and creating always a new database from scratch on each query is quite… <i>heavy</i>.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   420
			We can keep Jena running in the background and connect to its SPARQL endpoint – or connect to any other endpoint on the internet.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   421
			So we will hack together a light script and name it <code>relpipe-in-sparql</code> (in some future release there will be such official tool).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   422
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   423
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   424
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   425
			Because SPARQL endpoints accept plain HTTP requests, support besides XML also CSV and we already have <code>relpipe-in-csv</code>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   426
			the script can be very simple:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   427
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   428
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   429
		<m:pre jazyk="bash"><![CDATA[curl \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   430
	--header "Accept: text/csv" \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   431
	--data-urlencode query="SELECT * WHERE { ?subject ?predicate ?object . } LIMIT 3" \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   432
	https://dbpedia.org/sparql | relpipe-in-csv | relpipe-out-tabular]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   433
	
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   434
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   435
			It becomes bit longer if we add some documentation, argument parsing and configuration:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   436
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   437
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   438
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   439
		<m:pre jazyk="bash" src="examples/relpipe-in-sparql.sh" odkaz="ano"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   440
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   441
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   442
			Here we have even two implementations that could be switched using the <code>RELPIPE_IN_SPARQL_IMPLEMENTATION</code> environmental variable.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   443
			The XML one is more powerful and can be customized (e.g. to specifically handle localized strings or add some new attributes to the relational output).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   444
			On the other hand, the CSV one has fewer dependencies and support streaming of long result sets (XSLT needs to load whole document first).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   445
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   446
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   447
		<p>Both implementation should work:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   448
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   449
		<m:pre jazyk="bash"><![CDATA[export RELPIPE_IN_SPARQL_IMPLEMENTATION=xml
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   450
export RELPIPE_IN_SPARQL_IMPLEMENTATION=csv
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   451
echo 'SELECT * WHERE { ?subject ?predicate "Laura Dern"@en . } LIMIT 3' \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   452
	| relpipe-in-sparql \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   453
		--relation "jurassic" \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   454
		--endpoint "https://dbpedia.org/sparql" \
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   455
	| relpipe-out-tabular]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   456
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   457
		<p>and produce the same output:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   458
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   459
		<pre><![CDATA[jurassic:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   460
 ╭────────────────────────────────────────┬────────────────────────────────────────────╮
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   461
 │ subject                       (string) │ predicate                         (string) │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   462
 ├────────────────────────────────────────┼────────────────────────────────────────────┤
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   463
 │ http://dbpedia.org/resource/Laura_Dern │ http://www.w3.org/2000/01/rdf-schema#label │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   464
 │ http://www.wikidata.org/entity/Q220901 │ http://www.w3.org/2000/01/rdf-schema#label │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   465
 │ http://dbpedia.org/resource/Laura_Dern │ http://xmlns.com/foaf/0.1/name             │
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   466
 ╰────────────────────────────────────────┴────────────────────────────────────────────╯
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   467
Record count: 3]]></pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   468
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   469
		<p>And maybe somewhere nearby in the graph we will find:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   470
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   471
		<blockquote>It's a Unix System… I know this!</blockquote>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   472
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   473
		<h2>Sources of RDF data</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   474
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   475
		<p></p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   476
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   477
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   478
			The bad news are that we are not querying the real world. 
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   479
			We are querying an imperfect, incomplete and outdated snapshot of the reality stored in someone's database.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   480
			The good news are that we can improve the content of certain databases like we improve articles in Wikipedia.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   481
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   482
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   483
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   484
			Some addresses have already <i>leaked</i> in the <code>relpipe-in-sparql --help</code> above.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   485
			Here is brief description of some publicly available sources of RDF data
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   486
			that we can play with.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   487
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   488
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   489
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   490
		<h3>Wikidata</h3>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   491
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   492
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   493
			A free and open knowledge base, a sister project of Wikipedia.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   494
			Anyone can use and even edit its content.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   495
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   496
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   497
		<m:sparql-endpoint url="https://query.wikidata.org/sparql" website-url="https://www.wikidata.org/" website-title="Wikidata"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   498
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   499
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   500
		<h3>DBpedia</h3>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   501
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   502
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   503
			They extract structured content from the information created in various Wikimedia projects.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   504
			And publish this knowledge graph for everyone.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   505
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   506
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   507
		<m:sparql-endpoint url="https://dbpedia.org/sparql" website-url="https://wiki.dbpedia.org/" website-title="DBpedia"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   508
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   509
		<h3>Czech government</h3>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   510
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   511
			Ministries and other institutions publish some data as open data and part of them as linked open data (LOD).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   512
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   513
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   514
		<m:sparql-endpoint url="https://data.gov.cz/sparql" website-url="https://data.gov.cz/english/" website-title="Open data portal of the Czech Republic"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   515
		<m:sparql-endpoint url="https://data.cssz.cz/sparql" website-url="https://data.cssz.cz/" website-title="Open data portal of the Czech Social Security Administration"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   516
		<m:sparql-endpoint url="https://cedropendata.mfcr.cz/c3lod/cedr/sparql" website-url="https://cedropendata.mfcr.cz/" website-title="Open Data CEDR III"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   517
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   518
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   519
		<h2>Running SPARQL queries as scripts</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   520
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   521
		<p>Besides piping SPARQL queries through <code>relpipe-in-sparql</code> like this:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   522
		<m:pre jazyk="bash"><![CDATA[cat query.sparql | relpipe-in-sparql | relpipe-out-tabular]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   523
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   524
		<p>we can make them executable and run like a (Bash, Perl, PHP etc.) script:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   525
		<m:pre jazyk="bash"><![CDATA[chmod +x query.sparql
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   526
./query.sparql | relpipe-out-csv     # output in the CSV format
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   527
./query.sparql | relpipe-out-recfile # output in the Recfile format
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   528
./query.sparql                       # automatically appends relpipe-out-tabular to the pipeline
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   529
]]></m:pre>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   530
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   531
		<p>(see the <m:a href="implementation">Implementation</m:a> page for complete list of available transformations and output filters)</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   532
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   533
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   534
			We need to add the first line comment that points to the interpreter.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   535
			The <code>endpoint</code> and <code>relation</code> parameters
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   536
			are optional – we can say, where this query will be executed and how the output relation will be named:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   537
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   538
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   539
		<m:pre jazyk="sparql" src="examples/rdf-sample-triples.sparql" odkaz="ano"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   540
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   541
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   542
			Environmental variables <code>RELPIPE_IN_SPARQL_ENDPOINT</code> and <code>RELPIPE_IN_SPARQL_RELATION</code>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   543
			can be set to override the parameters from the file.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   544
			All the magic is done by this (bit hackish) helper script:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   545
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   546
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   547
		<m:pre jazyk="bash" src="examples/rdf-sparql-interpreter.sh" odkaz="ano"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   548
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   549
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   550
			This script requires the <code>relpipe-in-sparql</code> we put together earlier.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   551
			Both scripts are just examples (not part of any release yet).
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   552
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   553
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   554
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   555
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   556
		<h2>Samples of SPARQL queries</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   557
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   558
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   559
			<i>Hey kid, rock and roll,</i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   560
			let us list the films where both Coreys starred:
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   561
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   562
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   563
		<m:sparql-example name="examples/rdf-coreys"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   564
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   565
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   566
			<i>So Mercedes has scratched our Cadillac, but it was still a great night. </i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   567
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   568
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   569
		<p>Now it is time to visit our friends from the club:</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   570
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   571
		<m:sparql-example name="examples/rdf-breakfast-club"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   572
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   573
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   574
			Not only <i>pretty in pink</i>, this is true <i>wisdom</i> and we could have much fun traversing this part of the graph.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   575
			But let us turn the globe around… there is also a lot to see in the Eastern Bloc.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   576
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   577
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   578
		<m:sparql-example name="examples/rdf-blonde-and-brunette"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   579
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   580
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   581
			<i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   582
				Dad, what is this place?
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   583
				Where are we?
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   584
				Is there anyone here?<br/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   585
				No. Just us.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   586
			</i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   587
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   588
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   589
		<m:sparql-example name="examples/rdf-return"/>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   590
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   591
		<h2>P.S.</h2>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   592
		<p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   593
			<i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   594
				If you got an impression that RDF is just a poor relational database with a single table consisting of mere three columns
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   595
				and with freaky SQL dialect, please be assured that this example shows just a small fraction of the wonderful RDF world.
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   596
			</i>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   597
		</p>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   598
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   599
		
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   600
	</text>
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   601
aeda3cb4528d examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   602
</stránka>