Nasser
Nasser

Reputation: 2140

How can I build SPARQL query?

I am currently working on a project that is based on SPARQL and Protege (version 4.2).

The RDFs that I import to Protege are:

http://dbpedia.org/class/yago/AirlinerHijackings

and

http://umbel.org/umbel/rc/AirplaneHijacking.rdf

The ontology that I got in Protege is

enter image description here

As starting point to build my project, I need to query about the names of the flights that were hijacked and the flights that were hijacked between 1980 and 2000 !!

I have tried to write queries but I could not get the right queries

Thanks

Upvotes: 1

Views: 699

Answers (1)

Steve Harris
Steve Harris

Reputation: 3660

You can just do:

PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX yago: <http://dbpedia.org/class/yago/>
SELECT ?h
WHERE {
  ?h a yago:AirlinerHijackings .
  ?h dbpprop:date ?date .
  FILTER(?date >= "1980-01-01"^^xsd:date && ?date < "2001-01-01"^^xsd:date)
}

You can try that query here: http://dbpedia.org/sparql

But you need to somehow import that DBPedia data into Protege, and I have no idea what your ontology is for? It shouldn't be necessary, as you already have the data format defined for you by DBPedia.

Upvotes: 3

Related Questions