query-e80ff4a15c83442141ba6b7eeb7bec89

rq turtle/ttl

Encontrar la distancia más corta entre dos nodos, a través de la propiedad P279 (También puede usarse con ?linkType para cualquier relación

Elemento destino "Obra literaria" Q7725634

Uso del servicio GAS

PREFIX gas: http://www.bigdata.com/rdf/gas# SELECT ?depth ?predecessor ?predecessorLabel ?out ?outLabel { SERVICE gas:service { gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.BFS" . gas:program gas:in wd:Q1539532 . # one or more times, specifies the initial frontier. gas:program gas:target wd:Q7725634 . # only retain vertices along paths to these target vertices. gas:program gas:out ?out . # exactly once - will be bound to the visited vertices. gas:program gas:out1 ?depth . # exactly once - will be bound to the depth of the visited vertices. gas:program gas:out2 ?predecessor . # exactly once - will be bound to the predecessor. gas:program gas:maxIterations 6 . # optional limit on breadth first expansion. gas:program gas:maxVisited 2000 . # optional limit on the #of visited vertices. } ?predecessor wdt:P279 ?out . # figure out what link type(s) connect a vertex with a predecessor FILTER(STRSTARTS(STR(?predecessor), "http://www.wikidata.org/entity/Q")) SERVICE wikibase:label { bd:serviceParam wikibase:language "es,en". } } order by desc(?depth) limit 100

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Encontrar la distancia más corta entre dos nodos, a través de la propiedad P279 (También puede usarse con ?linkType para cualquier relación
# Elemento destino "Obra literaria" Q7725634
# Uso del servicio GAS
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
SELECT ?depth ?predecessor ?predecessorLabel ?out ?outLabel {
  SERVICE gas:service {
     gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.BFS" .
     gas:program gas:in wd:Q1539532 . # one or more times, specifies the initial frontier.
     gas:program gas:target wd:Q7725634 . # only retain vertices along paths to these target vertices.
     gas:program gas:out ?out . # exactly once - will be bound to the visited vertices.
     gas:program gas:out1 ?depth . # exactly once - will be bound to the depth of the visited vertices.
     gas:program gas:out2 ?predecessor . # exactly once - will be bound to the predecessor.
     gas:program gas:maxIterations 6 . # optional limit on breadth first expansion.
     gas:program gas:maxVisited 2000 . # optional limit on the #of visited vertices.
  }
  ?predecessor wdt:P279 ?out . # figure out what link type(s) connect a vertex with a predecessor
  FILTER(STRSTARTS(STR(?predecessor), "http://www.wikidata.org/entity/Q"))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "es,en". }
}
order by desc(?depth)
limit 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?depth"):::projected v3("?out"):::projected v2("?predecessor"):::projected c3(["gas:program"]):::iri c21(["es,en"]):::literal c9(["wd:Q7725634"]):::iri c16(["2000^^xsd:integer"]):::literal c5(["com.bigdata.rdf.graph.analytics.BFS"]):::literal c19(["bd:serviceParam"]):::iri c14(["6^^xsd:integer"]):::literal c7(["wd:Q1539532"]):::iri f0[["starts-with(str(?predecessor),'http://www.wikidata.org/entity/Q')"]] f0 --> v2 subgraph s1["http://www.bigdata.com/rdf/gas#service"] style s1 stroke-width:4px; c3 --"gas:gasClass"--> c5 c3 --"gas:in"--> c7 c3 --"gas:target"--> c9 c3 --"gas:out"--> v3 c3 --"gas:out1"--> v1 c3 --"gas:out2"--> v2 c3 --"gas:maxIterations"--> c14 c3 --"gas:maxVisited"--> c16 end v2 --"wdt:P279"--> v3 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c19 --"wikibase:language"--> c21 end