On 8/26/10 11:13 AM, Timo Kouwenhoven wrote:
Dear all,

My question might be on the silly side, but then again answering it will be easy, so here goes:

I'm using http://dbpedia.org/snorql to query dbpedia in order to get a list of Airports in the United States (ICAO code starting with "K") and their elevation and IATA code. Query included below. Works fine.

SELECT ?resource ?hasValue ?isValueOf ?elevation ?icao ?iata
WHERE {
  { <http://dbpedia.org/ontology/Elevation> ?resource ?hasValue }
  UNION
  { ?isValueOf ?resource <http://dbpedia.org/ontology/Airport> }.
  { ?isValueOf <http://dbpedia.org/ontology/elevation> ?elevation. }
{ ?isValueOf <http://dbpedia.org/ontology/icaoLocationIdentifier> ?icao. } OPTIONAL { ?isValueOf <http://dbpedia.org/ontology/iataLocationIdentifier> ?iata. }
FILTER regex(?icao, "^K")
}

The problem is that DBPedia returns every airport twice, once with elevation as a decimal and once with elevation as a more exact decimal. Example below:

resource        hasValue        isValueOf       elevation       icao    iata
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
http://dbpedia.org/resource/Los_Angeles_International_Airport 38 KLAX LAX
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
http://dbpedia.org/resource/Los_Angeles_International_Airport 38.4048 KLAX LAX
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
        http://dbpedia.org/resource/Washington_Dulles_International_Airport     
95      KIAD    IAD
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
http://dbpedia.org/resource/Washington_Dulles_International_Airport 95.4024 KIAD IAD
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
        http://dbpedia.org/resource/Van_Nuys_Airport    244.4   KVNY    VNY
http://www.w3.org/1999/02/22-rdf-syntax-ns#type         
        http://dbpedia.org/resource/Van_Nuys_Airport    244.4496        KVNY    
VNY


The question is how do I get a list with the exact decimals only?

FILTER with regex on ?elevation in the decimal point doesn't work...

Any ideas?

Thanks in advance,

Timo Kouwenhoven
http://www.skybrary.aero <http://www.skybrary.aero/> (aviation safety knowledge)


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d


_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
Try:

SELECT distinct ?resource ?hasValue ?isValueOf bif:round(?elevation) ?icao ?iata
WHERE {
  { <http://dbpedia.org/ontology/Elevation> ?resource ?hasValue }
  UNION
  { ?isValueOf ?resource <http://dbpedia.org/ontology/Airport> }.
  { ?isValueOf <http://dbpedia.org/ontology/elevation> ?elevation. }
{ ?isValueOf <http://dbpedia.org/ontology/icaoLocationIdentifier> ?icao. } OPTIONAL { ?isValueOf <http://dbpedia.org/ontology/iataLocationIdentifier> ?iata. }
FILTER regex(?icao, "^K")
}

--

Regards,

Kingsley Idehen 
President&  CEO
OpenLink Software
Web: http://www.openlinksw.com
Weblog: http://www.openlinksw.com/blog/~kidehen
Twitter/Identi.ca: kidehen





------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to