Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow for sameAs links #1451

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sennierer
Copy link
Collaborator

@sennierer sennierer commented Nov 26, 2024

To resolve the sameAs problem described in #819 we need to get the sameAs URIs defined in the RDF files. Other than originally thought not all of them are using owl:sameAs. This PR proposes another attribute in the toml definition that allows to set a sparql query that retrieves sameAs uris. Eg for Persons in Wikidata the definition could look like:

superclass = "apis_ontology.models.Person"
regex = "http://www.wikidata.org.*"
sameas = """
PREFIX wdtn: <http://www.wikidata.org/prop/direct-normalized/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?sameas ?parl_url
WHERE {
?subject wdtn:P227 ?sameas
OPTIONAL {
?subject wdt:P2280 ?parl_nr .
BIND(concat("https://www.parlament.gv.at/WWER/PAD_", str(?parl_nr)) AS ?parl_url)
}
}
"""
[[attributes]]
# name
sparql = """
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?forename
WHERE {
  ?person wdt:P735/rdfs:label ?first_name .
  BIND(?first_name AS ?forename)
}
"""

This fetches the GND link and uses the Parlament Nr to create a link and returns that. As a fallback a query for owl:sameAs is used.
The PR also changes the RootObject to accept the sameas attribute retrieved via the sparql queries (or actually any list of uris) directly via putting them in the sameas attribute.

resolves #819

@sennierer sennierer linked an issue Nov 26, 2024 that may be closed by this pull request
@sennierer sennierer marked this pull request as draft November 26, 2024 14:10
@sennierer sennierer force-pushed the 819-rdf-importer-should-respect-sameas-statements-in-rdf-files branch from bccebcf to bfb72c0 Compare November 27, 2024 09:06
@sennierer
Copy link
Collaborator Author

I will fix the tests when we have finished discussing the proposed changes.

@sennierer sennierer requested a review from b1rger November 27, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RDF importer should respect sameAs statements in RDF files
1 participant