Hello everyone,

I have used the following SPARQL query to get the airports in Vancouver, but could not found the same for Montreal, it gave me empty answer.

 PREFIX dbpo: <http://dbpedia.org/ontology/>
 SELECT distinct ?VancouverAirportsA as ?VancouverAirports
 WHERE {
 ?VancouverAirportsA a dbpo:Airport.
 FILTER (REGEX (STR (?VancouverAirportsA),"Vancouver")) .
 }

again, the above query used to find the data for Vancouver Airports and it gave me the right answer that I am looking for. I was trying the same query after modifying it to Montreal but I did not get anything.

I also tried to used the another rdf which is

http://dbpedia.org/page/Montr%C3%A9al-Pierre_Elliott_Trudeau_International_Airport

but I faced a problem with the (%) sign.

I also tried to use the following link

http://dbpedia.neofonie.de/browse/~:airport%20montreal/

but did not work as well because there is a space between airport and Montreal in the URI.

I really need your help guys.

asked 07 Mar '12, 16:51

MR%20BIG's gravatar image

MR BIG
636
accept rate: 0%


Isn't it more effective to utilise the dbpo:location property for that issue, since REGEX filters are expensive, so you would have a query like the following one:

PREFIX dbpo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/resource/>

SELECT distinct ?MontrealAirport
WHERE {
    ?MontrealAirport a dbpo:Airport ;
        dbpo:location dbp:Montreal .
}
permanent link
This answer is marked "community wiki".

answered 08 Mar '12, 02:43

zazi's gravatar image

zazi
3.4k1213
accept rate: 13%

Thank you so much everyone who took a look on this question,

I have solved the problem which was in the "Montreal" word. It was written in French like "Montréal" but the SPARQL query does not accept the French letters. So I wrote Montreal "Montr%C3%A9al" to get the result.

PREFIX dbpo: <http://dbpedia.org/ontology/>
SELECT distinct ?MontrealAirportsA as ?MontrealAirports
WHERE {
?MontrealAirportsA a dbpo:Airport.
FILTER (REGEX (STR (?MontrealAirportsA),"Montr%C3%A9al")).
}

I wrote this answer which might help some one else.

Raid

permanent link

answered 07 Mar '12, 19:10

MR%20BIG's gravatar image

MR BIG
636
accept rate: 0%

Thank you for posting the solution. As far as i understand you can mark your own answer as accepted.

(07 Mar '12, 21:11) oesxyl oesxyl's gravatar image

Thank you zazi for your response, your solution is better but does not give me the whole data. But combining your idea with mine, it will give use the thing that we are looking for.

Please see the result of the following query.

PREFIX onto: <http://dbpedia.org/ontology/>
PREFIX resu: <http://dbpedia.org/resource/>
PREFIX yago: <http://dbpedia.org/class/yago/>

SELECT Distinct ?MontrealAitportsC as ?MontrealAitports

WHERE {
{?MontrealAitportsC a onto:Airport .
{?MontrealAitportsC onto:location resu:Montreal .} UNION
{?MontrealAitportsC onto:location ?street .
?street a yago:StreetsInMontreal .} UNION
{?MontrealAitportsC rdf:type onto:Airport
FILTER (REGEX (STR (?MontrealAitportsC ),"Montr%C3%A9al"))}}
}

I am posting this in case that anyone might get benefits from it.

permanent link

answered 09 Mar '12, 23:20

MR%20BIG's gravatar image

MR BIG
636
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×149
×26

question asked: 07 Mar '12, 16:51

question was seen: 1,129 times

last updated: 09 Mar '12, 23:20