Difference between revisions of "Truly Tabular RDF"

From BITPlan Wiki
Jump to navigation Jump to search
(Created page with "= Example Scientific Events and locations = <source lang='sparql'> # location ( https://www.wikidata.org/wiki/Property:P276 ):7244 # Count all items with the given location (...")
 
Line 16: Line 16:
 
</source>
 
</source>
 
[https://query.wikidata.org/#%23%20location%20%28%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP276%20%29%3A7244%0A%23%20Count%20all%20items%20with%20the%20given%20location%20%28%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP276%20%29%3A%0A%23%20and%20type%20academic%20conference%28Q2020153%29%3Ahttps%3A%2F%2Fwww.wikidata.org%2Fwiki%2FQ2020153%0ASELECT%20%3Fitem%20%28COUNT%20%28%3Fvalue%29%20AS%20%3Fcount%29%0AWHERE%0A%7B%0A%20%20%23%20instance%20of%20academic%20conference%0A%20%20%3Fitem%20wdt%3AP31%20wd%3AQ2020153.%0A%20%20%23%20location%0A%20%20%3Fitem%20wdt%3AP276%20%3Fvalue.%0A%7D%20GROUP%20by%20%3Fitem%0AHAVING%20%28COUNT%20%28%3Fvalue%29%20%3E%201%29%0AORDER%20BY%20DESC%28%3Fcount%29%0A try it!]
 
[https://query.wikidata.org/#%23%20location%20%28%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP276%20%29%3A7244%0A%23%20Count%20all%20items%20with%20the%20given%20location%20%28%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP276%20%29%3A%0A%23%20and%20type%20academic%20conference%28Q2020153%29%3Ahttps%3A%2F%2Fwww.wikidata.org%2Fwiki%2FQ2020153%0ASELECT%20%3Fitem%20%28COUNT%20%28%3Fvalue%29%20AS%20%3Fcount%29%0AWHERE%0A%7B%0A%20%20%23%20instance%20of%20academic%20conference%0A%20%20%3Fitem%20wdt%3AP31%20wd%3AQ2020153.%0A%20%20%23%20location%0A%20%20%3Fitem%20wdt%3AP276%20%3Fvalue.%0A%7D%20GROUP%20by%20%3Fitem%0AHAVING%20%28COUNT%20%28%3Fvalue%29%20%3E%201%29%0AORDER%20BY%20DESC%28%3Fcount%29%0A try it!]
 +
 +
== non tabular entries for academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 ==
 +
 +
=== query ===
 +
<source lang='sparql'>
 +
 +
# Count all academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 items
 +
# with the given location(P276) https://www.wikidata.org/wiki/Property:P276
 +
SELECT ?item (COUNT (?value) AS ?count)
 +
WHERE
 +
{
 +
  # instance of academic conference
 +
  ?item wdt:P31 wd:Q2020153.
 +
  # location
 +
  ?item wdt:P276 ?value.
 +
} GROUP by ?item
 +
HAVING (COUNT (?value) > 1)
 +
ORDER BY DESC(?count)
 +
</source>
 +
 +
 +
=== result ===
 +
{| class="wikitable" style="text-align: left;"
 +
|+ <!-- caption -->
 +
|-
 +
! item                                      !! align="right"|  count
 +
|-
 +
| http://www.wikidata.org/entity/Q8035745  || align="right"|      14
 +
|-
 +
| http://www.wikidata.org/entity/Q107185833 || align="right"|      4
 +
|-
 +
| http://www.wikidata.org/entity/Q107185835 || align="right"|      4
 +
|-
 +
| http://www.wikidata.org/entity/Q1654334  || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q28052808  || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q47912910  || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q94182434  || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q59558053  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q47455387  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q47501061  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48025514  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48025934  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48026643  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48026807  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48026926  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q56683535  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q56872346  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59555142  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59555499  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59558038  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q76721517  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q90027034  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q64955764  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q73025763  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q96749264  || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q104866279 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q104903952 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q106068709 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q106443465 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q107162308 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q107162375 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q107185828 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q107185830 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q106336297 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q108282854 || align="right"|      2
 +
|}
 +
== non tabular entries for academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 ==
 +
 +
=== query ===
 +
<source lang='sparql'>
 +
 +
# Count all academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 items
 +
# with the given proceedings(P4745) https://www.wikidata.org/wiki/Property:P4745
 +
SELECT ?item (COUNT (?value) AS ?count)
 +
WHERE
 +
{
 +
  # instance of academic conference
 +
  ?item wdt:P31 wd:Q2020153.
 +
  # proceedings
 +
  ?item ^wdt:P4745 ?value.
 +
} GROUP by ?item
 +
HAVING (COUNT (?value) > 1)
 +
ORDER BY DESC(?count)
 +
</source>
 +
 +
 +
=== result ===
 +
{| class="wikitable" style="text-align: left;"
 +
|+ <!-- caption -->
 +
|-
 +
! item                                    !! align="right"|  count
 +
|-
 +
| http://www.wikidata.org/entity/Q48027931 || align="right"|      4
 +
|-
 +
| http://www.wikidata.org/entity/Q47912910 || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q48025514 || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q77250365 || align="right"|      3
 +
|-
 +
| http://www.wikidata.org/entity/Q30090453 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q47455387 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48025651 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48025840 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48025934 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48026033 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48612170 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48619834 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q48910401 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q50290385 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q55497473 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59620529 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59917009 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q82290350 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q59917887 || align="right"|      2
 +
|-
 +
| http://www.wikidata.org/entity/Q68277652 || align="right"|      2
 +
|}
 +
----------------------------------------------------------------------

Revision as of 15:45, 14 March 2022

Example Scientific Events and locations

# location ( https://www.wikidata.org/wiki/Property:P276 ):7244
# Count all items with the given location ( https://www.wikidata.org/wiki/Property:P276 ):
# and type academic conference(Q2020153):https://www.wikidata.org/wiki/Q2020153
SELECT ?item (COUNT (?value) AS ?count)
WHERE
{
  # instance of academic conference
  ?item wdt:P31 wd:Q2020153.
  # location
  ?item wdt:P276 ?value.
} GROUP by ?item
HAVING (COUNT (?value) > 1)
ORDER BY DESC(?count)

try it!

non tabular entries for academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153

query

# Count all academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 items
# with the given location(P276) https://www.wikidata.org/wiki/Property:P276 
SELECT ?item (COUNT (?value) AS ?count)
WHERE
{
  # instance of academic conference
  ?item wdt:P31 wd:Q2020153.
  # location
  ?item wdt:P276 ?value.
} GROUP by ?item
HAVING (COUNT (?value) > 1)
ORDER BY DESC(?count)


result

item count
http://www.wikidata.org/entity/Q8035745 14
http://www.wikidata.org/entity/Q107185833 4
http://www.wikidata.org/entity/Q107185835 4
http://www.wikidata.org/entity/Q1654334 3
http://www.wikidata.org/entity/Q28052808 3
http://www.wikidata.org/entity/Q47912910 3
http://www.wikidata.org/entity/Q94182434 3
http://www.wikidata.org/entity/Q59558053 2
http://www.wikidata.org/entity/Q47455387 2
http://www.wikidata.org/entity/Q47501061 2
http://www.wikidata.org/entity/Q48025514 2
http://www.wikidata.org/entity/Q48025934 2
http://www.wikidata.org/entity/Q48026643 2
http://www.wikidata.org/entity/Q48026807 2
http://www.wikidata.org/entity/Q48026926 2
http://www.wikidata.org/entity/Q56683535 2
http://www.wikidata.org/entity/Q56872346 2
http://www.wikidata.org/entity/Q59555142 2
http://www.wikidata.org/entity/Q59555499 2
http://www.wikidata.org/entity/Q59558038 2
http://www.wikidata.org/entity/Q76721517 2
http://www.wikidata.org/entity/Q90027034 2
http://www.wikidata.org/entity/Q64955764 2
http://www.wikidata.org/entity/Q73025763 2
http://www.wikidata.org/entity/Q96749264 2
http://www.wikidata.org/entity/Q104866279 2
http://www.wikidata.org/entity/Q104903952 2
http://www.wikidata.org/entity/Q106068709 2
http://www.wikidata.org/entity/Q106443465 2
http://www.wikidata.org/entity/Q107162308 2
http://www.wikidata.org/entity/Q107162375 2
http://www.wikidata.org/entity/Q107185828 2
http://www.wikidata.org/entity/Q107185830 2
http://www.wikidata.org/entity/Q106336297 2
http://www.wikidata.org/entity/Q108282854 2

non tabular entries for academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153

query

# Count all academic conference(Q2020153) https://www.wikidata.org/wiki/Q2020153 items
# with the given proceedings(P4745) https://www.wikidata.org/wiki/Property:P4745 
SELECT ?item (COUNT (?value) AS ?count)
WHERE
{
  # instance of academic conference
  ?item wdt:P31 wd:Q2020153.
  # proceedings
  ?item ^wdt:P4745 ?value.
} GROUP by ?item
HAVING (COUNT (?value) > 1)
ORDER BY DESC(?count)


result

item count
http://www.wikidata.org/entity/Q48027931 4
http://www.wikidata.org/entity/Q47912910 3
http://www.wikidata.org/entity/Q48025514 3
http://www.wikidata.org/entity/Q77250365 3
http://www.wikidata.org/entity/Q30090453 2
http://www.wikidata.org/entity/Q47455387 2
http://www.wikidata.org/entity/Q48025651 2
http://www.wikidata.org/entity/Q48025840 2
http://www.wikidata.org/entity/Q48025934 2
http://www.wikidata.org/entity/Q48026033 2
http://www.wikidata.org/entity/Q48612170 2
http://www.wikidata.org/entity/Q48619834 2
http://www.wikidata.org/entity/Q48910401 2
http://www.wikidata.org/entity/Q50290385 2
http://www.wikidata.org/entity/Q55497473 2
http://www.wikidata.org/entity/Q59620529 2
http://www.wikidata.org/entity/Q59917009 2
http://www.wikidata.org/entity/Q82290350 2
http://www.wikidata.org/entity/Q59917887 2
http://www.wikidata.org/entity/Q68277652 2