Used Resources and Namespaces
Namespaces
- elecC = "http://linkeddata.interactivesystems.info/election/class#"
- elecR = "http://linkeddata.interactivesystems.info/election/resource#"
- elecP = "http://linkeddata.interactivesystems.info/election/property#"
- sensC = "http://linkeddata.interactivesystems.info/sensor/class#"
- sensR = "http://linkeddata.interactivesystems.info/sensor/resource#"
- sensP = "http://linkeddata.interactivesystems.info/sensor/property#"
Resources
- die_partei = "http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI"
Examples
Basic
Resource
Get the URL of resource "Die Partei":
die_partei
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0
WHERE {}
Path Expression
Get the labels of "Die Partei":
die_partei.rdfs:label
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?label__P_0_1_0
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> rdfs:label ?label__P_0_1_0 .
}
Path Expression 2
Get the labels of all elections in which "Die Partei" participated:
die_partei.elecP:participatedInElection.rdfs:label
PREFIX elecP: <http://linkeddata.interactivesystems.info/election/property#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?participatedInElection__P_0_1_0 ?label__P_0_1_1
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> elecP:participatedInElection ?participatedInElection__P_0_1_0 .
?participatedInElection__P_0_1_0 rdfs:label ?label__P_0_1_1 .
}
Multiple Path Expression
Get labels and comments of "Die Partei":
die_partei.[rdfs:label, rdfs:comment]
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?label__P_0_1_0_0_0 ?comment__P_0_1_0_1_0
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> rdfs:label ?label__P_0_1_0_0_0 .
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> rdfs:comment ?comment__P_0_1_0_1_0 .
}
Reversed Path Expression
Get the number of first votes of all party votes that belong to "Die Partei":
die_partei.^elecP:party.elecP:number_of_first_votes
PREFIX elecP: <http://linkeddata.interactivesystems.info/election/property#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?partyOf__P_0_1_0 ?number_of_first_votes__P_0_1_1
WHERE {
?partyOf__P_0_1_0 elecP:party <http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> .
?partyOf__P_0_1_0 elecP:number_of_first_votes ?number_of_first_votes__P_0_1_1 .
}
Wildcards
Wildcard as Resources
Get all resources:
*
SELECT DISTINCT ?wildcard__R_0_0
WHERE {
?wildcard__R_0_0 ?p ?o .
}
Wildcards in Path Expressions as Resource
Get the labels of all resources:
*.rdfs:label
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?wildcard__R_0_0 ?label__P_0_1_0
WHERE {
?wildcard__R_0_0 rdfs:label ?label__P_0_1_0 .
}
Wildcards in Path Expressions as Property
Get all properties of "Die Partei":
die_partei.*
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?wildcard__P_0_1_0
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> ?PropertyOf_Die_PARTEI__R_0_0__wildcard__P_0_1_0 ?wildcard__P_0_1_0 .
}
Filters
Simple Filter
Get all districts in which "Die Partei" got more than 1000 first votes:
die_partei.^elecP:party(elecP:number_of_first_votes > 1000).elecP:district
PREFIX elecP: <http://linkeddata.interactivesystems.info/election/property#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?partyOf__P_0_1_0 ?district__P_0_1_1
WHERE {
?partyOf__P_0_1_0 elecP:party <http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> .
?partyOf__P_0_1_0 elecP:number_of_first_votes ?number_of_first_votes__P_0_1_0_0 .
FILTER (
?number_of_first_votes__P_0_1_0_0 > 1000
) .
?partyOf__P_0_1_0 elecP:district ?district__P_0_1_1 .
}
Combined Filter
Get all districts in which "Die Partei" got more than 1000 first votes during the election of 2013:
die_partei.^elecP:party(elecP:number_of_first_votes > 1000 && elecP:election.rdfs:label = 'Bundestagswahl 2013').elecP:district
PREFIX elecP: <http://linkeddata.interactivesystems.info/election/property#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?partyOf__P_0_1_0 ?district__P_0_1_1
WHERE {
?partyOf__P_0_1_0 elecP:party <http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> .
?partyOf__P_0_1_0 elecP:number_of_first_votes ?number_of_first_votes__P_0_1_0_0 .
?partyOf__P_0_1_0 elecP:election ?election__P_0_1_0_0 .
?election__P_0_1_0_0 rdfs:label ?label__P_0_1_0_1 .
FILTER (
?number_of_first_votes__P_0_1_0_0 > 1000 &&
STR(?label__P_0_1_0_1) = 'Bundestagswahl 2013'
) .
?partyOf__P_0_1_0 elecP:district ?district__P_0_1_1 .
}
Keywords
@language
Get the German comment of "Die Partei":
die_partei.rdfs:comment(@lang = 'de')
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?comment__P_0_1_0
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> rdfs:comment ?comment__P_0_1_0 .
FILTER (
lang(?comment__P_0_1_0) = '' || langMatches(lang(?comment__P_0_1_0), 'de')
) .
}
@type
Get all parties:
*(@type = elecC:Party)
PREFIX elecC: <http://linkeddata.interactivesystems.info/election/class#>
SELECT DISTINCT ?wildcard__R_0_0
WHERE {
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = elecC:Party
) .
}
@self
Get the labels of "Die Partei":
*(@self = elecR:Die_PARTEI).rdfs:label
PREFIX elecR: <http://linkeddata.interactivesystems.info/election/resource#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?wildcard__R_0_0 ?label__P_0_1_0
WHERE {
?wildcard__R_0_0 rdfs:label ?label__P_0_1_0 .
FILTER (
?wildcard__R_0_0 = elecR:Die_PARTEI
) .
}
@timeinterval
Get the temperature values for a specific sensor in a 60 minutes interval:
TODO: interval syntax
*(@type = sensC:Measurement && sensP:sensor = sensR:TH_LF285_01 && sensP:type = 'Temperature').[sensP:value, sensP:measuredAt(@timeinterval = '60 min')]
PREFIX sensC: <http://linkeddata.interactivesystems.info/sensor/class#>
PREFIX sensP: <http://linkeddata.interactivesystems.info/sensor/property#>
PREFIX sensR: <http://linkeddata.interactivesystems.info/sensor/resource#>
SELECT DISTINCT SAMPLE(?wildcard__R_0_0) AS ?wildcard__R_0_0 SAMPLE(?value__P_0_1_0_0_0) AS ?value__P_0_1_0_0_0 SAMPLE(?measuredAt__P_0_1_0_1_0) AS ?measuredAt__P_0_1_0_1_0
WHERE {
?wildcard__R_0_0 sensP:value ?value__P_0_1_0_0_0 .
?wildcard__R_0_0 sensP:measuredAt ?measuredAt__P_0_1_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
?wildcard__R_0_0 sensP:sensor ?sensor__P_0_0_0 .
?wildcard__R_0_0 sensP:type ?type__P_0_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = sensC:Measurement &&
?sensor__P_0_0_0 = sensR:TH_LF285_01 &&
STR(?type__P_0_0_0) = 'Temperature'
) .
BIND(FLOOR((xsd:dateTime(?measuredAt__P_0_1_0_1_0) - xsd:dateTime("1970-01-01T00:00:00")) / (3600) ) AS ?measuredAt__P_0_1_0_1_0_timeinterval)
}
GROUP BY ?measuredAt__P_0_1_0_1_0_timeinterval
ORDER BY DESC(?measuredAt__P_0_1_0_1_0_timeinterval)
@timestart
Get the temperature values for a specific sensor in a 60 minutes interval, starting seven days ago:
*(@type = sensC:Measurement && sensP:sensor = sensR:TH_LF285_01 && sensP:type = 'Temperature').[sensP:value, sensP:measuredAt(@timeinterval = '60 min' && @timestart = 'now - 7 days')]
PREFIX sensC: <http://linkeddata.interactivesystems.info/sensor/class#>
PREFIX sensP: <http://linkeddata.interactivesystems.info/sensor/property#>
PREFIX sensR: <http://linkeddata.interactivesystems.info/sensor/resource#>
SELECT DISTINCT SAMPLE(?wildcard__R_0_0) AS ?wildcard__R_0_0 SAMPLE(?value__P_0_1_0_0_0) AS ?value__P_0_1_0_0_0 SAMPLE(?measuredAt__P_0_1_0_1_0) AS ?measuredAt__P_0_1_0_1_0
WHERE {
?wildcard__R_0_0 sensP:value ?value__P_0_1_0_0_0 .
?wildcard__R_0_0 sensP:measuredAt ?measuredAt__P_0_1_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
?wildcard__R_0_0 sensP:sensor ?sensor__P_0_0_0 .
?wildcard__R_0_0 sensP:type ?type__P_0_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = sensC:Measurement &&
?sensor__P_0_0_0 = sensR:TH_LF285_01 &&
STR(?type__P_0_0_0) = 'Temperature'
) .
FILTER (
xsd:dateTime(?measuredAt__P_0_1_0_1_0) >= now() - 604800
)
BIND(FLOOR((xsd:dateTime(?measuredAt__P_0_1_0_1_0) - xsd:dateTime("1970-01-01T00:00:00")) / (3600) ) AS ?measuredAt__P_0_1_0_1_0_timeinterval)
}
GROUP BY ?measuredAt__P_0_1_0_1_0_timeinterval
ORDER BY DESC(?measuredAt__P_0_1_0_1_0_timeinterval)
@timeend
Get the temperature values for a specific sensor in a 60 minutes interval, starting seven days ago and ending 6 hours ago:
*(@type = sensC:Measurement && sensP:sensor = sensR:TH_LF285_01 && sensP:type = 'Temperature').[sensP:value, sensP:measuredAt(@timeinterval = '60 min' && @timestart = 'now - 7 days' && @timeend = 'now - 6 hours')]
PREFIX sensC: <http://linkeddata.interactivesystems.info/sensor/class#>
PREFIX sensP: <http://linkeddata.interactivesystems.info/sensor/property#>
PREFIX sensR: <http://linkeddata.interactivesystems.info/sensor/resource#>
SELECT DISTINCT SAMPLE(?wildcard__R_0_0) AS ?wildcard__R_0_0 SAMPLE(?value__P_0_1_0_0_0) AS ?value__P_0_1_0_0_0 SAMPLE(?measuredAt__P_0_1_0_1_0) AS ?measuredAt__P_0_1_0_1_0
WHERE {
?wildcard__R_0_0 sensP:value ?value__P_0_1_0_0_0 .
?wildcard__R_0_0 sensP:measuredAt ?measuredAt__P_0_1_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
?wildcard__R_0_0 sensP:sensor ?sensor__P_0_0_0 .
?wildcard__R_0_0 sensP:type ?type__P_0_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = sensC:Measurement &&
?sensor__P_0_0_0 = sensR:TH_LF285_01 &&
STR(?type__P_0_0_0) = 'Temperature'
) .
FILTER (
xsd:dateTime(?measuredAt__P_0_1_0_1_0) >= now() - 604800 &&
xsd:dateTime(?measuredAt__P_0_1_0_1_0) <= now() - 21600
)
BIND(FLOOR((xsd:dateTime(?measuredAt__P_0_1_0_1_0) - xsd:dateTime("1970-01-01T00:00:00")) / (3600) ) AS ?measuredAt__P_0_1_0_1_0_timeinterval)
}
GROUP BY ?measuredAt__P_0_1_0_1_0_timeinterval
ORDER BY DESC(?measuredAt__P_0_1_0_1_0_timeinterval)
@aggregate
Get the temperature values for a specific sensor in a 60 minutes interval and aggregate the values:
Available aggregate values are: SAMPLE, AVG, MIN, MAX, SUM, COUNT. If no aggregate value is defined than SAMPLE will be used by default.
*(@type = sensC:Measurement && sensP:sensor = sensR:TH_LF285_01 && sensP:type = 'Temperature').[sensP:value(@aggregate = 'avg'), sensP:measuredAt(@timeinterval = '60 min')]
PREFIX sensC: <http://linkeddata.interactivesystems.info/sensor/class#>
PREFIX sensP: <http://linkeddata.interactivesystems.info/sensor/property#>
PREFIX sensR: <http://linkeddata.interactivesystems.info/sensor/resource#>
SELECT DISTINCT SAMPLE(?wildcard__R_0_0) AS ?wildcard__R_0_0 AVG(?value__P_0_1_0_0_0) AS ?value__P_0_1_0_0_0 SAMPLE(?measuredAt__P_0_1_0_1_0) AS ?measuredAt__P_0_1_0_1_0
WHERE {
?wildcard__R_0_0 sensP:value ?value__P_0_1_0_0_0 .
?wildcard__R_0_0 sensP:measuredAt ?measuredAt__P_0_1_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
?wildcard__R_0_0 sensP:sensor ?sensor__P_0_0_0 .
?wildcard__R_0_0 sensP:type ?type__P_0_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = sensC:Measurement &&
?sensor__P_0_0_0 = sensR:TH_LF285_01 &&
STR(?type__P_0_0_0) = 'Temperature'
) .
BIND(FLOOR((xsd:dateTime(?measuredAt__P_0_1_0_1_0) - xsd:dateTime("1970-01-01T00:00:00")) / (3600) ) AS ?measuredAt__P_0_1_0_1_0_timeinterval)
}
GROUP BY ?measuredAt__P_0_1_0_1_0_timeinterval
ORDER BY DESC(?measuredAt__P_0_1_0_1_0_timeinterval)
@hide
Get the labels but not the the resource URIs of all elections in which "Die Partei" participated:
die_partei.elecP:participatedInElection(@hide = true).rdfs:label
PREFIX elecP: <http://linkeddata.interactivesystems.info/election/property#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT (<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI>) AS ?Die_PARTEI__R_0_0 ?label__P_0_1_1
WHERE {
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> elecP:participatedInElection ?participatedInElection__P_0_1_0 .
?participatedInElection__P_0_1_0 rdfs:label ?label__P_0_1_1 .
}
Nested Queries
Nested Filter Query
Get the parties that have the same label as "Die Partei":
*(@type = elecC:Party).rdfs:label(@self = {die_partei.rdfs:label})
PREFIX elecC: <http://linkeddata.interactivesystems.info/election/class#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?wildcard__R_0_0 ?label__P_0_1_0
WHERE {
?wildcard__R_0_0 rdfs:label ?label__P_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = elecC:Party
) .
<http://linkeddata.interactivesystems.info/election/resource#Die_PARTEI> rdfs:label ?label__P_0_1_0_0_1_0 .
FILTER (
?label__P_0_1_0 = ?label__P_0_1_0_0_1_0
) .
}
Relational Operators
Contains Operator
Get all parties that have the string "Partei" in their name:
*(@type = elecC:Party).rdfs:label(@self ~ 'Partei')
PREFIX elecC: <http://linkeddata.interactivesystems.info/election/class#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?wildcard__R_0_0 ?label__P_0_1_0
WHERE {
?wildcard__R_0_0 rdfs:label ?label__P_0_1_0 .
?wildcard__R_0_0 rdf:type ?TypeOf_wildcard__R_0_0 .
FILTER (
?TypeOf_wildcard__R_0_0 = elecC:Party
) .
FILTER (
CONTAINS( LCASE(STR(?label__P_0_1_0)), LCASE(STR('Partei' )))
) .
}