query-ce85862d6f87dc9b6fc8adc0dff067f5
Books or suclasses of books (NOT editions) written in a language the author, supposedly, can't write SELECT DISTINCT ?work ?workLabel ?worklangLabel ?authorLabel ?knownlanguagesLabel ?nativelanguageLabel WHERE {
#Work is an instance or any subclass of book ?work wdt:P31/wdt:P279* wd:Q571 .
#Work is an instance of whatever ?work wdt:P31 ?what .
#BUT is not an instance of a version, translation or edition FILTER ( ?what != wd:Q3331189 )
#Show inception date of the work if available OPTIONAL { ?work wdt:P571 ?date . BIND(YEAR( ?date ) as ?year) }
#Get the language of the work ?work wdt:P407 ?worklang .
#AND the author ?work wdt:P50 ?author .
# Be sure author has almost one value for native language OR language known, written, etc. { ?author wdt:P1412 ?knownlanguages . } UNION { ?author wdt:P103 ?nativelanguage . }
FILTER NOT EXISTS { # Author doesn't know ?worklang { ?author wdt:P1412 ?worklang . }
# OR ?worklang is his native language UNION { ?author wdt:P103 ?worklang . }
# OR ?worklang is not a subclass of his known languages UNION { ?author wdt:P1412 ?knownlanguages . ?knownlanguages wdt:P279* ?worklang . }
# OR ?worklang is not a subclass of his native language UNION { ?author wdt:P103 ?nativelanguage . ?nativelanguage wdt:P279* ?worklang . } }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Books or suclasses of books (NOT editions) written in a language the author, supposedly, can't write
SELECT DISTINCT ?work ?workLabel ?worklangLabel ?authorLabel ?knownlanguagesLabel ?nativelanguageLabel WHERE {
#Work is an instance or any subclass of book
?work wdt:P31/wdt:P279* wd:Q571 .
#Work is an instance of whatever
?work wdt:P31 ?what .
#BUT is not an instance of a version, translation or edition
FILTER ( ?what != wd:Q3331189 )
#Show inception date of the work if available
OPTIONAL { ?work wdt:P571 ?date . BIND(YEAR( ?date ) as ?year) }
#Get the language of the work
?work wdt:P407 ?worklang .
#AND the author
?work wdt:P50 ?author .
# Be sure author has almost one value for native language OR language known, written, etc.
{ ?author wdt:P1412 ?knownlanguages . } UNION { ?author wdt:P103 ?nativelanguage . }
FILTER NOT EXISTS {
# Author doesn't know ?worklang
{ ?author wdt:P1412 ?worklang . }
# OR ?worklang is his native language
UNION { ?author wdt:P103 ?worklang . }
# OR ?worklang is not a subclass of his known languages
UNION { ?author wdt:P1412 ?knownlanguages . ?knownlanguages wdt:P279* ?worklang . }
# OR ?worklang is not a subclass of his native language
UNION { ?author wdt:P103 ?nativelanguage . ?nativelanguage wdt:P279* ?worklang . }
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}