Reputation: 21
I'm trying to use a SPARQL Query in data.admin.ch:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT distinct (?z as ?Variable) (?ptype as ?Bevoelkerungstyp) (?remuniuri as ?Meldegmeinde) ?age ?sex ?person
where
{
?z <http://data.admin.ch/bfs/property/POPULATIONTYPE> ?ptype.
?z <http://data.admin.ch/bfs/property/REPORTINGMUNICIPALITYID> ?remuniuri.
?z <http://data.admin.ch/bfs/property/AGE> ?age.
?z <http://data.admin.ch/bfs/property/SEX> ?sex.
I need to limit the ages to 7-22, but it doesn't work.
I tried:
SELECT distinct (SUM(xsd:int(?number)) AS ?child_inhabitants) WHERE
and then the with filter:
FILTER ((xsd:int(?pnumber)) <= 22 && (xsd:int(?agenumber)) <= 7)
Upvotes: 0
Views: 346
Reputation: 3096
}
An alternative to Stanislav's answer, which doesn't use any string manipulation
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT *
WHERE
{ ?z <http://data.admin.ch/bfs/property/POPULATIONTYPE> ?ptype ;
<http://data.admin.ch/bfs/property/REPORTINGMUNICIPALITYID> ?remuniuri ;
<http://data.admin.ch/bfs/property/AGE> ?age ;
<http://data.admin.ch/bfs/property/SEX> ?sex .
?age skos:notation ?ageval
FILTER ( ( xsd:int(?ageval) <= 22 ) && ( xsd:int(?ageval) >= 7 ) )
}
LIMIT 99
Upvotes: 2