Template:Sparql company page

From solab
Jump to navigation Jump to search
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dcterms: <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/>
SELECT 
     #?id 
            #concat("", ?name, "") as ?Name
             ?name
             ?h
            # concat("", ?h, "") as ?Homepage
            #concat("", ?c, "") as ?City
           ?c
     ?thumbnail
     #       concat("[", ?thumbnail, "]") as ?Thumbnail
            (group_concat(distinct concat("",?p,"");separator=",\n") as ?Product)
      #   (group_concat(distinct concat("",?ob,"");separator=",\n") as ?Subjects)
      (group_concat(distinct concat("",?ob,"");separator=",\n") as ?Subjects)
            #?ob
            #?s
       WHERE {
VALUES ?s {dbr:Sparql_company_page}
      OPTIONAL { ?s dbo:wikiPageID ?id}
       OPTIONAL {?s dct:subject ?sob.
                 ?sob rdfs:label ?ob .
                 FILTER (lang(?ob) = 'en')
                } 
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')
}
group by ?id ?c ?name ?h ?thumbnail  #?ob #?s
#group by  ?c ?name ?h ?thumbnail #?s