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

Update bf_work.py - added SPARQL for bf:genreForm #242

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update bf_work.py - fixed bad SPARQL in genreForm query
kallimathios authored Dec 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c09d7b4a2717ca8a70a383c7aeb72820d4d9ec73
7 changes: 7 additions & 0 deletions ils_middleware/tasks/folio/mappings/bf_work.py
Original file line number Diff line number Diff line change
@@ -80,6 +80,13 @@
OPTIONAL {{
?subject_node rdfs:label ?subject .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The genre SPARQL query template should be it's own variable instead being a part of the subject variable otherwise it is an invalid SPARQL query, i.e.

genre = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?genre
WHERE {{
    <{bf_work}> a bf:Work .
    <{bf_work}> bf:genreForm ?genre_node .
    OPTIONAL {{
        ?genre_node rdfs:label ?genre .
    }}
}}"""

You'll then need to add the new genre template to the following places:

  • build.py's transformers dict, something like genre: _subjects,
  • map.py's BF_TO_FOLIO_MAP

}}
"""

genre = """PREFIX bf: <http://id.loc.gov/ontologies/bibframe/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?genre
WHERE {{
<{bf_work}> a bf:Work .