DebugQueries: Difference between revisions

(→‎Orphans: change name)
(added: Orphans)
Line 114: Line 114:
}}
}}


== Unlinked ==
== No Links ==
''' Returns all Graph-items, that don't link to any other items and are not linked to in return.''' Does not return items used to structure the graph, such as [[Item:Q325|Essential]]
''' Returns all Graph-items, that don't link to any other items and are not linked to in return.''' Does not return items used to structure the graph, such as [[Item:Q325|Essential]]
{{#widget:SPARQLquery|code=
{{#widget:SPARQLquery|code=
Line 219: Line 219:
}
}
ORDER BY DESC(strlen(str(?itemLabel))) LIMIT 50
ORDER BY DESC(strlen(str(?itemLabel))) LIMIT 50
}}
== Orphans ==
'''Returns all items that have no Properties.''' Excludes all Property-Items, such as [[Property:P1|depends on]]
{{#widget:SPARQLquery|code=
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel ?property
WHERE {
  ?item rdfs:label ?itemLabel. # Select all item with labels
  #MINUS {?item wdt:P1 [].} # one by one
  # Remove all items that have a propery
  MINUS {?item ?predicate ?value.
        ?property wikibase:directClaim ?predicate}
  MINUS {?item wikibase:directClaim ?property} # remove Properties
  service wikibase:label { bd:serviceParam wikibase:language "en" }
}
}}
}}

Revision as of 12:25, 22 August 2023

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

Useful Queries

A List of accessible queries, that are useful to understand the structure of the graph and identify problems, such as missing links. They can be changed as needed.

Backlinks

A query that finds all backlinks to a specific item.

Items used: Polygons (Q108)


#defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?subject ?subjectLabel ?item ?itemLabel { # ?property ?propertyLabel
  values (?item) {(wd:Q108)}
  ?subject ?predicate ?item .
  ?property wikibase:directClaim ?predicate
  service wikibase:label { bd:serviceParam wikibase:language "en" }
}

Try it!



Missing Properties

Resources

No Resources

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

Unlinked Resources

Returns all resources, that have not been linked to any item yet.

Instance-less Resources

Returns all Resources that have no Property instance of.

No Subclass

Returns all Items, that don't have a property subclass.

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.

No Links

Returns all Graph-items, that don't link to any other items and are not linked to in return. Does not return items used to structure the graph, such as Essential

No Description

Returns all items without a description.

No Instance

Returns all items that have and their Property instance of. Shows which items are not, e.g. Applications.


Access to Items

Queries that find items with specific proterties for an easier overview.

Quizzes

Returns all Items that are Quizzes.

Resources

Returns all Resources.

Labels

Returns the items with the longest Labels (50). Doesn't return Resources.

Here it could be useful to find shorter alias for the items, for easier viewing in a visualisation.

Orphans

Returns all items that have no Properties. Excludes all Property-Items, such as depends on