Template:Sparql category

From solab
Jump to navigation Jump to search
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbrcat: <http://dbpedia.org/resource/Category:>
SELECT 
            #?id 
            # concat("", ?name, "") as ?Name
            ?name
            #concat("", ?h, "") as ?Homepage
            #concat("", ?c, "") as ?City
            #concat("[", ?thumbnail, "]") as ?Thumbnail
            #(group_concat(concat("",?p,"");separator=",\n") as ?Product)
            #?s
            ?oc
            # concat("", ?o, "") as ?CompanyName
            ?o
    ?b
    #?c
  WHERE {
       VALUES ?s {dbrcat:Sparql_category}
       VALUES ?b { 1 1}
       OPTIONAL {?oc dct:subject ?s.
                 ?oc rdfs:label ?o .
                 FILTER (lang(?o) = 'en')
                }        
       OPTIONAL { ?s dbo:wikiPageID ?id}
       OPTIONAL { ?s dbo:abstract ?label}
       OPTIONAL { ?s dbp:name ?name }
       OPTIONAL { ?s dbp:commonName ?name }
       OPTIONAL { ?s foaf:name ?name }
       OPTIONAL { ?s rdfs:label ?name }
       OPTIONAL { ?s foaf:homepage ?h }
       OPTIONAL { ?s dbo:locationCity ?sc .
                  ?sc rdfs:label ?c .
                }
       OPTIONAL { ?s dbp:hqLocationCity ?sc .
                  ?sc rdfs:label ?c .
                 FILTER (lang(?c) = 'en')
                }
       OPTIONAL { ?s dbo:thumbnail ?thumbnail }
       OPTIONAL { ?s dbo:product ?sp . 
                  ?sp rdfs:label ?p .
                 FILTER (lang(?p) = 'en')
                  }
       FILTER (lang(?label) = 'en')
       FILTER (lang(?c) = 'en')
}