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
8 changes: 8 additions & 0 deletions ils_middleware/tasks/folio/mappings/bf_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
<{bf_work}> bf:subject ?subject_node .
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

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

}}
"""