- From: Remo Liechti <remo.liechti@gmail.com>
- Date: Mon, 3 Jun 2013 22:34:43 +0200
- To: public-sparql-dev@w3.org
- Message-ID: <CAGDb2G-QBoRPukcmQ6twMSVwLw5zjYd+qRarLPubh=kBoXiwHA@mail.gmail.com>
Hi guys, I struggle with Sparql. Maybe you can help me. I have the following RDF: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc=" http://purl.org/dc/elements/1.1/" xmlns:fh="http://swt.ffhs.ch"> <fh:airport> <fh:callSign>ZRH</fh:callSign> <fh:coords>47° 27' 30? N, 8° 32' 53</fh:coords> <fh:name>Flughafen Zürich</fh:name> <fh:Runways rdf:parseType="Collection"> <fh:runway> <fh:callSign1>14</fh:callSign1> <fh:callSign2>32</fh:callSign2> </fh:runway> <fh:runway> <fh:callSign1>10</fh:callSign1> <fh:callSign2>28</fh:callSign2> </fh:runway> <fh:runway> <fh:callSign1>16</fh:callSign1> <fh:callSign2>34</fh:callSign2> </fh:runway> </fh:Runways> </fh:airport> <fh:airport> <fh:callSign>BSL</fh:callSign> <fh:name>Flughafen Basel</fh:name> <fh:Runways rdf:parseType="Collection"> <fh:runway> <fh:callSign1>12</fh:callSign1> <fh:callSign2>32</fh:callSign2> </fh:runway> </fh:Runways> </fh:airport> </rdf:RDF> I want to query the number of runways per airport. So ZRH should have 3 runways, Basel 1 of them. I use this query: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX fh: <http://swt.ffhs.ch> SELECT ?name (COUNT(?r) as ?runways) WHERE { ?a rdf:type fh:airport. ?a fh:name ?name. ?r rdf:type fh:runway. } group by ?name Which results in 4 runways per airport, which is apparently not what I was looking for. How can I make a relation between airport and runways? I thought the collection takes care of that? Thanks you! Remo
Received on Monday, 3 June 2013 21:53:55 UTC