Graph Statistics: Difference between revisions
(→Simple Metrics: combined InDegree- and OutDegree-Query into Degree-Query) |
m (→Degree of Item: query fix (group by...)) |
||
Line 55: | Line 55: | ||
?inItem wdt:P1 ?item. # inDegree | ?inItem wdt:P1 ?item. # inDegree | ||
?item wdt:P1 ?outItem. # outDegree | ?item wdt:P1 ?outItem. # outDegree | ||
} | } | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
} | } group by ?item ?itemLabel | ||
}} | }} | ||
''Change harcoded item to parameter'' | ''Change harcoded item to parameter'' |
Revision as of 08:52, 28 November 2023
A page to help show the structure of the graph using metrics and statistics. For similar pages reference:
Simple Metrics
ItemCount
Gives a count of all items in the Wikibase-instance. Items used: Student (Q167)
Properties used: instance of (P3)
#defaultView:Table
PREFIX wd: <https://graphit.ur.de/entity>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT (COUNT(*) as ?items)
WHERE {
# items that have 0+ statements
?item wikibase:statements ?s.
MINUS{ ?item a wikibase:Property } # Filter out properties
MINUS{ ?item wdt:P3 wd:Q167 } # Filter out students
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} LIMIT 25
Make inline
PropertyCount
Gives a count of all properties in the Wikibase-instance
#defaultView:Table
PREFIX wd: <https://graphit.ur.de/entity>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT (COUNT(*) as ?property)
WHERE {
?property a wikibase:Property.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} LIMIT 28
Make inline
Degree of Item
Gives back the indegree and outdegree of a specific item.
- InDegree = all dependencies (P1) going in to the item
- OutDegree = all dependencies (P1) comming out of an item
To get all edges coming out of an item, change wdt:P1 to ?p. This will include things such as resources and dates.
Items used: Matrix Multiplication (Q93)
Properties used: depends on (P1)
#defaultView:Table
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
Select ?item ?itemLabel # ?degreeLabel
(count(DISTINCT ?inItem) as ?inDegree)
(count(DISTINCT ?outItem) as ?outDegree)
WHERE {
BIND (wd:Q93 as ?item).
OPTIONAL {
?inItem wdt:P1 ?item. # inDegree
?item wdt:P1 ?outItem. # outDegree
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?item ?itemLabel
Change harcoded item to parameter