Jump to content

DebugQueries: Difference between revisions

Leonie (talk | contribs)
Created page + added 3 debug queries
 
Leonie (talk | contribs)
m added: Orphans
Line 63: Line 63:


----
----
== 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=
# All items that don't linkt to another item (no dependency)
#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" }
}
}}

Revision as of 13:39, 18 August 2023

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.

Note: Only searches through items that have a subclass, to avoid duplicates {{#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 ?source ?sourceLabel ?resource ?resourceLabel WHERE {

 # Selects all items that have a subclass (as all should) that do not have a resource 
 ?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 ?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" }

} }}