1

Wikidata provides query browser at https://query.wikidata.org

I want to display films all fields. I tried with using * but its not working. Does anybody know how to display all fields of the data for Films?

Image

logi-kal
  • 7,107
  • 6
  • 31
  • 43
SUNIL SABALE
  • 65
  • 1
  • 7
  • 3
    Well, you should also select the properties + values then, or not? I mean, the whole idea of the query is to select what you want by defining the patterns with the appropriate variables. Did you look at any RDF and SPARQL tutorial? Do you understand the meaning of `?film ?p ?o .` ? – UninformedUser Sep 26 '18 at 06:47
  • Thanks AKSW, the thing is I want to get all fields data related to film. Film has, title, publication date, actors, casts etc. I dont want to mention which field I want, rather want to get data for all fields. – SUNIL SABALE Sep 26 '18 at 06:53
  • So one more time, do you understand the meaning of `?film ?p ?o .` ? – UninformedUser Sep 26 '18 at 07:49
  • Unfortunately nope – SUNIL SABALE Sep 26 '18 at 08:39
  • Something like [this](https://query.wikidata.org/#SELECT%20%3Ffilm%20%3FfilmLabel%20%3Fp%20%3Fp_Label%20%3Fo%20%3FoLabel%20WHERE%20%7B%0A%20%20hint%3AQuery%20hint%3Aoptimizer%20%22None%22%20.%20%0A%20%20%3Fp_%20wikibase%3AdirectClaim%20%3Fp%0A%20%20%7B%0A%20%20select%20%3Ffilm%20%7B%3Ffilm%20wdt%3AP31%20wd%3AQ11424%7D%20limit%20100%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%7D.%0A%20%20%3Ffilm%20%3Fp%20%3Fo%20.%20%0A%7D). If you want to display all possible properties as headers, I'm afraid, it is not possible... – Stanislav Kralin Sep 26 '18 at 19:31
  • Thanks Stanislav. Isnt there any alternate way to get this? – SUNIL SABALE Sep 27 '18 at 04:40
  • You can use e.g. python's `sparqlwrapper` and @StanislavKralin ' s query to get a table and then reformat it e.g. using `pandas`. Your desired output format is not entirely clear so it is difficult to help further. – Cleb Sep 27 '18 at 08:51
  • @Cleb, IMHO, [wdqs](https://github.com/yuvipanda/python-wdqs) is more convenient than SPARQLWrapper for Wikidata. [Example](http://paws-public.wmflabs.org/paws-public/User:luitzen/Human%20properties.ipynb) – Stanislav Kralin Sep 27 '18 at 09:42
  • @StanislavKralin: Thanks, will take a look. So far I am quite happy with the sparqlwrapper, also reasoning is [quite easy to use](https://stackoverflow.com/questions/43695589/how-can-i-tell-stardog-to-use-inference-when-querying-it-through-sparqlwrapper/51610142#51610142), but I am always glad to test new tools :) – Cleb Sep 27 '18 at 09:48
  • It is possible to prepare a query with tons of `OPTIONAL`s, but your table will have very many columns. See e. g. [this questions](https://stackoverflow.com/q/49862258/7879193) about possible properties of 'humans' (Q5). – Stanislav Kralin Sep 27 '18 at 11:56

1 Answers1

1

To work with SPARQL is necessary to understand some concepts, as @AKSW said in the comments of the question. If you don't understand the meaning of ?film ?p ?o. This is called triple¹ and is composed by subject-predicate-object. E. g., in the case of the films, it could be: x is a film. This is what you are querying in the Wikidata Query Service (WDQS) when you use ?film wdt:P31 wd:Q11424.

I think it isn't possible to display all the property-values of an item. In addition it probably could cause a timeout because there is many statements of many items.

If you want to check the property-values of all the films in Wikidata I think an option might be you write or find a script to extract the items with P31-Q11424 (instance of films). For that, the accessing data section could be useful (e. g. with pywikibot you could query and extract what you want).

If you are interested in SPARQL and WDQS I recommend you to read some help resources:

Edit

  1. When I answer it I wrote triplestore and linked it to its respective page in the Wikipedia in English, but after the comment of @AKSW I consider I was wrong because the triplestore is the concept which is used to refer to the storage and retrieval of triple or semantic triple, "a set of three entities that codifies a statement about semantic data in the form of subject–predicate–object expressions" (from Semantic triple page in Wikipedia in English).
Ivanhercaz
  • 731
  • 1
  • 11
  • 31
  • 2
    *"This is called triplestore and is composed by subject-predicate-object."* - well, I'd call it *triple pattern* but never triple store ... – UninformedUser Sep 27 '18 at 09:04
  • Thanks Ivan. That really helped. – SUNIL SABALE Sep 27 '18 at 12:06
  • @AKSW, this concept always confuse me due the variety of names I have read for triple, not only in English (triplestore, triple, RDF store, etc.), also in Spanish (triple, tripleta, tienda de RDF, etc. I don't know which one would be more correct, I preferred to use the one I read. I understand the triplestore as the "storage" (in few words) and triple as the pattern subject-predicate-object. So reading more about it and considering this, I am going to correct "triplestore" to "triple", because it could be confused. – Ivanhercaz Sep 27 '18 at 18:36
  • You're welcome @SUNILSABALE! But, please, check the first paragraph of the answer, I edited it to clarify the terms triple and triplestore. – Ivanhercaz Sep 27 '18 at 18:46