Skip to content

Instantly share code, notes, and snippets.

@gkellogg
Last active April 25, 2016 12:17
Show Gist options
  • Save gkellogg/4ff74c27313e95a6b3dcbad6cc64277a to your computer and use it in GitHub Desktop.
Save gkellogg/4ff74c27313e95a6b3dcbad6cc64277a to your computer and use it in GitHub Desktop.
Potential Annotation test harness
{
"@context": "https://github.io/w3c/annotation/testing/context.jsonld",
"id": "manifest-model",
"type": "mf:Manifest",
"label": "Web Annotation Data Model Tests",
"comment": "Runs a battery of test patterns against multiple annotations in JSON-LD format. Each test entry identifies a procedure for generating an annotation, and the results are matched against a set of patterns.",
"entries": [
{
"id": "manifest-model#test001",
"type": "ant:SchemaTest",
"name": "Simple Annotation",
"comment": "Tests run on the 'action' file, but could be specified by instructing an endpoint to deliver such a file to the testing framework, either manually or automatically",
"approval": "ant:Proposed",
"action": "test001-in.jsonld",
"result": [
"verify-context-present.json",
"verify-type-Annotation.json",
"verify-body-present-or-empty.json"
"verify-target-present.json",
]
}
]
}
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno5",
"type":"Annotation",
"body": {
"type" : "TextualBody",
"text" : "<p>Comment text</p>",
"format" : "text/html",
"language" : "en"
},
"target": "http://example.org/photo1"
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify annotation has @context",
"type": "object",
"properties": {
"@context": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"anyOf": {
"type": "string"
}
}
],
"not": {"type": "object"}
}
},
"required": ["@context"]
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify annotation has @context",
"type": "object",
"properties": {
"type": {
"anyOf": [
{
"type": "string",
"pattern": "^Annotation$"
},
{
"type": "array",
"anyOf": {
"type": "string",
"pattern": "^Annotation$"
}
}
],
"not": {"type": "object"}
}
},
"required": ["type"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment