Jump to content

DebugQueries

Revision as of 13:56, 18 August 2023 by Leonie (talk | contribs) (→No Resources: fixed description)

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

Missing Properties

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". }

} }}


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 ?resource ?resourceLabel 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 ?resource ?resourceLabel 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 ?resource ?resourceLabel 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" }

} }}