diff --git a/bw_interface_schemas/json_schema/edge.json b/bw_interface_schemas/json_schema/edge.json new file mode 100644 index 0000000..4d800a6 --- /dev/null +++ b/bw_interface_schemas/json_schema/edge.json @@ -0,0 +1,353 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "allOf": [ + { + "$ref": "#/$defs/Edge" + } + ] +} \ No newline at end of file diff --git a/bw_interface_schemas/json_schema/elementary_flow.json b/bw_interface_schemas/json_schema/elementary_flow.json new file mode 100644 index 0000000..2b3d9d2 --- /dev/null +++ b/bw_interface_schemas/json_schema/elementary_flow.json @@ -0,0 +1,501 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "title": "Name", + "type": "string" + }, + "unit": { + "title": "Unit", + "type": "string" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + }, + "context": { + "items": { + "type": "string" + }, + "title": "Context", + "type": "array" + } + }, + "required": [ + "code", + "database", + "name", + "unit", + "context" + ], + "title": "ElementaryFlow", + "type": "object" +} \ No newline at end of file diff --git a/bw_interface_schemas/json_schema/node.json b/bw_interface_schemas/json_schema/node.json new file mode 100644 index 0000000..0a7eacc --- /dev/null +++ b/bw_interface_schemas/json_schema/node.json @@ -0,0 +1,353 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "allOf": [ + { + "$ref": "#/$defs/Node" + } + ] +} \ No newline at end of file diff --git a/bw_interface_schemas/json_schema/process.json b/bw_interface_schemas/json_schema/process.json new file mode 100644 index 0000000..2f323bc --- /dev/null +++ b/bw_interface_schemas/json_schema/process.json @@ -0,0 +1,487 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "additionalProperties": true, + "description": "A generic process, possibly multi-functional. Does not have a reference product.\n\nOnly difference from `Node` is that some more fields are required.", + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "title": "Name", + "type": "string" + }, + "unit": { + "title": "Unit", + "type": "string" + }, + "location": { + "title": "Location", + "type": "string" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database", + "name", + "unit", + "location" + ], + "title": "Process", + "type": "object" +} \ No newline at end of file diff --git a/bw_interface_schemas/json_schema/process_with_reference_product.json b/bw_interface_schemas/json_schema/process_with_reference_product.json new file mode 100644 index 0000000..7a07fce --- /dev/null +++ b/bw_interface_schemas/json_schema/process_with_reference_product.json @@ -0,0 +1,526 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "additionalProperties": true, + "description": "Chimaera which serves as both a product and a process in the graph.", + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "title": "Name", + "type": "string" + }, + "unit": { + "title": "Unit", + "type": "string" + }, + "location": { + "title": "Location", + "type": "string" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + }, + "reference product": { + "title": "Reference Product", + "type": "string" + }, + "production_amount": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Production Amount" + }, + "properties": { + "anyOf": [ + { + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Properties" + } + }, + "required": [ + "code", + "database", + "name", + "unit", + "location", + "reference product" + ], + "title": "ProcessWithReferenceProduct", + "type": "object" +} \ No newline at end of file diff --git a/bw_interface_schemas/json_schema/product.json b/bw_interface_schemas/json_schema/product.json new file mode 100644 index 0000000..affefff --- /dev/null +++ b/bw_interface_schemas/json_schema/product.json @@ -0,0 +1,508 @@ +{ + "$defs": { + "DataSource": { + "additionalProperties": true, + "description": "A data source, such as a publication or field measurement.\n\nVery preliminary.", + "properties": { + "authors": { + "items": { + "type": "string" + }, + "title": "Authors", + "type": "array" + }, + "year": { + "title": "Year", + "type": "integer" + }, + "title": { + "title": "Title", + "type": "string" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Doi" + } + }, + "required": [ + "authors", + "year", + "title" + ], + "title": "DataSource", + "type": "object" + }, + "Edge": { + "additionalProperties": true, + "description": "An quantitative edge linking two nodes in the graph.", + "properties": { + "amount": { + "title": "Amount", + "type": "number" + }, + "uncertainty_type": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Uncertainty Type" + }, + "loc": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Loc" + }, + "scale": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Scale" + }, + "shape": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Shape" + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Minimum" + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Maximum" + }, + "negative": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Negative" + }, + "type": { + "title": "Type", + "type": "string" + }, + "source": { + "$ref": "#/$defs/Node" + }, + "target": { + "$ref": "#/$defs/Node" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + } + }, + "required": [ + "amount", + "type", + "source", + "target", + "properties" + ], + "title": "Edge", + "type": "object" + }, + "JsonValue": {}, + "Node": { + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Name" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Unit" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + } + }, + "required": [ + "code", + "database" + ], + "title": "Node", + "type": "object" + } + }, + "additionalProperties": true, + "properties": { + "code": { + "title": "Code", + "type": "string" + }, + "database": { + "title": "Database", + "type": "string" + }, + "created": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Created" + }, + "modified": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Modified" + }, + "name": { + "title": "Name", + "type": "string" + }, + "unit": { + "title": "Unit", + "type": "string" + }, + "location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Location" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Type" + }, + "comment": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Comment" + }, + "filename": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Filename" + }, + "references": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/DataSource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "References" + }, + "tags": { + "anyOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/JsonValue" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Tags" + }, + "exchanges": { + "default": [], + "items": { + "$ref": "#/$defs/Edge" + }, + "title": "Exchanges", + "type": "array" + }, + "properties": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "integer" + } + ] + }, + "title": "Properties" + } + }, + "required": [ + "code", + "database", + "name", + "unit", + "properties" + ], + "title": "Product", + "type": "object" +} \ No newline at end of file diff --git a/bw_interface_schemas/lci.py b/bw_interface_schemas/lci.py index 6ed4b56..6ae29da 100644 --- a/bw_interface_schemas/lci.py +++ b/bw_interface_schemas/lci.py @@ -1,3 +1,6 @@ +import json +import re +from pathlib import Path from typing import Optional, Union from pydantic import BaseModel, ConfigDict, JsonValue, Field @@ -112,3 +115,11 @@ class ElementaryFlow(Node): context: list[str] name: str unit: str + + +if __name__ == "__main__": + hiss = lambda name: re.sub(r'(?