I have the following SPARQL query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
SELECT ?subsidiary ?employees
WHERE {
<http://dbpedia.org/resource/Google> dbo:subsidiary ?subsidiary;
dbo:numberOfEmployees ?employees .
}
And I receive the following response:
{
"head": {
"vars": [ "subsidiary" , "employees" ]
} ,
"results": {
"bindings": [
{
"subsidiary": { "type": "uri" , "value": "http://dbpedia.org/resource/YouTube" } ,
"employees": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "53861" }
} ,
{
"subsidiary": { "type": "uri" , "value": "http://dbpedia.org/resource/Motorola_Mobility" } ,
"employees": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "53861" }
} ,
{
"subsidiary": { "type": "uri" , "value": "http://dbpedia.org/resource/Picnik" } ,
"employees": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "53861" }
}
]
}
}
The number of employees is returned multiple times because their are multiple subsidiaries associated with the queried resource. Is it possible to collapse all these subsidiaries into a list and get something more like:
{
"head": {
"vars": [ "subsidiary" , "employees" ]
} ,
"results": {
"bindings": [
{
"subsidiary": { "type": "uri" , "value": [
"http://dbpedia.org/resource/YouTube",
"http://dbpedia.org/resource/Motorola_Mobility",
"http://dbpedia.org/resource/Picnik"
]
} ,
"employees": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "53861" }
}
]
}
}