query-2837848a918a5ca7f5319650d449ec9a

rq turtle/ttl

PortsRelated: passenger ship terminalItems of type port

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?wpi ?port ?portLabel ?countryLabel (GROUP_CONCAT(DISTINCT ?unlocode;separator=", ") AS ?unlocodes) ?mt (GROUP_CONCAT(DISTINCT ?website;separator=", ") AS ?websites) (GROUP_CONCAT(DISTINCT ?typeLabel;separator=", ") AS ?types) ?coordinates
  WHERE {
    ?port wdt:P31 wd:Q44782 .
    OPTIONAL { ?port wdt:P17 ?country } .
    OPTIONAL { ?port wdt:P7625 ?wpi } .
    #?port rdf:type wdno:P7625 .
    OPTIONAL { ?port wdt:P1937 ?unlocode } .
    OPTIONAL { ?port wdt:P856 ?website } .
    OPTIONAL { ?port wdt:P625 ?coordinates } .
    OPTIONAL { ?port wdt:P1624 ?mt } .
    FILTER NOT EXISTS {
      ?port p:P31 ?instance_of_statement .
      ?instance_of_statement ps:P31 wd:Q44782 .
      ?instance_of_statement ?qualifier ?value .
      ?prop wikibase:qualifier ?qualifier
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr".
                           ?port rdfs:label ?portLabel .
                           ?type rdfs:label ?typeLabel .
                           ?country rdfs:label ?countryLabel .
                           }
}
GROUP BY ?wpi ?port ?portLabel ?countryLabel ?coordinates ?mt
ORDER BY ASC(?countryLabel) ASC(?portLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?coordinates"):::projected v8("?country") v1("?countryLabel"):::projected v4("?instance_of_statement") v13("?mt"):::projected v3("?port"):::projected v2("?portLabel"):::projected v7("?prop") v5("?qualifier") v14("?type") v15("?typeLabel"):::projected v18("?types") v10("?unlocode"):::projected v16("?unlocodes") v6("?value") v11("?website"):::projected v17("?websites") v9("?wpi"):::projected c15(["#91;AUTO_LANGUAGE#93;,en,de,fr"]):::literal c3(["wd:Q44782"]):::iri c13(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:P31"--> e0v2 e0v2 --"p:statement/P31"--> e0c3 e0v2 -->e0v3--> e0v4 e0v5 --"wikibase:qualifier"--> e0v3 e0v2("?instance_of_statement"):::projected e0v1("?port"):::projected e0v5("?prop"):::projected e0v3("?qualifier"):::projected e0v4("?value"):::projected e0c3(["wd:Q44782"]):::iri end f0--EXISTS--> f0e0 f0 --> v3 f0 --> c1 f0 --> v4 f0 --> c2 f0 --> c3 f0 --> v5 f0 --> v6 f0 --> v7 f0 --> c4 v3 --"p:P31"--> v4 v4 --"p:statement/P31"--> c3 v4 -->v5--> v6 v7 --"wikibase:qualifier"--> v5 v3 --"p:direct/P31"--> c3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P17".-> v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P7625".-> v9 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P1937".-> v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P856".-> v11 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v12 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P1624".-> v13 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 v3 --"rdfs:label"--> v2 v14 --"rdfs:label"--> v15 v8 --"rdfs:label"--> v1 end bind4[/"?unlocode"/] v10 --o bind4 bind4 --as--o v16 bind5[/"?website"/] v11 --o bind5 bind5 --as--o v17 bind6[/"?typeLabel"/] v15 --o bind6 bind6 --as--o v18