I am a bit new to sparql Query and I am having a lot of trouble producing a simple data set. Basically here's what I am trying to do. Given the following data structure:
Data
-Composition
-ElementName:"A"
-Value :"4"
I want to output something like the following
-----------------------
| elementName | Value |
=====================
| "A" | "1" |
| "B" | "2" |
| "C" | "3" |
| "D" | "4" |
-----------------------
USing the the following code
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX tpl: <http://www.example.com/1962c0ea39923156f8ef72fa44584f26e7c5ae20#>
SELECT ?elementNameValue ?valueValue
WHERE {
{
?s tpl:Data/tpl:composition/tpl:elementName ?o .
?o rdf:value ?elementNameValue .
}
UNION
{
?s tpl:Data/tpl:composition/tpl:value ?o .
?o rdf:value ?valueValue .
}
}
I am outputting
-----------------------
| elementName | Value |
=====================
| "A" | |
| "B" | |
| "C" | |
| "D" | |
| | "1" |
| | "2" |
| | "3" |
| | "4" |
-----------------------
What am i doing wrong? directions to resources are also helpful. using APache-Jena