diff --git a/senpy/schemas/analysis.json b/senpy/schemas/analysis.json index 602ae27..19eac15 100644 --- a/senpy/schemas/analysis.json +++ b/senpy/schemas/analysis.json @@ -1,4 +1,15 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Analysis" + "description": "Senpy analysis", + "type": "object", + "properties": { + "@id": { + "type": "string" + }, + "@type": { + "type": "string", + "description": "Type of the analysis. e.g. marl:SentimentAnalysis" + } + }, + "required": ["@id", "@type"] } diff --git a/senpy/schemas/context.json b/senpy/schemas/context.json new file mode 100644 index 0000000..a4fb2e3 --- /dev/null +++ b/senpy/schemas/context.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "JSON-LD Context", + "type": ["array", "string", "object"] +} diff --git a/senpy/schemas/definitions.json b/senpy/schemas/definitions.json index 45eab88..0b748d6 100644 --- a/senpy/schemas/definitions.json +++ b/senpy/schemas/definitions.json @@ -1,169 +1,45 @@ { "$schema": "http://json-schema.org/draft-04/schema#", "Results": { - "title": "Results", - "description": "The results of an analysis", - "type": "object", - "properties": { - "@context": { - "$ref": "#/Context" - }, - "@id": { - "description": "ID of the analysis", - "type": "string" - }, - "analysis": { - "type": "array", - "default": [], - "items": { - "$ref": "#/Analysis" - } - }, - "entries": { - "type": "array", - "default": [], - "items": { - "$ref": "#/Entry" - } - } - - }, - "required": ["@id", "analysis", "entries"] + "$ref": "results.json" }, "Context": { - "description": "JSON-LD Context", - "type": ["array", "string", "object"] + "$ref": "context.json" }, "Analysis": { - "description": "Senpy analysis", - "type": "object", - "properties": { - "@id": { - "type": "string" - }, - "@type": { - "type": "string", - "description": "Type of the analysis. e.g. marl:SentimentAnalysis" - } - }, - "required": ["@id", "@type"] + "$ref": "analysis.json" }, "Entry": { - "properties": { - "@id": { - "type": "string" - }, - "@type": { - "enum": [["nif:RFC5147String", "nif:Context"]] - }, - "nif:isString": { - "description": "String contained in this Context", - "type": "string" - }, - "sentiments": { - "type": "array", - "items": {"$ref": "#/Sentiment" } - }, - "emotions": { - "type": "array", - "items": {"$ref": "#/EmotionSet" } - }, - "entities": { - "type": "array", - "items": {"$ref": "#/Entity" } - }, - "topics": { - "type": "array", - "items": {"$ref": "#/Topic" } - }, - "suggestions": { - "type": "array", - "items": {"$ref": "#/Suggestion" } - } - }, - "required": ["@id", "nif:isString"] + "$ref": "entry.json" }, "Sentiment": { - "properties": { - "@id": {"type": "string"}, - "nif:beginIndex": {"type": "integer"}, - "nif:endIndex": {"type": "integer"}, - "nif:anchorOf": { - "description": "Piece of context that contains the Sentiment", - "type": "string" - }, - "marl:hasPolarity": { - "enum": ["marl:Positive", "marl:Negative", "marl:Neutral"] - }, - "marl:polarityValue": { - "type": "number" - }, - "prov:wasGeneratedBy": { - "type": "string", - "description": "The ID of the analysis that generated this Sentiment. The full object should be included in the \"analysis\" property of the root object" - } - }, - "required": ["@id", "prov:wasGeneratedBy"] + "$ref": "sentiment.json" }, "EmotionSet": { - "properties": { - "@id": {"type": "string"}, - "nif:beginIndex": {"type": "integer"}, - "nif:endIndex": {"type": "integer"}, - "nif:anchorOf": { - "description": "Piece of context that contains the Sentiment", - "type": "string" - }, - "onyx:hasEmotion": { - "type": "array", - "items": { - "$ref": "#/Emotion" - }, - "default": [] - }, - "prov:wasGeneratedBy": { - "type": "string", - "description": "The ID of the analysis that generated this Emotion. The full object should be included in the \"analysis\" property of the root object" - } - }, - "required": ["@id", "prov:wasGeneratedBy", "onyx:hasEmotion"] + "$ref": "emotionSet.json" }, "Emotion": { - "type": "object" + "$ref": "emotion.json" + }, + "EmotionModel": { + "$ref": "emotionModel.json" }, "Entity": { - "type": "object" + "$ref": "entity.json" }, "Topic": { - "type": "object" + "$ref": "topic.json" }, "Suggestion": { - "type": "object" + "$ref": "suggestion.json" }, "Plugins": { - "properties": { - "plugins": { - "type": "array", - "items": { - "$ref": "#/Plugin" - } - } - } + "$ref": "plugin.json" }, "Plugin": { - "type": "object", - "required": ["@id", "extra_params"], - "properties": { - "@id": { - "type": "string" - }, - "extra_params": { - "type": "object", - "default": {} - } - } + "$ref": "plugin.json" }, "Response": { - "type": "object" + "$ref": "response.json" } } diff --git a/senpy/schemas/emotion.json b/senpy/schemas/emotion.json index a1aa294..70090b1 100644 --- a/senpy/schemas/emotion.json +++ b/senpy/schemas/emotion.json @@ -1,4 +1,4 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Emotion" + "type": "object" } diff --git a/senpy/schemas/emotionModel.json b/senpy/schemas/emotionModel.json new file mode 100644 index 0000000..b2ae5cc --- /dev/null +++ b/senpy/schemas/emotionModel.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "properties": { + "@id": {"type": "string"}, + "nif:beginIndex": {"type": "integer"}, + "nif:endIndex": {"type": "integer"}, + "nif:anchorOf": { + "description": "Piece of context that contains the Sentiment", + "type": "string" + }, + "onyx:hasEmotion": { + "type": "array", + "items": { + "$ref": "emotion.json" + }, + "default": [] + }, + "prov:wasGeneratedBy": { + "type": "string", + "description": "The ID of the analysis that generated this Emotion. The full object should be included in the \"analysis\" property of the root object" + } + }, + "required": ["@id", "prov:wasGeneratedBy", "onyx:hasEmotion"] +} diff --git a/senpy/schemas/emotionSet.json b/senpy/schemas/emotionSet.json index ad06f7d..b2ae5cc 100644 --- a/senpy/schemas/emotionSet.json +++ b/senpy/schemas/emotionSet.json @@ -1,4 +1,24 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/EmotionSet" + "properties": { + "@id": {"type": "string"}, + "nif:beginIndex": {"type": "integer"}, + "nif:endIndex": {"type": "integer"}, + "nif:anchorOf": { + "description": "Piece of context that contains the Sentiment", + "type": "string" + }, + "onyx:hasEmotion": { + "type": "array", + "items": { + "$ref": "emotion.json" + }, + "default": [] + }, + "prov:wasGeneratedBy": { + "type": "string", + "description": "The ID of the analysis that generated this Emotion. The full object should be included in the \"analysis\" property of the root object" + } + }, + "required": ["@id", "prov:wasGeneratedBy", "onyx:hasEmotion"] } diff --git a/senpy/schemas/entity.json b/senpy/schemas/entity.json new file mode 100644 index 0000000..70090b1 --- /dev/null +++ b/senpy/schemas/entity.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object" +} diff --git a/senpy/schemas/entry.json b/senpy/schemas/entry.json index 68b2c2d..d90160b 100644 --- a/senpy/schemas/entry.json +++ b/senpy/schemas/entry.json @@ -1,4 +1,37 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Entry" + "name": "Entry", + "properties": { + "@id": { + "type": "string" + }, + "@type": { + "enum": [["nif:RFC5147String", "nif:Context"]] + }, + "nif:isString": { + "description": "String contained in this Context", + "type": "string" + }, + "sentiments": { + "type": "array", + "items": {"$ref": "sentiment.json" } + }, + "emotions": { + "type": "array", + "items": {"$ref": "emotionSet.json" } + }, + "entities": { + "type": "array", + "items": {"$ref": "entity.json" } + }, + "topics": { + "type": "array", + "items": {"$ref": "topic.json" } + }, + "suggestions": { + "type": "array", + "items": {"$ref": "suggestion.json" } + } + }, + "required": ["@id", "nif:isString"] } diff --git a/senpy/schemas/plugin.json b/senpy/schemas/plugin.json index 6dc2e66..aa24ae0 100644 --- a/senpy/schemas/plugin.json +++ b/senpy/schemas/plugin.json @@ -1,3 +1,14 @@ { - "$ref": "definitions.json#/Plugin" + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": ["@id", "extra_params"], + "properties": { + "@id": { + "type": "string" + }, + "extra_params": { + "type": "object", + "default": {} + } + } } diff --git a/senpy/schemas/plugins.json b/senpy/schemas/plugins.json index 1f6fefa..33ee664 100644 --- a/senpy/schemas/plugins.json +++ b/senpy/schemas/plugins.json @@ -1,3 +1,11 @@ { - "$ref": "definitions.json#/Plugins" + "$schema": "http://json-schema.org/draft-04/schema#", + "properties": { + "plugins": { + "type": "array", + "items": { + "$ref": "plugin.json" + } + } + } } diff --git a/senpy/schemas/response.json b/senpy/schemas/response.json index 4e2d53c..70090b1 100644 --- a/senpy/schemas/response.json +++ b/senpy/schemas/response.json @@ -1,4 +1,4 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Response" + "type": "object" } diff --git a/senpy/schemas/results.json b/senpy/schemas/results.json index a470c16..73fdc0f 100644 --- a/senpy/schemas/results.json +++ b/senpy/schemas/results.json @@ -1,4 +1,31 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Results" + "title": "Results", + "description": "The results of an analysis", + "type": "object", + "properties": { + "@context": { + "$ref": "context.json" + }, + "@id": { + "description": "ID of the analysis", + "type": "string" + }, + "analysis": { + "type": "array", + "default": [], + "items": { + "$ref": "analysis.json" + } + }, + "entries": { + "type": "array", + "default": [], + "items": { + "$ref": "entry.json" + } + } + + }, + "required": ["@id", "analysis", "entries"] } diff --git a/senpy/schemas/sentiment.json b/senpy/schemas/sentiment.json index 957b509..6d2b0eb 100644 --- a/senpy/schemas/sentiment.json +++ b/senpy/schemas/sentiment.json @@ -1,4 +1,23 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Sentiment" + "properties": { + "@id": {"type": "string"}, + "nif:beginIndex": {"type": "integer"}, + "nif:endIndex": {"type": "integer"}, + "nif:anchorOf": { + "description": "Piece of context that contains the Sentiment", + "type": "string" + }, + "marl:hasPolarity": { + "enum": ["marl:Positive", "marl:Negative", "marl:Neutral"] + }, + "marl:polarityValue": { + "type": "number" + }, + "prov:wasGeneratedBy": { + "type": "string", + "description": "The ID of the analysis that generated this Sentiment. The full object should be included in the \"analysis\" property of the root object" + } + }, + "required": ["@id", "prov:wasGeneratedBy"] } diff --git a/senpy/schemas/suggestion.json b/senpy/schemas/suggestion.json index 251ba10..70090b1 100644 --- a/senpy/schemas/suggestion.json +++ b/senpy/schemas/suggestion.json @@ -1,4 +1,4 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "definitions.json#/Suggestion" + "type": "object" } diff --git a/senpy/schemas/topic.json b/senpy/schemas/topic.json new file mode 100644 index 0000000..70090b1 --- /dev/null +++ b/senpy/schemas/topic.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object" +}