Project:SPARQL/examples: Difference between revisions

Line 1,750: Line 1,750:
}
}
order by ?property
order by ?property
</sparql>
==== Of these, which are properties for public and professional activities? ====
<sparql tryit="1">
# which properties have corresponding wikidata IDs, restricted to properties that are instance of PPA (P12 / Q151)
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?property  ?label (if(bound(?wikidata_id), "yes", "no") as ?has_wikidata) ?wikidata_id ?propertyType
WHERE {
  ?property a wikibase:Property ;
              wikibase:propertyType ?propertyType . # datatype
  optional { ?property rdfs:label ?en . filter(lang(?en)="en").  }
  optional { ?property rdfs:label ?engb . filter(lang(?engb)="en-gb").  } 
  BIND(COALESCE(?en, ?engb) AS ?label).
 
  optional { ?property bnwdt:P117 ?wikidata_id . }  # wikidata P117
 
  ?property bnwdt:P12 bnwd:Q151. # instance of PPA
}
order by ?label
</sparql>
</sparql>


579

edits