Difference between revisions of "Snapquery Query Experiment 2025-12-03"
Jump to navigation
Jump to search
(Created page with "= Prompt = <pre> Given https://gitingest.com/ of https://github.com/WolfgangFahl/pyLodStorage and the example query In which films directed by Garry Marshall was Julia Roberts...") |
|||
| Line 136: | Line 136: | ||
} | } | ||
LIMIT $limit$ | LIMIT $limit$ | ||
| + | </source> | ||
| + | = Grok 4 = | ||
| + | === Endpoints.yaml === | ||
| + | <source lang='yaml'> | ||
| + | # endpoints.yaml | ||
| + | # Configuration for SPARQL endpoints | ||
| + | wikidata: | ||
| + | name: Wikidata | ||
| + | endpoint: https://query.wikidata.org/sparql | ||
| + | lang: sparql | ||
| + | website: https://query.wikidata.org/ | ||
| + | method: GET | ||
| + | |||
| + | dbpedia: | ||
| + | name: DBpedia | ||
| + | endpoint: http://dbpedia.org/sparql | ||
| + | lang: sparql | ||
| + | website: https://dbpedia.org/sparql | ||
| + | method: GET | ||
| + | </source> | ||
| + | |||
| + | === queries.yaml === | ||
| + | <source lang='yaml'> | ||
| + | # Parameterized queries for films directed by a specified director starring a specified actor | ||
| + | |||
| + | films_by_director_starring_actor_wikidata: | ||
| + | title: Films directed by {director} starring {actor} | ||
| + | query: | | ||
| + | SELECT ?film ?filmLabel WHERE { | ||
| + | ?film wdt:P31 wd:Q11424 . # instance of film | ||
| + | ?film wdt:P57 wd:{director} . | ||
| + | ?film wdt:P161 wd:{actor} . | ||
| + | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
| + | } | ||
| + | lang: sparql | ||
| + | endpoints: | ||
| + | - wikidata | ||
| + | parameters: | ||
| + | - director | ||
| + | - actor | ||
| + | |||
| + | films_by_director_starring_actor_dbpedia: | ||
| + | title: Films directed by {director} starring {actor} | ||
| + | query: | | ||
| + | SELECT ?film WHERE { | ||
| + | ?film a dbo:Film . | ||
| + | ?film dbo:director dbr:{director} . | ||
| + | ?film dbo:starring dbr:{actor} . | ||
| + | } | ||
| + | lang: sparql | ||
| + | endpoints: | ||
| + | - dbpedia | ||
| + | parameters: | ||
| + | - director | ||
| + | - actor | ||
</source> | </source> | ||
Revision as of 10:54, 3 December 2025
Prompt
Given https://gitingest.com/ of https://github.com/WolfgangFahl/pyLodStorage and the example query In which films directed by Garry Marshall was Julia Roberts starring? from the paper Understanding the structure of knowledge graphs with ABSTAT profiles https://journals.sagepub.com/doi/pdf/10.3233/SW-223181 create an endpoints.yaml with potential sources such as wikidata and dbpedia and a queries.yaml with parameterized queries that allow to specify director and actor.
⚠️ LLM-generated content notice: Parts of this page may have been created or edited with the assistance of a large language model (LLM). The prompts that have been used might be on the page itself, the discussion page or in straight forward cases the prompt was just "Write a mediawiki page on X" with X being the page name. While the content has been reviewed it might still not be accurate or error-free.
Results
Gemin3 Pro Preview
Based on the pyLodStorage repository structure and the example query about films directed by Garry Marshall starring Julia Roberts, here are the two YAML configuration files:
Endpoints.yaml
# SPARQL Endpoints Configuration
endpoints:
wikidata:
name: wikidata
endpoint: https://query.wikidata.org/sparql
website: https://query.wikidata.org
lang: sparql
method: POST
database: wikidata
prefixes: |
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
dbpedia:
name: dbpedia
endpoint: https://dbpedia.org/sparql
website: https://dbpedia.org/sparql
lang: sparql
method: POST
database: dbpedia
prefixes: |
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
queries.yaml
# Query Definitions
queries:
films_by_director_and_actor_wd:
name: films_by_director_and_actor_wd
title: Films by Director and Actor (Wikidata)
description: |
Finds films directed by a specific director and starring a specific actor.
Example: In which films directed by Garry Marshall was Julia Roberts starring?
lang: sparql
endpoint: wikidata
formats:
- "*:wikidata"
params:
- name: director
type: string
default: "Garry Marshall"
- name: actor
type: string
default: "Julia Roberts"
query: |
SELECT DISTINCT ?film ?filmLabel ?year WHERE {
?directorEntity rdfs:label ?directorLabel .
FILTER(LANG(?directorLabel) = "en" && LCASE(STR(?directorLabel)) = LCASE("$director$"))
?actorEntity rdfs:label ?actorLabel .
FILTER(LANG(?actorLabel) = "en" && LCASE(STR(?actorLabel)) = LCASE("$actor$"))
?film wdt:P31 wd:Q11424 . # instance of film
?film wdt:P57 ?directorEntity . # director
?film wdt:P161 ?actorEntity . # cast member
OPTIONAL { ?film wdt:P577 ?pubDate .
BIND(YEAR(?pubDate) AS ?year) }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?year
films_by_director_and_actor_dbpedia:
name: films_by_director_and_actor_dbpedia
title: Films by Director and Actor (DBpedia)
description: |
Finds films directed by a specific director and starring a specific actor using DBpedia.
Example: In which films directed by Garry Marshall was Julia Roberts starring?
lang: sparql
endpoint: dbpedia
params:
- name: director
type: string
default: "Garry_Marshall"
- name: actor
type: string
default: "Julia_Roberts"
query: |
SELECT DISTINCT ?film ?title ?year WHERE {
?film a dbo:Film ;
dbo:director dbr:$director$ ;
dbo:starring dbr:$actor$ .
OPTIONAL { ?film rdfs:label ?title . FILTER(LANG(?title) = "en") }
OPTIONAL { ?film dbo:releaseDate ?releaseDate .
BIND(YEAR(?releaseDate) AS ?year) }
}
ORDER BY ?year
films_by_director_and_actor_generic:
name: films_by_director_and_actor_generic
title: Films by Director and Actor (Generic)
description: |
Generic parameterized query to find films by director and actor.
Can be used with different SPARQL endpoints.
lang: sparql
params:
- name: director
type: string
required: true
description: "Name of the film director"
- name: actor
type: string
required: true
description: "Name of the actor/actress"
- name: limit
type: integer
default: 100
description: "Maximum number of results"
query: |
# Query to be adapted based on endpoint
# This is a template - modify based on your chosen endpoint
SELECT DISTINCT ?film ?filmLabel ?year WHERE {
# Add endpoint-specific patterns here
# Use $director$ and $actor$ as parameter placeholders
}
LIMIT $limit$
Grok 4
Endpoints.yaml
# endpoints.yaml
# Configuration for SPARQL endpoints
wikidata:
name: Wikidata
endpoint: https://query.wikidata.org/sparql
lang: sparql
website: https://query.wikidata.org/
method: GET
dbpedia:
name: DBpedia
endpoint: http://dbpedia.org/sparql
lang: sparql
website: https://dbpedia.org/sparql
method: GET
queries.yaml
# Parameterized queries for films directed by a specified director starring a specified actor
films_by_director_starring_actor_wikidata:
title: Films directed by {director} starring {actor}
query: |
SELECT ?film ?filmLabel WHERE {
?film wdt:P31 wd:Q11424 . # instance of film
?film wdt:P57 wd:{director} .
?film wdt:P161 wd:{actor} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
lang: sparql
endpoints:
- wikidata
parameters:
- director
- actor
films_by_director_starring_actor_dbpedia:
title: Films directed by {director} starring {actor}
query: |
SELECT ?film WHERE {
?film a dbo:Film .
?film dbo:director dbr:{director} .
?film dbo:starring dbr:{actor} .
}
lang: sparql
endpoints:
- dbpedia
parameters:
- director
- actor