Template:Sparql ask

From solab
Revision as of 19:57, 22 April 2009 by 127.0.0.1 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{{#gu_gen: sparql | http://dbpedia.org/sparql |root |

PREFIX dbpedia: <http://dbpedia.org/property/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
SELECT ?lab ?label_en ?label_de ?label_it ?page
WHERE {
{
  <http://dbpedia.org/resource/{{{cat1}}}> rdfs:label ?lab  .
?subject skos:subject <http://dbpedia.org/resource/{{{cat1}}}> .
 OPTIONAL {?subject foaf:page ?page .}. 
}
UNION
{  
 <http://dbpedia.org/resource/{{{cat2}}}> rdfs:label ?lab  .
?subject skos:subject <http://dbpedia.org/resource/{{{cat2}}}> .
 OPTIONAL {?subject foaf:page ?page .}. }
    OPTIONAL {
        ?subject rdfs:label  ?label_en .
        FILTER (LANG(?label_en) = 'en') .
    }
    OPTIONAL {
    ?subject rdfs:label  ?label_it .
        FILTER (LANG(?label_it) = 'it') .
    }
   OPTIONAL {
    ?subject rdfs:label  ?label_de .
        FILTER (LANG(?label_de) = 'de') .
    }

} |{{{notrace}}} }}