Skip to content

Commit

Permalink
Web batch annotations (#93)
Browse files Browse the repository at this point in the history
* Web batch annotations

* example

* add examples
  • Loading branch information
southeo authored May 31, 2024
1 parent 41ace18 commit 2c234b9
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"data": {
"type": "annotation",
"attributes": {
"annotations": [
{
"oa:motivation": "oa:commenting",
"oa:target": {
"ods:id": "https://hdl.handle.net/20.500.125/1111111",
"ods:type": "https://doi.org/21.T11148/894b1e6cad57e921764e",
"oa:selector": {
"ods:type": "ClassSelector",
"oa:class": "specimenName"
}
},
"oa:body": {
"ods:type": "body",
"oa:value": [],
"dcterms:reference": "reference",
"ods:score": 0.9
}
}
],
"batchMetadata": [
{
"searchParams": [
{
"inputField": "field",
"inputValue": "value"
}
]
}
]
}
}
}
189 changes: 189 additions & 0 deletions data-model/annotations/0.1.0/schema/annotation-event-for-web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.dissco.tech/schemas/annotations/0.1.0/annotation-event-for-web.json",
"description": "Web batch annotation. For DiSSCo internal use only.",
"$comment": "Fewer fields are required in this schema because these requests are sent to the backend for processing.",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"const": "annotation"
},
"attributes": {
"type": "object",
"properties": {
"annotations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ods:id": {
"type": "string"
},
"rdf:type": {
"const": "Annotation"
},
"oa:motivation": {
"enum": [
"ods:adding",
"oa:assessing",
"oa:editing",
"oa:commenting"
]
},
"oa:motivatedBy": {
"type": "string"
},
"oa:target": {
"type": "object",
"properties": {
"ods:id": {
"type": "string"
},
"ods:type": {
"type": "string"
},
"oa:selector": {
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"ods:type": {
"const": "FieldSelector"
},
"ods:field": {
"type": "string"
}
},
"required": [
"ods:type",
"ods:field"
]
},
{
"type": "object",
"properties": {
"ods:type": {
"const": "ClassSelector"
},
"oa:class": {
"type": "string"
}
},
"required": [
"ods:type",
"oa:class"
]
},
{
"type": "object",
"properties": {
"ods:type": {
"const": "FragmentSelector"
},
"ac:hasRoi": {
"type": "object",
"properties": {
"ac:xFrac": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"ac:yFrac": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"ac:widthFrac": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"ac:heightFrac": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"ac:xFrac",
"ac:yFrac",
"ac:widthFrac",
"ac:heightFrac"
]
},
"dcterms:conformsTo": {
"type": "string"
}
},
"required": [
"ods:type",
"ac:hasRoi"
]
}
]
}
},
"required": [
"ods:id",
"ods:type"
]
},
"oa:body": {
"type": "object",
"properties": {
"ods:type": {
"type": "string"
},
"oa:value": {
"type": "array"
},
"dcterms:reference": {
"type": "string"
},
"ods:score": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"ods:type",
"oa:value"
]
}
},
"required": [
"oa:motivation",
"oa:target",
"oa:body"
]
},
"minItems": 1,
"maxItems": 1
},
"batchMetadata": {
"type": "array",
"items": {
"$ref": "https://schemas.dissco.tech/schemas/fdo-types/0.1.0/annotation-batch-metadata.json"
},
"minItems": 1,
"maxItems": 1
}
},
"required": [
"annotations",
"batchMetadata"
]
}
},
"required": [
"type",
"attributes"
]
}
}

}
18 changes: 4 additions & 14 deletions data-model/annotations/0.1.0/schema/annotation-event.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.dissco.tech/schemas/annotations/0.1.0/annotation-event.json",
"description": "Object sent to annotation processing service",
"description": "Object sent to annotation processing service from core backend. Internal use only.",
"properties": {
"annotations": {
"type": "array",
Expand All @@ -16,19 +16,9 @@
"batchMetadata": {
"type": "array",
"items": {
"type": "object",
"properties": {
"placeInBatch": {
"type": "integer"
},
"inputField": {
"type": "string"
},
"inputValue": {
"type": "string"
}
}
}
"$ref": "https://schemas.dissco.tech/schemas/fdo-types/0.1.0/annotation-batch-metadata.json"
},
"minItems": 1
},
"required": [
"annotations",
Expand Down
41 changes: 41 additions & 0 deletions data-model/annotations/0.1.0/schema/batch-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.dissco.tech/schemas/fdo-types/0.1.0/annotation-batch-metadata.json",
"properties": {
"placeInBatch": {
"type": "integer"
},
"searchParams": {
"type": "array",
"items": {
"type": "object",
"properties": {
"inputField": {
"type": "string",
"description": "JsonPath (mixed notation) of field used to base annotation reasoning on. Indexes must be wildcards",
"examples": [
"digitalSpecimenWrapper.occurrences[*].location.dwc:country"
]
},
"inputValue": {
"type": "string",
"description": "Value stored at the field indicated in inputField",
"examples": [
"Netherlands"
]
}
},
"required": [
"inputField",
"inputValue"
]
},
"minItems": 1
}
},
"required": [
"placeInBatch",
"searchParams"
],
"additionalProperties": false
}

0 comments on commit 2c234b9

Please sign in to comment.