Skip to content

Commit 85a40c2

Browse files
feat: update DSP-Tools to support ArchiveRepresentation (DEV-259) (#128)
1 parent 0dc724c commit 85a40c2

6 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎docs/dsp-tools-create.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,7 @@ The following predefined resources are provided by DSP:
10781078
- `DDDRepresentation`: An object representing a 3-D representation (not yet implemented)
10791079
- `DocumentRepresentation`: An object representing an opaque document (e.g. a PDF)
10801080
- `MovingImageRepresentation`: An object representing a moving image (video, film)
1081+
- `ArchiveRepresentation`: An object representing a archive file (e.g. Zip)
10811082
- `Annotation`: A predefined annotation object. It has automatically the following predefined properties defined:
10821083
- `hasComment` (1-n)
10831084
- `isAnnotationOf` (1)

‎knora/dsplib/models/resource.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ResourceInstance(Model):
4545
'AudioRepresentation',
4646
'DocumentRepresentation',
4747
'MovingImageRepresentation',
48+
'ArchiveRepresentation',
4849
'DDDRepresentation',
4950
'TextRepresentation'}
5051
knora_properties: Set[str] = {
@@ -228,6 +229,11 @@ def toJsonLdObj(self, action: Actions) -> Any:
228229
"@type": "knora-api:AudioFileValue",
229230
"knora-api:fileValueHasFilename": self._bitstream
230231
}
232+
elif self.baseclass == 'ArchiveRepresentation':
233+
tmp["knora-api:hasArchiveFileValue"] = {
234+
"@type": "knora-api:ArchiveFileValue",
235+
"knora-api:fileValueHasFilename": self._bitstream
236+
}
231237
else:
232238
raise BaseError(f'Baseclass "{self.baseclass}" not yet supported!')
233239
for propname, valtype in self._values.items():

‎knora/dsplib/schemas/ontology.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"DDDRepresentation",
5757
"DocumentRepresentation",
5858
"MovingImageRepresentation",
59+
"ArchiveRepresentation",
5960
"Annotation",
6061
"LinkObj",
6162
"Region"

‎knora/dsplib/schemas/resources-only.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"DDDRepresentation",
4545
"DocumentRepresentation",
4646
"MovingImageRepresentation",
47+
"ArchiveRepresentation",
4748
"Annotation",
4849
"LinkObj",
4950
"Region"

‎knora/knora.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- :DDDRepresentation
3535
- :DocumentRepresentation
3636
- :MovingImageRepresentation
37+
- :ArchiveRepresentation
3738
- :Annotation -> :hasComment, :isAnnotationOf, :isAnnotationOfValue
3839
- :LinkObj -> :hasComment, :hasLinkTo, :hasLinkToValue
3940
- :LinkValue [reification node]

‎testdata/test-onto.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@
104104
"groups": [
105105
":testgroup"
106106
],
107-
"projects": [
108-
]
107+
"projects": []
109108
}
110109
],
111110
"ontologies": [
@@ -475,7 +474,7 @@
475474
},
476475
{
477476
"name": "ZipThing",
478-
"super": "DocumentRepresentation",
477+
"super": "ArchiveRepresentation",
479478
"labels": {
480479
"en": "A ZIP Thing"
481480
},

0 commit comments

Comments
 (0)