Skip to content

Commit

Permalink
feat: update DSP-Tools to support ArchiveRepresentation (DEV-259) (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
BalduinLandolt committed Nov 29, 2021
1 parent 0dc724c commit 85a40c2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/dsp-tools-create.md
Expand Up @@ -1078,6 +1078,7 @@ The following predefined resources are provided by DSP:
- `DDDRepresentation`: An object representing a 3-D representation (not yet implemented)
- `DocumentRepresentation`: An object representing an opaque document (e.g. a PDF)
- `MovingImageRepresentation`: An object representing a moving image (video, film)
- `ArchiveRepresentation`: An object representing a archive file (e.g. Zip)
- `Annotation`: A predefined annotation object. It has automatically the following predefined properties defined:
- `hasComment` (1-n)
- `isAnnotationOf` (1)
Expand Down
6 changes: 6 additions & 0 deletions knora/dsplib/models/resource.py
Expand Up @@ -45,6 +45,7 @@ class ResourceInstance(Model):
'AudioRepresentation',
'DocumentRepresentation',
'MovingImageRepresentation',
'ArchiveRepresentation',
'DDDRepresentation',
'TextRepresentation'}
knora_properties: Set[str] = {
Expand Down Expand Up @@ -228,6 +229,11 @@ def toJsonLdObj(self, action: Actions) -> Any:
"@type": "knora-api:AudioFileValue",
"knora-api:fileValueHasFilename": self._bitstream
}
elif self.baseclass == 'ArchiveRepresentation':
tmp["knora-api:hasArchiveFileValue"] = {
"@type": "knora-api:ArchiveFileValue",
"knora-api:fileValueHasFilename": self._bitstream
}
else:
raise BaseError(f'Baseclass "{self.baseclass}" not yet supported!')
for propname, valtype in self._values.items():
Expand Down
1 change: 1 addition & 0 deletions knora/dsplib/schemas/ontology.json
Expand Up @@ -56,6 +56,7 @@
"DDDRepresentation",
"DocumentRepresentation",
"MovingImageRepresentation",
"ArchiveRepresentation",
"Annotation",
"LinkObj",
"Region"
Expand Down
1 change: 1 addition & 0 deletions knora/dsplib/schemas/resources-only.json
Expand Up @@ -44,6 +44,7 @@
"DDDRepresentation",
"DocumentRepresentation",
"MovingImageRepresentation",
"ArchiveRepresentation",
"Annotation",
"LinkObj",
"Region"
Expand Down
1 change: 1 addition & 0 deletions knora/knora.py
Expand Up @@ -34,6 +34,7 @@
- :DDDRepresentation
- :DocumentRepresentation
- :MovingImageRepresentation
- :ArchiveRepresentation
- :Annotation -> :hasComment, :isAnnotationOf, :isAnnotationOfValue
- :LinkObj -> :hasComment, :hasLinkTo, :hasLinkToValue
- :LinkValue [reification node]
Expand Down
5 changes: 2 additions & 3 deletions testdata/test-onto.json
Expand Up @@ -104,8 +104,7 @@
"groups": [
":testgroup"
],
"projects": [
]
"projects": []
}
],
"ontologies": [
Expand Down Expand Up @@ -475,7 +474,7 @@
},
{
"name": "ZipThing",
"super": "DocumentRepresentation",
"super": "ArchiveRepresentation",
"labels": {
"en": "A ZIP Thing"
},
Expand Down

0 comments on commit 85a40c2

Please sign in to comment.