-
Notifications
You must be signed in to change notification settings - Fork 4
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
refactor(xmlupload): serialise file values with rdflib #1288
base: main
Are you sure you want to change the base?
refactor(xmlupload): serialise file values with rdflib #1288
Conversation
…r-xmlupload-create-filevalues-as-rdf-graph
…graph # Conflicts: # src/dsp_tools/commands/xmlupload/make_rdf_graph/make_values.py
|
||
properties_graph, last_prop_name = make_values(resource.properties, resource.restype, res_bnode, lookup) | ||
|
||
if resource.iiif_uri: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not great here. When we change the de-serialisation of the iiif-uri and bitstream because of the meta-data. I will take care that we don't need to do so much transformations here. Doing this here though instead of the make_iiif_uri_value_graph
is so that this one does not need to change.
file_g, last_prop_name = make_file_value_graph(bitstream_information, res_bnode) | ||
properties_graph += file_g | ||
|
||
if last_prop_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This we only need as long as we don't have the new API, afterwards we don't need to return it.
@@ -48,42 +36,40 @@ | |||
from dsp_tools.utils.logger_config import WARNINGS_SAVEPATH | |||
|
|||
|
|||
def make_values(resource: XMLResource, res_bnode: BNode, lookup: Lookups) -> dict[str, Any]: | |||
def make_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I took out the IIIF info from the generic values we don't need the entire resource anymore.
|
||
|
||
@dataclass | ||
class FileValueMetadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modeled this as a class so that we can add the license / copyright easily.
Returns: | ||
Graph with the IIIF-URI Value | ||
""" | ||
g = _make_abstract_file_value_graph(iiif_uri, IIIF_URI_VALUE, res_bn, KNORA_API.fileValueHasExternalUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only file value that has a different property.
return g | ||
|
||
|
||
def _add_metadata(file_bn: BNode, metadata: FileValueMetadata) -> Graph: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be expanded easily for the license / copyright
No description provided.