query-ce74e1f2fbebbf28abd5f56ccf453cc6

rq turtle/ttl

Marinha sem fotos SELECT ?item ?itemLabel ?serv ?servret WHERE { ?item wdt:P31 ?inst . # instance classe navio e subclasses
?item wdt:P137 wd:Q588089 . # operator portuguese navy

    ?item wdt:P137 ?navy . # Must be of a ca
   OPTIONAL {    ?item wdt:P729   ?serv     . }    # operator portuguese navy

   OPTIONAL {    ?item wdt:P730   ?servret     . }    # operator portuguese navy
    FILTER NOT EXISTS  {     ?item wdt:P18 ?foto .  } # operator portuguese navy 
  optional {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Marinha sem fotos
SELECT  ?item ?itemLabel ?serv ?servret 
WHERE 
{
  ?item wdt:P31 ?inst . # instance classe navio e subclasses  
      ?item wdt:P137 wd:Q588089 . # operator portuguese navy  

        ?item wdt:P137 ?navy . # Must be of a ca
       OPTIONAL {    ?item wdt:P729   ?serv     . }    # operator portuguese navy

       OPTIONAL {    ?item wdt:P730   ?servret     . }    # operator portuguese navy
        FILTER NOT EXISTS  {     ?item wdt:P18 ?foto .  } # operator portuguese navy 
      optional {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?comm") v2("?foto") v3("?inst") v1("?item"):::projected v4("?navy") v5("?serv"):::projected v6("?servret"):::projected c9([https://commons.wikimedia.org/]):::iri c11(["bd:serviceParam"]):::iri c4(["wd:Q588089"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P18"--> e0v2 e0v2("?foto"):::projected e0v1("?item"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 v1 --"wdt:P18"--> v2 v1 --"wdt:P31"--> v3 v1 --"wdt:P137"--> c4 v1 --"wdt:P137"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P729".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P730".-> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v7 -."schema:about".-> v1 v7 --"schema:isPartOf"--> c9 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end