User talk:Datumizer
Welcome to Wikidata, SharkD!
Wikidata is a free knowledge base that you can edit! It can be read and edited by humans and machines alike and you can go to any item page now and add to this ever-growing database!
Need some help getting started? Here are some pages you can familiarize yourself with:
- Introduction – An introduction to the project.
- Wikidata tours – Interactive tutorials to show you how Wikidata works.
- Community portal – The portal for community members.
- User options – including the 'Babel' extension, to set your language preferences.
- Contents – The main help page for editing and using the site.
- Project chat – Discussions about the project.
- Tools – A collection of user-developed tools to allow for easier completion of some tasks.
Please remember to sign your messages on talk pages by typing four tildes (~~~~); this will automatically insert your username and the date.
If you have any questions, don't hesitate to ask on Project chat. If you want to try out editing, you can use the sandbox to try. Once again, welcome, and I hope you quickly feel comfortable here, and become an active editor for Wikidata.
Best regards! Liuxinyu970226 (talk) 14:27, 26 May 2017 (UTC)
items without some properties
[edit]last time I forgot about nested optionals. I thought it is something intuitive, but it wasn't.
If you encounter similar questions, please ask them. Hopefully, code below is exactly what you want:
The following query uses these:
- Items: Bob's Game (Q4931588) , 64 Hanafuda: Tenshi no Yakusoku (Q1107793) , Battlefleet Gothic: Armada (Q18857304) , Civilization V (Q2385) , God Wars: Future Past (Q23647080)
- Properties: publication date (P577)
SELECT ?game ?date ?statementNodeType ?check0 ?check1 ?check2 ?check3 WHERE { VALUES ?game { wd:Q4931588 # no value wd:Q1107793 # one value wd:Q18857304 # unknown value wd:Q2385 # multiple values wd:Q23647080 # no property } OPTIONAL { ?game p:P577 ?statementNode OPTIONAL { ?statementNode ps:P577 ?date } OPTIONAL { ?statementNode rdf:type ?statementNodeType FILTER (?statementNodeType IN (wdno:P577)) } } BIND(IF(BOUND(?statementNode),true,false) as ?check0) # property is here? BIND(COALESCE(DATATYPE(?date) = xsd:dateTime , false) as ?check1) # real date? BIND(COALESCE((wdno:P577 = ?statementNodeType), false) as ?check2) # no value? BIND(COALESCE(isBlank(?date) , false) as ?check3) # unkown? }