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

refactor(xmlupload): serialise file values with rdflib #1288

Open
wants to merge 91 commits into
base: main
Choose a base branch
from

Conversation

Nora-Olivia-Ammann
Copy link
Collaborator

No description provided.


properties_graph, last_prop_name = make_values(resource.properties, resource.restype, res_bnode, lookup)

if resource.iiif_uri:
Copy link
Collaborator Author

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:
Copy link
Collaborator Author

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(
Copy link
Collaborator Author

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:
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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:
Copy link
Collaborator Author

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

@Nora-Olivia-Ammann Nora-Olivia-Ammann marked this pull request as ready for review November 21, 2024 14:40
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.

1 participant