Jump to content

DebugQueries: Difference between revisions

Leonie (talk | contribs)
m →No Resources: fixed description
Leonie (talk | contribs)
Added: Unlinked Resources
Line 4: Line 4:


= Missing Properties =
= Missing Properties =
== No Resources ==
== Resources ==
=== No Resources ===
'''Returns all Items, that don't have any [[Property:P21|resource]] that they link to.'''
'''Returns all Items, that don't have any [[Property:P21|resource]] that they link to.'''


Line 18: Line 19:
   ?source wdt:P2 ?class.
   ?source wdt:P2 ?class.
   MINUS {?source wdt:P21 ?resource.}
   MINUS {?source wdt:P21 ?resource.}
 
  service wikibase:label { bd:serviceParam wikibase:language "en". }
}
}}
----
=== Unlinked Resources ===
'''Returns all resources, that have not been linked to any item yet.'''
{{#widget:SPARQLquery|code=
#Resources that aren't linked
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?source ?sourceLabel ?resource ?resourceLabel
WHERE {
  # select all resources (they have urls)
  ?source wdt:P20 ?url. # 151
  MINUS {
    ?dependency wdt:P21 ?source
  }
    
    
   service wikibase:label { bd:serviceParam wikibase:language "en". }
   service wikibase:label { bd:serviceParam wikibase:language "en". }
Line 32: Line 54:
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?source ?sourceLabel ?resource ?resourceLabel
SELECT DISTINCT ?source ?sourceLabel ?subclass
WHERE {
WHERE {
   ?source wdt:P1 ?dependency.
   ?source wdt:P1 ?dependency.
Line 52: Line 74:
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT ?source ?sourceLabel ?resource ?resourceLabel
SELECT ?source ?sourceLabel ?dependency
WHERE {
WHERE {


Line 72: Line 94:
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT ?source ?sourceLabel ?resource ?resourceLabel
SELECT ?source ?sourceLabel ?dependency
WHERE {
WHERE {



Revision as of 14:20, 18 August 2023

This page contains several SPARQL-Queries to help debug the graph.

Missing Properties

Resources

No Resources

Returns all Items, that don't have any resource that they link to.

{{#widget:SPARQLquery|code=

  1. All Items with no linked resources
  2. defaultView:Table

PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> SELECT DISTINCT ?source ?sourceLabel ?resource ?resourceLabel WHERE {

 # Select all items
 ?source wdt:P1 ?dependency.
 ?source wdt:P2 ?class.
 MINUS {?source wdt:P21 ?resource.}
 
 service wikibase:label { bd:serviceParam wikibase:language "en". }

} }}


Unlinked Resources

Returns all resources, that have not been linked to any item yet. {{#widget:SPARQLquery|code=

  1. Resources that aren't linked
  2. defaultView:Table

PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> SELECT DISTINCT ?source ?sourceLabel ?resource ?resourceLabel WHERE {

 # select all resources (they have urls)
 ?source wdt:P20 ?url. # 151
 MINUS { 
   ?dependency wdt:P21 ?source
 }
 
 service wikibase:label { bd:serviceParam wikibase:language "en". }

} }}


No Subclass

Returns all Items, that don't have a property subclass. {{#widget:SPARQLquery|code=

  1. All Items no subclass
  2. defaultView:Table

PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> SELECT DISTINCT ?source ?sourceLabel ?subclass WHERE {

 ?source wdt:P1 ?dependency.
 MINUS {?source wdt:P2 ?class. }
 
 service wikibase:label { bd:serviceParam wikibase:language "en" }

} }}


No Dependencies

Returns all Items, that don't link any other items as dependency.

These items don't have a property depends on. This could mean, that they are a source or that they are orphaned. {{#widget:SPARQLquery|code=

  1. All items that don't linkt to another item (no dependency)
  2. defaultView:Table

PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> SELECT ?source ?sourceLabel ?dependency WHERE {

 ?source wdt:P2 ?class.
 MINUS {?source wdt:P1 ?dependency.}
 
 service wikibase:label { bd:serviceParam wikibase:language "en" }

} }}


Orphans

Returns all items, that don't link to any other items and are not linked to in return.

NOTE: Not sure if this works. {{#widget:SPARQLquery|code=

  1. All items that don't linkt to another item (no dependency)
  2. defaultView:Table

PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> SELECT ?source ?sourceLabel ?dependency WHERE {

 ?source wdt:P2 ?class. # get all items that have a subclass.
 MINUS {?dependency wdt:P1 ?source}. # Remove all items that have the ?source as a dependency
 MINUS {?source wdt:P1 ?dependency}. # Remove all items that have a dependency
 
 service wikibase:label { bd:serviceParam wikibase:language "en" }

} }}