From e3dfa7930c6d137d276cade1df099ada01e6c4e8 Mon Sep 17 00:00:00 2001 From: Bot Anik <98603954+bot-anik@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:14:22 +0000 Subject: [PATCH] feat: update schema files --- go/cognitarium-schema/README.md | 2 +- go/cognitarium-schema/schema.go | 279 ++++++++++-------- go/dataverse-schema/README.md | 2 +- go/dataverse-schema/schema.go | 70 ++--- go/law-stone-schema/README.md | 2 +- go/law-stone-schema/schema.go | 246 ++++----------- go/objectarium-schema/README.md | 2 +- go/objectarium-schema/schema.go | 24 +- schema/axone-cognitarium/execute.json | 127 +++++++- schema/axone-cognitarium/query.json | 54 +++- schema/axone-dataverse/execute.json | 36 +-- .../response_to_dataverse.json | 19 +- schema/axone-law-stone/execute.json | 15 +- schema/axone-law-stone/instantiate.json | 2 +- schema/axone-law-stone/query.json | 32 +- schema/axone-law-stone/response_to_ask.json | 40 +-- .../axone-law-stone/response_to_program.json | 6 +- schema/axone-objectarium/execute.json | 2 +- schema/axone-objectarium/instantiate.json | 2 +- .../axone-objectarium/response_to_bucket.json | 50 +++- ts/cognitarium-schema/README.md | 2 +- ts/dataverse-schema/README.md | 2 +- ts/law-stone-schema/README.md | 2 +- ts/objectarium-schema/README.md | 2 +- 24 files changed, 567 insertions(+), 453 deletions(-) diff --git a/go/cognitarium-schema/README.md b/go/cognitarium-schema/README.md index b445f3b..2a9c42d 100644 --- a/go/cognitarium-schema/README.md +++ b/go/cognitarium-schema/README.md @@ -1,6 +1,6 @@ # AXONE cognitarium schema -> Generated go types for [axone-cognitarium contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-cognitarium). +> Generated go types for [axone-cognitarium contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-cognitarium). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/go/cognitarium-schema/schema.go b/go/cognitarium-schema/schema.go index c8087b2..b1d3783 100644 --- a/go/cognitarium-schema/schema.go +++ b/go/cognitarium-schema/schema.go @@ -113,8 +113,8 @@ func (r *StoreResponse) Marshal() ([]byte, error) { // Example: ```json { "prefixes": [ { "prefix": "foaf", "namespace": // "http://xmlns.com/foaf/0.1/" } ], "delete": [ { "subject": { "variable": "s" }, // "predicate": { "variable": "p" }, "object": { "variable": "o" } } ], "where": [ { -// "simple": { "triplePattern": { "subject": { "variable": "s" }, "predicate": { "node": { -// "namedNode": {"prefixed": "foaf:givenName"} } }, "object": { "literal": { "simple": +// "simple": { "triplePattern": { "subject": { "variable": "s" }, "predicate": { +// "namedNode": {"prefixed": "foaf:givenName"} }, "object": { "literal": { "simple": // "Myrddin" } } } } }, { "simple": { "triplePattern": { "subject": { "variable": "s" }, // "predicate": { "variable": "p" }, "object": { "variable": "o" } } } } ] ``` // @@ -126,40 +126,40 @@ type ExecuteMsg struct { } type DeleteData struct { - // Specifies the specific triple patterns to delete. If nothing is provided, the patterns - // from the `where` clause are used for deletion. - Delete []DeleteElement `json:"delete"` - // The prefixes used in the operation. - Prefixes []DeleteDataPrefix `json:"prefixes"` - // Defines the patterns that data (RDF triples) should match in order for it to be - // considered for deletion. - Where []DeleteDataWhere `json:"where"` -} - -// Represents a triple pattern in a [SimpleWhereCondition]. -type DeleteElement struct { - // The object of the triple pattern. - Object DeleteVarOrNodeOrLiteral `json:"object"` - // The predicate of the triple pattern. - Predicate DeleteVarOrNode `json:"predicate"` - // The subject of the triple pattern. - Subject DeleteVarOrNode `json:"subject"` + // Specifies the specific triple templates to delete. If nothing is provided, the patterns + // from the `where` clause are used for deletion. + Delete []TripleDeleteTemplate `json:"delete"` + // The prefixes used in the operation. + Prefixes []DeleteDataPrefix `json:"prefixes"` + // Defines the patterns that data (RDF triples) should match in order for it to be + // considered for deletion. + Where []DeleteDataWhere `json:"where"` +} + +// Represents a triple template to be deleted. +type TripleDeleteTemplate struct { + // The object of the triple pattern. + Object VarOrNamedNodeOrLiteral `json:"object"` + // The predicate of the triple pattern. + Predicate DeleteVarOrNamedNode `json:"predicate"` + // The subject of the triple pattern. + Subject DeleteVarOrNamedNode `json:"subject"` } // The object of the triple pattern. // -// Represents either a variable, a node or a literal. +// Represents either a variable, a named node or a literal. // // A variable. // -// A node, i.e. an IRI or a blank node. +// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). // // An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal), i.e. a simple // literal, a language-tagged string or a typed value. -type DeleteVarOrNodeOrLiteral struct { - Variable *string `json:"variable,omitempty"` - Node *PurpleNode `json:"node,omitempty"` - Literal *PurpleLiteral `json:"literal,omitempty"` +type VarOrNamedNodeOrLiteral struct { + Variable *string `json:"variable,omitempty"` + NamedNode *VarOrNamedNodeOrLiteralIRI `json:"named_node,omitempty"` + Literal *VarOrNamedNodeOrLiteralLiteral `json:"literal,omitempty"` } // An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal). @@ -171,7 +171,7 @@ type DeleteVarOrNodeOrLiteral struct { // string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) // // A value with a datatype. -type PurpleLiteral struct { +type VarOrNamedNodeOrLiteralLiteral struct { Simple *string `json:"simple,omitempty"` LanguageTaggedString *PurpleLanguageTaggedString `json:"language_tagged_string,omitempty"` TypedValue *PurpleTypedValue `json:"typed_value,omitempty"` @@ -185,10 +185,10 @@ type PurpleLanguageTaggedString struct { } type PurpleTypedValue struct { - // The [datatype IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). - Datatype PurpleIRI `json:"datatype"` - // The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). - Value string `json:"value"` + // The [datatype IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). + Datatype VarOrNamedNodeOrLiteralIRI `json:"datatype"` + // The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). + Value string `json:"value"` } // Represents an IRI. @@ -200,33 +200,23 @@ type PurpleTypedValue struct { // expanded to `http://www.w3.org/1999/02/22-rdf-syntax-ns#type`. // // A full IRI. -type PurpleIRI struct { +type VarOrNamedNodeOrLiteralIRI struct { Prefixed *string `json:"prefixed,omitempty"` Full *string `json:"full,omitempty"` } -// Represents either an IRI (named node) or a blank node. -// -// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). -// -// An RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node). -type PurpleNode struct { - NamedNode *PurpleIRI `json:"named_node,omitempty"` - BlankNode *string `json:"blank_node,omitempty"` -} - // The predicate of the triple pattern. // -// Represents either a variable or a node. +// Represents either a variable or a named node (IRI). // // The subject of the triple pattern. // // A variable. // -// A node, i.e. an IRI or a blank node. -type DeleteVarOrNode struct { - Variable *string `json:"variable,omitempty"` - Node *PurpleNode `json:"node,omitempty"` +// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). +type DeleteVarOrNamedNode struct { + Variable *string `json:"variable,omitempty"` + NamedNode *VarOrNamedNodeOrLiteralIRI `json:"named_node,omitempty"` } // Represents a prefix, i.e. a shortcut for a namespace used in a query. @@ -249,7 +239,55 @@ type DeleteDataWhere struct { // Represents a triple pattern, i.e. a condition on a triple based on its subject, predicate // and object. type PurpleSimpleWhereCondition struct { - TriplePattern DeleteElement `json:"triple_pattern"` + TriplePattern PurpleTriplePattern `json:"triple_pattern"` +} + +// Represents a triple pattern in a [SimpleWhereCondition]. +type PurpleTriplePattern struct { + // The object of the triple pattern. + Object PurpleVarOrNodeOrLiteral `json:"object"` + // The predicate of the triple pattern. + Predicate DeleteVarOrNamedNode `json:"predicate"` + // The subject of the triple pattern. + Subject PurpleVarOrNode `json:"subject"` +} + +// The object of the triple pattern. +// +// Represents either a variable, a node or a literal. +// +// A variable. +// +// A node, i.e. an IRI or a blank node. +// +// An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal), i.e. a simple +// literal, a language-tagged string or a typed value. +type PurpleVarOrNodeOrLiteral struct { + Variable *string `json:"variable,omitempty"` + Node *PurpleNode `json:"node,omitempty"` + Literal *VarOrNamedNodeOrLiteralLiteral `json:"literal,omitempty"` +} + +// Represents either an IRI (named node) or a blank node. +// +// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). +// +// An RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node). +type PurpleNode struct { + NamedNode *VarOrNamedNodeOrLiteralIRI `json:"named_node,omitempty"` + BlankNode *string `json:"blank_node,omitempty"` +} + +// The subject of the triple pattern. +// +// Represents either a variable or a node. +// +// A variable. +// +// A node, i.e. an IRI or a blank node. +type PurpleVarOrNode struct { + Variable *string `json:"variable,omitempty"` + Node *PurpleNode `json:"node,omitempty"` } type InsertData struct { @@ -299,6 +337,10 @@ type StoreLimitsInput struct { MaxTripleCount *string `json:"max_triple_count,omitempty"` } +// Query messages +// +// Returns information about the triple store. +// // Returns the resources matching the criteria defined by the provided query. // // Returns a description of the resource identified by the provided IRI as a set of RDF @@ -306,10 +348,11 @@ type StoreLimitsInput struct { // // Returns the resources matching the criteria defined by the provided query as a set of RDF // triples serialized in the provided format. -type Select struct { - Select *SelectClass `json:"select,omitempty"` - Describe *Describe `json:"describe,omitempty"` - Construct *Construct `json:"construct,omitempty"` +type QueryMsg struct { + Store *Store `json:"store,omitempty"` + Select *Select `json:"select,omitempty"` + Describe *Describe `json:"describe,omitempty"` + Construct *Construct `json:"construct,omitempty"` } type Construct struct { @@ -325,22 +368,22 @@ type Construct struct { // Represents a CONSTRUCT query over the triple store, allowing to retrieve a set of triples // serialized in a specific format. type ConstructQuery struct { - // The triples to construct. If nothing is provided, the patterns from the `where` clause - // are used for construction. - Construct []ConstructElement `json:"construct"` - // The prefixes used in the query. - Prefixes []QueryPrefix `json:"prefixes"` - // The WHERE clause. This clause is used to specify the triples to construct using variable - // bindings. - Where []QueryWhere `json:"where"` -} - -// Represents a triple pattern in a [SimpleWhereCondition]. -type ConstructElement struct { + // The triples to construct. If nothing is provided, the patterns from the `where` clause + // are used for construction. + Construct []TripleConstructTemplate `json:"construct"` + // The prefixes used in the query. + Prefixes []QueryPrefix `json:"prefixes"` + // The WHERE clause. This clause is used to specify the triples to construct using variable + // bindings. + Where []QueryWhere `json:"where"` +} + +// Represents a triple template to be forged for a construct query. +type TripleConstructTemplate struct { // The object of the triple pattern. Object ConstructVarOrNodeOrLiteral `json:"object"` // The predicate of the triple pattern. - Predicate ConstructVarOrNode `json:"predicate"` + Predicate ConstructVarOrNamedNode `json:"predicate"` // The subject of the triple pattern. Subject ConstructVarOrNode `json:"subject"` } @@ -358,7 +401,7 @@ type ConstructElement struct { type ConstructVarOrNodeOrLiteral struct { Variable *string `json:"variable,omitempty"` Node *FluffyNode `json:"node,omitempty"` - Literal *FluffyLiteral `json:"literal,omitempty"` + Literal *PurpleLiteral `json:"literal,omitempty"` } // An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal). @@ -370,7 +413,7 @@ type ConstructVarOrNodeOrLiteral struct { // string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) // // A value with a datatype. -type FluffyLiteral struct { +type PurpleLiteral struct { Simple *string `json:"simple,omitempty"` LanguageTaggedString *FluffyLanguageTaggedString `json:"language_tagged_string,omitempty"` TypedValue *FluffyTypedValue `json:"typed_value,omitempty"` @@ -384,10 +427,10 @@ type FluffyLanguageTaggedString struct { } type FluffyTypedValue struct { - // The [datatype IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). - Datatype VarOrNamedNodeIRI `json:"datatype"` - // The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). - Value string `json:"value"` + // The [datatype IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). + Datatype PurpleIRI `json:"datatype"` + // The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). + Value string `json:"value"` } // Represents an IRI. @@ -399,7 +442,7 @@ type FluffyTypedValue struct { // expanded to `http://www.w3.org/1999/02/22-rdf-syntax-ns#type`. // // A full IRI. -type VarOrNamedNodeIRI struct { +type PurpleIRI struct { Prefixed *string `json:"prefixed,omitempty"` Full *string `json:"full,omitempty"` } @@ -410,16 +453,28 @@ type VarOrNamedNodeIRI struct { // // An RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node). type FluffyNode struct { - NamedNode *VarOrNamedNodeIRI `json:"named_node,omitempty"` - BlankNode *string `json:"blank_node,omitempty"` + NamedNode *PurpleIRI `json:"named_node,omitempty"` + BlankNode *string `json:"blank_node,omitempty"` } // The predicate of the triple pattern. // -// Represents either a variable or a node. +// Represents either a variable or a named node (IRI). // +// The resource to describe given as a variable or a node. +// +// A variable. +// +// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). +type ConstructVarOrNamedNode struct { + Variable *string `json:"variable,omitempty"` + NamedNode *PurpleIRI `json:"named_node,omitempty"` +} + // The subject of the triple pattern. // +// Represents either a variable or a node. +// // A variable. // // A node, i.e. an IRI or a blank node. @@ -448,7 +503,17 @@ type QueryWhere struct { // Represents a triple pattern, i.e. a condition on a triple based on its subject, predicate // and object. type FluffySimpleWhereCondition struct { - TriplePattern ConstructElement `json:"triple_pattern"` + TriplePattern FluffyTriplePattern `json:"triple_pattern"` +} + +// Represents a triple pattern in a [SimpleWhereCondition]. +type FluffyTriplePattern struct { + // The object of the triple pattern. + Object ConstructVarOrNodeOrLiteral `json:"object"` + // The predicate of the triple pattern. + Predicate ConstructVarOrNamedNode `json:"predicate"` + // The subject of the triple pattern. + Subject ConstructVarOrNode `json:"subject"` } type Describe struct { @@ -464,28 +529,16 @@ type Describe struct { // Represents a DESCRIBE query over the triple store, allowing to retrieve a description of // a resource as a set of triples serialized in a specific format. type DescribeQuery struct { - // The prefixes used in the query. - Prefixes []QueryPrefix `json:"prefixes"` - // The resource to describe given as a variable or a node. - Resource VarOrNamedNode `json:"resource"` - // The WHERE clause. This clause is used to specify the resource identifier to describe - // using variable bindings. - Where []QueryWhere `json:"where"` + // The prefixes used in the query. + Prefixes []QueryPrefix `json:"prefixes"` + // The resource to describe given as a variable or a node. + Resource ConstructVarOrNamedNode `json:"resource"` + // The WHERE clause. This clause is used to specify the resource identifier to describe + // using variable bindings. + Where []QueryWhere `json:"where"` } -// The resource to describe given as a variable or a node. -// -// Represents either a variable or a named node (IRI). -// -// A variable. -// -// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). -type VarOrNamedNode struct { - Variable *string `json:"variable,omitempty"` - NamedNode *VarOrNamedNodeIRI `json:"named_node,omitempty"` -} - -type SelectClass struct { +type Select struct { // The query to execute. Query SelectQuery `json:"query"` } @@ -515,6 +568,9 @@ type SelectItem struct { Variable string `json:"variable"` } +type Store struct { +} + // Represents the response of a [QueryMsg::Construct] query. type ConstructResponse struct { // The data serialized in the specified format. @@ -667,13 +723,6 @@ const ( Turtle RDFXML = "turtle" ) -// Returns information about the triple store. -type Store string - -const ( - StoreStore Store = "store" -) - type Type string const ( @@ -682,30 +731,6 @@ const ( URI Type = "uri" ) -// Query messages -type QueryMsg struct { - Enum *Store - Select *Select -} - -func (x *QueryMsg) UnmarshalJSON(data []byte) error { - x.Select = nil - x.Enum = nil - var c Select - object, err := unmarshalUnion(data, nil, nil, nil, nil, false, nil, true, &c, false, nil, true, &x.Enum, false) - if err != nil { - return err - } - if object { - x.Select = &c - } - return nil -} - -func (x *QueryMsg) MarshalJSON() ([]byte, error) { - return marshalUnion(nil, nil, nil, nil, false, nil, x.Select != nil, x.Select, false, nil, x.Enum != nil, x.Enum, false) -} - type ValueUnion struct { String *string ValueIRI *ValueIRI diff --git a/go/dataverse-schema/README.md b/go/dataverse-schema/README.md index cf97899..6b4c545 100644 --- a/go/dataverse-schema/README.md +++ b/go/dataverse-schema/README.md @@ -1,6 +1,6 @@ # AXONE dataverse schema -> Generated go types for [axone-dataverse contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-dataverse). +> Generated go types for [axone-dataverse contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-dataverse). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/go/dataverse-schema/schema.go b/go/dataverse-schema/schema.go index 570cd7a..a4b9f29 100644 --- a/go/dataverse-schema/schema.go +++ b/go/dataverse-schema/schema.go @@ -72,15 +72,9 @@ func (r *DataverseResponse) Marshal() ([]byte, error) { // // #### Format // -// Claims are injected into the dataverse through Verifiable Presentations (VPs). These -// presentations effectively amalgamate and showcase multiple credentials, thus providing a -// cohesive and comprehensive view of the assertions being made. +// Claims are injected into the dataverse through Verifiable Credentials (VCs). // -// While the data in a VP typically revolves around a common subject, it accommodates an -// unlimited number of subjects and issuers. This flexibility allows for a broad spectrum of -// claims to be represented. -// -// Primarily, the claims leverage the OKP4 ontology, which facilitates articulating +// Primarily, the claims leverage the AXONE ontology, which facilitates articulating // assertions about widely acknowledged resources in the dataverse, including digital // services, digital resources, zones, governance, and more. // @@ -92,8 +86,8 @@ func (r *DataverseResponse) Marshal() ([]byte, error) { // To maintain integrity and coherence in the dataverse, several preconditions are set for // the submission of claims: // -// 1. **Format Requirement**: Claims must be encapsulated within Verifiable Presentations -// (VPs). +// 1. **Format Requirement**: Claims must be encapsulated within Verifiable Credentials +// (VCs). // // 2. **Unique Identifier Mandate**: Each Verifiable Credential within the dataverse must // possess a unique identifier. @@ -101,6 +95,19 @@ func (r *DataverseResponse) Marshal() ([]byte, error) { // 3. **Issuer Signature**: Claims must bear the issuer's signature. This signature must be // verifiable, ensuring authenticity and credibility. // +// 4. **Content**: The actual implementation supports the submission of a single Verifiable +// Credential, containing a single claim. +// +// #### Supported cryptographic proofs +// +// - `Ed25519Signature2018` +// +// - `Ed25519Signature2020` +// +// - `EcdsaSecp256k1Signature2019` +// +// - `DataIntegrity` with the following cryptosuites: `eddsa-2022`, `eddsa-rdfc-2022`. +// // Revoke or withdraw a previously submitted claims. // // #### Preconditions: @@ -117,12 +124,12 @@ type RevokeClaims struct { } type SubmitClaims struct { - // RDF format in which the metadata is represented. If not provided, the default format is - // [Turtle](https://www.w3.org/TR/turtle/) format. - Format *RDFXML `json:"format"` - // The serialized metadata intended for attachment. This metadata should adhere to the - // format specified in the `format` field. - Metadata string `json:"metadata"` + // RDF dataset serialization format for the metadata. If not provided, the default format is + // [N-Quads](https://www.w3.org/TR/n-quads/) format. + Format *RDFDatasetFormat `json:"format"` + // The serialized metadata intended for attachment. This metadata should adhere to the + // format specified in the `format` field. + Metadata string `json:"metadata"` } // `InstantiateMsg` is used to initialize a new instance of the dataverse. @@ -192,37 +199,22 @@ type Dataverse struct { // DataverseResponse is the response of the Dataverse query. type DataverseResponse struct { - // The name of the dataverse. - Name string `json:"name"` + // The name of the dataverse. + Name string `json:"name"` + // The cognitarium contract address. + TriplestoreAddress string `json:"triplestore_address"` } -// RDF/XML Format -// -// RDF/XML is a syntax to express RDF information in XML. See the [official RDF/XML -// specification](https://www.w3.org/TR/rdf-syntax-grammar/). -// -// Turtle (Terse RDF Triple Language) Format -// -// Turtle is a textual format for representing RDF triples in a more compact and -// human-readable way compared to RDF/XML. See the [official Turtle -// specification](https://www.w3.org/TR/turtle/). -// -// N-Triples Format -// -// N-Triples is a line-based, plain text format for encoding an RDF graph. Each line -// corresponds to a single RDF triple. See the [official N-Triples -// specification](https://www.w3.org/TR/n-triples/). +// Represents the various serialization formats for an RDF dataset, i.e. a collection of RDF +// graphs ([RDF Dataset](https://www.w3.org/TR/rdf11-concepts/#section-dataset)). // // N-Quads Format // // N-Quads is an extension of N-Triples to support RDF datasets by adding an optional fourth // element to represent the graph name. See the [official N-Quads // specification](https://www.w3.org/TR/n-quads/). -type RDFXML string +type RDFDatasetFormat string const ( - NQuads RDFXML = "n_quads" - NTriples RDFXML = "n_triples" - RDFXMLRDFXML RDFXML = "rdf_xml" - Turtle RDFXML = "turtle" + NQuads RDFDatasetFormat = "n_quads" ) diff --git a/go/law-stone-schema/README.md b/go/law-stone-schema/README.md index 962f06b..7f5ef59 100644 --- a/go/law-stone-schema/README.md +++ b/go/law-stone-schema/README.md @@ -1,6 +1,6 @@ # AXONE law-stone schema -> Generated go types for [axone-law-stone contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-law-stone). +> Generated go types for [axone-law-stone contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-law-stone). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/go/law-stone-schema/schema.go b/go/law-stone-schema/schema.go index 20504a2..90b7ca8 100644 --- a/go/law-stone-schema/schema.go +++ b/go/law-stone-schema/schema.go @@ -21,9 +21,6 @@ package schema -import "bytes" -import "errors" - import "encoding/json" func UnmarshalExecuteMsg(data []byte) (ExecuteMsg, error) { @@ -88,214 +85,89 @@ func (r *Binary) Marshal() ([]byte, error) { return json.Marshal(r) } +// Execute messages +// +// Break the stone making this contract unusable, by clearing all the related resources: - +// Unpin all the pinned objects on `axone-objectarium` contracts, if any. - Forget the main +// program (i.e. or at least unpin it). +// +// Only the creator address (the address that instantiated the contract) is authorized to +// invoke this message. If already broken, this is a no-op. +type ExecuteMsg struct { + BreakStone BreakStone `json:"break_stone"` +} + +type BreakStone struct { +} + // Instantiate message type InstantiateMsg struct { - // The Prolog program carrying law rules and facts. - Program string `json:"program"` - // The `okp4-objectarium` contract address on which to store the law program. - StorageAddress string `json:"storage_address"` + // The Prolog program carrying law rules and facts. + Program string `json:"program"` + // The `axone-objectarium` contract address on which to store the law program. + StorageAddress string `json:"storage_address"` } -// If not broken, ask the logic module the provided query with the law program loaded. -type Ask struct { - Ask AskClass `json:"ask"` +// Query messages +// +// Submits a Prolog query string to the `Logic` module, evaluating it against the law +// program associated with this contract. +// +// If the law stone is broken the query returns a response with the error +// `error(system_error(broken_law_stone),root)` set in the `answer` field. +// +// Retrieves the location metadata of the law program bound to this contract. +// +// This includes the contract address of the `objectarium` and the program object ID, where +// the law program's code can be accessed. +// +// Fetches the raw code of the law program tied to this contract. +// +// If the law stone is broken, the query may fail if the program is no longer available in +// the `Objectarium`. +type QueryMsg struct { + Ask *Ask `json:"ask,omitempty"` + Program *Program `json:"program,omitempty"` + ProgramCode *ProgramCode `json:"program_code,omitempty"` } -type AskClass struct { +type Ask struct { Query string `json:"query"` } +type Program struct { +} + +type ProgramCode struct { +} + type AskResponse struct { - Answer *Answer `json:"answer"` - GasUsed int64 `json:"gas_used"` - Height int64 `json:"height"` + Answer *Answer `json:"answer"` + GasUsed int64 `json:"gas_used"` + Height int64 `json:"height"` + UserOutput *string `json:"user_output"` } type Answer struct { HasMore bool `json:"has_more"` Results []Result `json:"results"` - Success bool `json:"success"` Variables []string `json:"variables"` } type Result struct { + Error *string `json:"error"` Substitutions []Substitution `json:"substitutions"` } type Substitution struct { - Term Term `json:"term"` - Variable string `json:"variable"` -} - -type Term struct { - Arguments []Term `json:"arguments"` - Name string `json:"name"` + Expression string `json:"expression"` + Variable string `json:"variable"` } -// ProgramResponse carry elements to locate the program in a `okp4-objectarium` contract. +// ProgramResponse carry elements to locate the program in a `axone-objectarium` contract. type ProgramResponse struct { - // The program object id in the `okp4-objectarium` contract. - ObjectID string `json:"object_id"` - // The `okp4-objectarium` contract address on which the law program is stored. - StorageAddress string `json:"storage_address"` -} - -// Execute messages -// -// Break the stone making this contract unusable, by clearing all the related resources: - -// Unpin all the pinned objects on `okp4-objectarium` contracts, if any. - Forget the main -// program (i.e. or at least unpin it). Only the contract admin is authorized to break it, -// if any. If already broken, this is a no-op. -type ExecuteMsg string - -const ( - BreakStone ExecuteMsg = "break_stone" -) - -// If not broken, returns the law program location information. -// -// ProgramCode returns the law program code. -type Program string - -const ( - ProgramCode Program = "program_code" - ProgramProgram Program = "program" -) - -// Query messages -type QueryMsg struct { - Ask *Ask - Enum *Program -} - -func (x *QueryMsg) UnmarshalJSON(data []byte) error { - x.Ask = nil - x.Enum = nil - var c Ask - object, err := unmarshalUnion(data, nil, nil, nil, nil, false, nil, true, &c, false, nil, true, &x.Enum, false) - if err != nil { - return err - } - if object { - x.Ask = &c - } - return nil -} - -func (x *QueryMsg) MarshalJSON() ([]byte, error) { - return marshalUnion(nil, nil, nil, nil, false, nil, x.Ask != nil, x.Ask, false, nil, x.Enum != nil, x.Enum, false) -} - -func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) { - if pi != nil { - *pi = nil - } - if pf != nil { - *pf = nil - } - if pb != nil { - *pb = nil - } - if ps != nil { - *ps = nil - } - - dec := json.NewDecoder(bytes.NewReader(data)) - dec.UseNumber() - tok, err := dec.Token() - if err != nil { - return false, err - } - - switch v := tok.(type) { - case json.Number: - if pi != nil { - i, err := v.Int64() - if err == nil { - *pi = &i - return false, nil - } - } - if pf != nil { - f, err := v.Float64() - if err == nil { - *pf = &f - return false, nil - } - return false, errors.New("Unparsable number") - } - return false, errors.New("Union does not contain number") - case float64: - return false, errors.New("Decoder should not return float64") - case bool: - if pb != nil { - *pb = &v - return false, nil - } - return false, errors.New("Union does not contain bool") - case string: - if haveEnum { - return false, json.Unmarshal(data, pe) - } - if ps != nil { - *ps = &v - return false, nil - } - return false, errors.New("Union does not contain string") - case nil: - if nullable { - return false, nil - } - return false, errors.New("Union does not contain null") - case json.Delim: - if v == '{' { - if haveObject { - return true, json.Unmarshal(data, pc) - } - if haveMap { - return false, json.Unmarshal(data, pm) - } - return false, errors.New("Union does not contain object") - } - if v == '[' { - if haveArray { - return false, json.Unmarshal(data, pa) - } - return false, errors.New("Union does not contain array") - } - return false, errors.New("Cannot handle delimiter") - } - return false, errors.New("Cannot unmarshal union") - -} - -func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) { - if pi != nil { - return json.Marshal(*pi) - } - if pf != nil { - return json.Marshal(*pf) - } - if pb != nil { - return json.Marshal(*pb) - } - if ps != nil { - return json.Marshal(*ps) - } - if haveArray { - return json.Marshal(pa) - } - if haveObject { - return json.Marshal(pc) - } - if haveMap { - return json.Marshal(pm) - } - if haveEnum { - return json.Marshal(pe) - } - if nullable { - return json.Marshal(nil) - } - return nil, errors.New("Union must not be null") + // The program object id in the `axone-objectarium` contract. + ObjectID string `json:"object_id"` + // The `axone-objectarium` contract address on which the law program is stored. + StorageAddress string `json:"storage_address"` } diff --git a/go/objectarium-schema/README.md b/go/objectarium-schema/README.md index 84537a9..20dc49b 100644 --- a/go/objectarium-schema/README.md +++ b/go/objectarium-schema/README.md @@ -1,6 +1,6 @@ # AXONE objectarium schema -> Generated go types for [axone-objectarium contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-objectarium). +> Generated go types for [axone-objectarium contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-objectarium). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/go/objectarium-schema/schema.go b/go/objectarium-schema/schema.go index 7d11a64..e482a16 100644 --- a/go/objectarium-schema/schema.go +++ b/go/objectarium-schema/schema.go @@ -115,7 +115,7 @@ func (r *ObjectsResponse) Marshal() ([]byte, error) { // // StoreObject store an object to the bucket and make the sender the owner of the object. // The object is referenced by the hash of its content and this value is returned. If the -// object is already stored, an error is returned. +// object is already stored, it is a no-op. It may be pinned though. // // The "pin" parameter specifies if the object should be pinned for the sender. In such // case, the object cannot be removed (forget) from the storage. @@ -191,8 +191,8 @@ type InstantiateMsg struct { // used. type InstantiateMsgConfig struct { // The acceptable compression algorithms for the objects in the bucket. If this parameter is - // not set (none or empty array), then all compression algorithms are accepted. If this - // parameter is set, then only the compression algorithms in the array are accepted. + // not set, then all compression algorithms are accepted. If this parameter is set, then + // only the compression algorithms in the array are accepted. // // When an object is stored in the bucket without a specified compression algorithm, the // first algorithm in the array is used. Therefore, the order of the algorithms in the array @@ -302,6 +302,8 @@ type BucketResponse struct { Name string `json:"name"` // The configuration for paginated query. Pagination BucketResponsePagination `json:"pagination"` + // The statistics of the bucket. + Stat BucketStat `json:"stat"` } // The configuration of the bucket. @@ -313,8 +315,8 @@ type BucketResponse struct { // used. type BucketResponseConfig struct { // The acceptable compression algorithms for the objects in the bucket. If this parameter is - // not set (none or empty array), then all compression algorithms are accepted. If this - // parameter is set, then only the compression algorithms in the array are accepted. + // not set, then all compression algorithms are accepted. If this parameter is set, then + // only the compression algorithms in the array are accepted. // // When an object is stored in the bucket without a specified compression algorithm, the // first algorithm in the array is used. Therefore, the order of the algorithms in the array @@ -363,6 +365,18 @@ type BucketResponsePagination struct { MaxPageSize *int64 `json:"max_page_size,omitempty"` } +// The statistics of the bucket. +// +// BucketStat is the type of the statistics of a bucket. +type BucketStat struct { + // The total size of the objects contained in the bucket after compression. + CompressedSize string `json:"compressed_size"` + // The number of objects in the bucket. + ObjectCount string `json:"object_count"` + // The total size of the objects contained in the bucket. + Size string `json:"size"` +} + // ObjectResponse is the response of the Object query. type ObjectResponse struct { // The size of the object when compressed. If the object is not compressed, the value is the diff --git a/schema/axone-cognitarium/execute.json b/schema/axone-cognitarium/execute.json index ff27fdf..48d7514 100644 --- a/schema/axone-cognitarium/execute.json +++ b/schema/axone-cognitarium/execute.json @@ -44,7 +44,7 @@ }, { "title": "DeleteData", - "description": "Delete the data (RDF triples) from the store matching the patterns defined by the provided query. For non-existing triples it acts as no-op.\n\nExample: ```json { \"prefixes\": [ { \"prefix\": \"foaf\", \"namespace\": \"http://xmlns.com/foaf/0.1/\" } ], \"delete\": [ { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"variable\": \"p\" }, \"object\": { \"variable\": \"o\" } } ], \"where\": [ { \"simple\": { \"triplePattern\": { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"node\": { \"namedNode\": {\"prefixed\": \"foaf:givenName\"} } }, \"object\": { \"literal\": { \"simple\": \"Myrddin\" } } } } }, { \"simple\": { \"triplePattern\": { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"variable\": \"p\" }, \"object\": { \"variable\": \"o\" } } } } ] ```\n\nOnly the smart contract owner (i.e. the address who instantiated it) is authorized to perform this action.", + "description": "Delete the data (RDF triples) from the store matching the patterns defined by the provided query. For non-existing triples it acts as no-op.\n\nExample: ```json { \"prefixes\": [ { \"prefix\": \"foaf\", \"namespace\": \"http://xmlns.com/foaf/0.1/\" } ], \"delete\": [ { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"variable\": \"p\" }, \"object\": { \"variable\": \"o\" } } ], \"where\": [ { \"simple\": { \"triplePattern\": { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"namedNode\": {\"prefixed\": \"foaf:givenName\"} }, \"object\": { \"literal\": { \"simple\": \"Myrddin\" } } } } }, { \"simple\": { \"triplePattern\": { \"subject\": { \"variable\": \"s\" }, \"predicate\": { \"variable\": \"p\" }, \"object\": { \"variable\": \"o\" } } } } ] ```\n\nOnly the smart contract owner (i.e. the address who instantiated it) is authorized to perform this action.", "type": "object", "required": [ "delete_data" @@ -59,10 +59,10 @@ ], "properties": { "delete": { - "description": "Specifies the specific triple patterns to delete. If nothing is provided, the patterns from the `where` clause are used for deletion.", + "description": "Specifies the specific triple templates to delete. If nothing is provided, the patterns from the `where` clause are used for deletion.", "type": "array", "items": { - "$ref": "#/definitions/TriplePattern" + "$ref": "#/definitions/TripleDeleteTemplate" } }, "prefixes": { @@ -319,6 +319,43 @@ } ] }, + "TripleDeleteTemplate": { + "title": "TripleDeleteTemplate", + "description": "Represents a triple template to be deleted.", + "type": "object", + "required": [ + "object", + "predicate", + "subject" + ], + "properties": { + "object": { + "description": "The object of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNamedNodeOrLiteral" + } + ] + }, + "predicate": { + "description": "The predicate of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNamedNode" + } + ] + }, + "subject": { + "description": "The subject of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNamedNode" + } + ] + } + }, + "additionalProperties": false + }, "TriplePattern": { "title": "TriplePattern", "description": "Represents a triple pattern in a [SimpleWhereCondition].", @@ -341,7 +378,7 @@ "description": "The predicate of the triple pattern.", "allOf": [ { - "$ref": "#/definitions/VarOrNode" + "$ref": "#/definitions/VarOrNamedNode" } ] }, @@ -356,6 +393,88 @@ }, "additionalProperties": false }, + "VarOrNamedNode": { + "title": "VarOrNamedNode {", + "description": "Represents either a variable or a named node (IRI).", + "oneOf": [ + { + "title": "Variable", + "description": "A variable.", + "type": "object", + "required": [ + "variable" + ], + "properties": { + "variable": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "title": "NamedNode", + "description": "An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri).", + "type": "object", + "required": [ + "named_node" + ], + "properties": { + "named_node": { + "$ref": "#/definitions/IRI" + } + }, + "additionalProperties": false + } + ] + }, + "VarOrNamedNodeOrLiteral": { + "title": "VarOrNamedNodeOrLiteral", + "description": "Represents either a variable, a named node or a literal.", + "oneOf": [ + { + "title": "Variable", + "description": "A variable.", + "type": "object", + "required": [ + "variable" + ], + "properties": { + "variable": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "title": "NamedNode", + "description": "An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri).", + "type": "object", + "required": [ + "named_node" + ], + "properties": { + "named_node": { + "$ref": "#/definitions/IRI" + } + }, + "additionalProperties": false + }, + { + "title": "Literal", + "description": "An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal), i.e. a simple literal, a language-tagged string or a typed value.", + "type": "object", + "required": [ + "literal" + ], + "properties": { + "literal": { + "$ref": "#/definitions/Literal" + } + }, + "additionalProperties": false + } + ] + }, "VarOrNode": { "title": "VarOrNode", "description": "Represents either a variable or a node.", diff --git a/schema/axone-cognitarium/query.json b/schema/axone-cognitarium/query.json index dd74183..8b974e8 100644 --- a/schema/axone-cognitarium/query.json +++ b/schema/axone-cognitarium/query.json @@ -6,10 +6,17 @@ { "title": "Store", "description": "Returns information about the triple store.", - "type": "string", - "enum": [ + "type": "object", + "required": [ "store" - ] + ], + "properties": { + "store": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false }, { "title": "Select", @@ -133,7 +140,7 @@ "description": "The triples to construct. If nothing is provided, the patterns from the `where` clause are used for construction.", "type": "array", "items": { - "$ref": "#/definitions/TriplePattern" + "$ref": "#/definitions/TripleConstructTemplate" } }, "prefixes": { @@ -479,6 +486,43 @@ } ] }, + "TripleConstructTemplate": { + "title": "TripleConstructTemplate", + "description": "Represents a triple template to be forged for a construct query.", + "type": "object", + "required": [ + "object", + "predicate", + "subject" + ], + "properties": { + "object": { + "description": "The object of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNodeOrLiteral" + } + ] + }, + "predicate": { + "description": "The predicate of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNamedNode" + } + ] + }, + "subject": { + "description": "The subject of the triple pattern.", + "allOf": [ + { + "$ref": "#/definitions/VarOrNode" + } + ] + } + }, + "additionalProperties": false + }, "TriplePattern": { "title": "TriplePattern", "description": "Represents a triple pattern in a [SimpleWhereCondition].", @@ -501,7 +545,7 @@ "description": "The predicate of the triple pattern.", "allOf": [ { - "$ref": "#/definitions/VarOrNode" + "$ref": "#/definitions/VarOrNamedNode" } ] }, diff --git a/schema/axone-dataverse/execute.json b/schema/axone-dataverse/execute.json index b8f5b4c..e6c2f21 100644 --- a/schema/axone-dataverse/execute.json +++ b/schema/axone-dataverse/execute.json @@ -5,7 +5,7 @@ "oneOf": [ { "title": "SubmitClaims", - "description": "Submits new claims about a resource to the dataverse.\n\nThe SubmitClaims message is a pivotal component in the dataverse, enabling entities to contribute new claims about various resources. A claim represents a statement made by an entity, referred to as the issuer, which could be a person, organization, or service. These claims pertain to a diverse range of resources, including digital resources, services, zones, or individuals, and are asserted as factual by the issuer.\n\n#### Format\n\nClaims are injected into the dataverse through Verifiable Presentations (VPs). These presentations effectively amalgamate and showcase multiple credentials, thus providing a cohesive and comprehensive view of the assertions being made.\n\nWhile the data in a VP typically revolves around a common subject, it accommodates an unlimited number of subjects and issuers. This flexibility allows for a broad spectrum of claims to be represented.\n\nPrimarily, the claims leverage the OKP4 ontology, which facilitates articulating assertions about widely acknowledged resources in the dataverse, including digital services, digital resources, zones, governance, and more.\n\nAdditionally, other schemas may also be employed to supplement and enhance the validated knowledge contributed to these resources.\n\n#### Preconditions\n\nTo maintain integrity and coherence in the dataverse, several preconditions are set for the submission of claims:\n\n1. **Format Requirement**: Claims must be encapsulated within Verifiable Presentations (VPs).\n\n2. **Unique Identifier Mandate**: Each Verifiable Credential within the dataverse must possess a unique identifier.\n\n3. **Issuer Signature**: Claims must bear the issuer's signature. This signature must be verifiable, ensuring authenticity and credibility.", + "description": "Submits new claims about a resource to the dataverse.\n\nThe SubmitClaims message is a pivotal component in the dataverse, enabling entities to contribute new claims about various resources. A claim represents a statement made by an entity, referred to as the issuer, which could be a person, organization, or service. These claims pertain to a diverse range of resources, including digital resources, services, zones, or individuals, and are asserted as factual by the issuer.\n\n#### Format\n\nClaims are injected into the dataverse through Verifiable Credentials (VCs).\n\nPrimarily, the claims leverage the AXONE ontology, which facilitates articulating assertions about widely acknowledged resources in the dataverse, including digital services, digital resources, zones, governance, and more.\n\nAdditionally, other schemas may also be employed to supplement and enhance the validated knowledge contributed to these resources.\n\n#### Preconditions\n\nTo maintain integrity and coherence in the dataverse, several preconditions are set for the submission of claims:\n\n1. **Format Requirement**: Claims must be encapsulated within Verifiable Credentials (VCs).\n\n2. **Unique Identifier Mandate**: Each Verifiable Credential within the dataverse must possess a unique identifier.\n\n3. **Issuer Signature**: Claims must bear the issuer's signature. This signature must be verifiable, ensuring authenticity and credibility.\n\n4. **Content**: The actual implementation supports the submission of a single Verifiable Credential, containing a single claim.\n\n#### Supported cryptographic proofs\n\n- `Ed25519Signature2018`\n\n- `Ed25519Signature2020`\n\n- `EcdsaSecp256k1Signature2019`\n\n- `DataIntegrity` with the following cryptosuites: `eddsa-2022`, `eddsa-rdfc-2022`.", "type": "object", "required": [ "submit_claims" @@ -18,10 +18,10 @@ ], "properties": { "format": { - "description": "RDF format in which the metadata is represented. If not provided, the default format is [Turtle](https://www.w3.org/TR/turtle/) format.", + "description": "RDF dataset serialization format for the metadata. If not provided, the default format is [N-Quads](https://www.w3.org/TR/n-quads/) format.", "anyOf": [ { - "$ref": "#/definitions/RdfFormat" + "$ref": "#/definitions/RdfDatasetFormat" }, { "type": "null" @@ -72,34 +72,10 @@ "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, - "RdfFormat": { - "title": "RdfFormat", - "description": "`RdfFormat` represents the various serialization formats for RDF (Resource Description Framework) data.", + "RdfDatasetFormat": { + "title": "RdfDatasetFormat", + "description": "Represents the various serialization formats for an RDF dataset, i.e. a collection of RDF graphs ([RDF Dataset](https://www.w3.org/TR/rdf11-concepts/#section-dataset)).", "oneOf": [ - { - "title": "RdfXml", - "description": "RDF/XML Format\n\nRDF/XML is a syntax to express RDF information in XML. See the [official RDF/XML specification](https://www.w3.org/TR/rdf-syntax-grammar/).", - "type": "string", - "enum": [ - "rdf_xml" - ] - }, - { - "title": "Turtle", - "description": "Turtle (Terse RDF Triple Language) Format\n\nTurtle is a textual format for representing RDF triples in a more compact and human-readable way compared to RDF/XML. See the [official Turtle specification](https://www.w3.org/TR/turtle/).", - "type": "string", - "enum": [ - "turtle" - ] - }, - { - "title": "NTriples", - "description": "N-Triples Format\n\nN-Triples is a line-based, plain text format for encoding an RDF graph. Each line corresponds to a single RDF triple. See the [official N-Triples specification](https://www.w3.org/TR/n-triples/).", - "type": "string", - "enum": [ - "n_triples" - ] - }, { "title": "NQuads", "description": "N-Quads Format\n\nN-Quads is an extension of N-Triples to support RDF datasets by adding an optional fourth element to represent the graph name. See the [official N-Quads specification](https://www.w3.org/TR/n-quads/).", diff --git a/schema/axone-dataverse/response_to_dataverse.json b/schema/axone-dataverse/response_to_dataverse.json index f0abfd2..d1510bd 100644 --- a/schema/axone-dataverse/response_to_dataverse.json +++ b/schema/axone-dataverse/response_to_dataverse.json @@ -4,13 +4,28 @@ "description": "DataverseResponse is the response of the Dataverse query.", "type": "object", "required": [ - "name" + "name", + "triplestore_address" ], "properties": { "name": { "description": "The name of the dataverse.", "type": "string" + }, + "triplestore_address": { + "description": "The cognitarium contract address.", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] } }, - "additionalProperties": false + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } } diff --git a/schema/axone-law-stone/execute.json b/schema/axone-law-stone/execute.json index 12952ad..539b695 100644 --- a/schema/axone-law-stone/execute.json +++ b/schema/axone-law-stone/execute.json @@ -5,11 +5,18 @@ "oneOf": [ { "title": "BreakStone", - "description": "Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on `okp4-objectarium` contracts, if any. - Forget the main program (i.e. or at least unpin it). Only the contract admin is authorized to break it, if any. If already broken, this is a no-op.", - "type": "string", - "enum": [ + "description": "Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on `axone-objectarium` contracts, if any. - Forget the main program (i.e. or at least unpin it).\n\nOnly the creator address (the address that instantiated the contract) is authorized to invoke this message. If already broken, this is a no-op.", + "type": "object", + "required": [ "break_stone" - ] + ], + "properties": { + "break_stone": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false } ] } diff --git a/schema/axone-law-stone/instantiate.json b/schema/axone-law-stone/instantiate.json index 8c9209c..51d43a4 100644 --- a/schema/axone-law-stone/instantiate.json +++ b/schema/axone-law-stone/instantiate.json @@ -17,7 +17,7 @@ ] }, "storage_address": { - "description": "The `okp4-objectarium` contract address on which to store the law program.", + "description": "The `axone-objectarium` contract address on which to store the law program.", "type": "string" } }, diff --git a/schema/axone-law-stone/query.json b/schema/axone-law-stone/query.json index b04484f..e1589c4 100644 --- a/schema/axone-law-stone/query.json +++ b/schema/axone-law-stone/query.json @@ -5,7 +5,7 @@ "oneOf": [ { "title": "Ask", - "description": "If not broken, ask the logic module the provided query with the law program loaded.", + "description": "Submits a Prolog query string to the `Logic` module, evaluating it against the law program associated with this contract.\n\nIf the law stone is broken the query returns a response with the error `error(system_error(broken_law_stone),root)` set in the `answer` field.", "type": "object", "required": [ "ask" @@ -28,19 +28,33 @@ }, { "title": "Program", - "description": "If not broken, returns the law program location information.", - "type": "string", - "enum": [ + "description": "Retrieves the location metadata of the law program bound to this contract.\n\nThis includes the contract address of the `objectarium` and the program object ID, where the law program's code can be accessed.", + "type": "object", + "required": [ "program" - ] + ], + "properties": { + "program": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false }, { "title": "ProgramCode", - "description": "ProgramCode returns the law program code.", - "type": "string", - "enum": [ + "description": "Fetches the raw code of the law program tied to this contract.\n\nIf the law stone is broken, the query may fail if the program is no longer available in the `Objectarium`.", + "type": "object", + "required": [ "program_code" - ] + ], + "properties": { + "program_code": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false } ] } diff --git a/schema/axone-law-stone/response_to_ask.json b/schema/axone-law-stone/response_to_ask.json index 61a3986..fb8fc07 100644 --- a/schema/axone-law-stone/response_to_ask.json +++ b/schema/axone-law-stone/response_to_ask.json @@ -26,6 +26,12 @@ "type": "integer", "format": "uint64", "minimum": 0.0 + }, + "user_output": { + "type": [ + "string", + "null" + ] } }, "definitions": { @@ -34,7 +40,6 @@ "required": [ "has_more", "results", - "success", "variables" ], "properties": { @@ -47,9 +52,6 @@ "$ref": "#/definitions/Result" } }, - "success": { - "type": "boolean" - }, "variables": { "type": "array", "items": { @@ -64,6 +66,12 @@ "substitutions" ], "properties": { + "error": { + "type": [ + "string", + "null" + ] + }, "substitutions": { "type": "array", "items": { @@ -75,32 +83,14 @@ "Substitution": { "type": "object", "required": [ - "term", + "expression", "variable" ], "properties": { - "term": { - "$ref": "#/definitions/Term" - }, - "variable": { + "expression": { "type": "string" - } - } - }, - "Term": { - "type": "object", - "required": [ - "arguments", - "name" - ], - "properties": { - "arguments": { - "type": "array", - "items": { - "$ref": "#/definitions/Term" - } }, - "name": { + "variable": { "type": "string" } } diff --git a/schema/axone-law-stone/response_to_program.json b/schema/axone-law-stone/response_to_program.json index c9bec94..0068acd 100644 --- a/schema/axone-law-stone/response_to_program.json +++ b/schema/axone-law-stone/response_to_program.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ProgramResponse", - "description": "ProgramResponse carry elements to locate the program in a `okp4-objectarium` contract.", + "description": "ProgramResponse carry elements to locate the program in a `axone-objectarium` contract.", "type": "object", "required": [ "object_id", @@ -9,11 +9,11 @@ ], "properties": { "object_id": { - "description": "The program object id in the `okp4-objectarium` contract.", + "description": "The program object id in the `axone-objectarium` contract.", "type": "string" }, "storage_address": { - "description": "The `okp4-objectarium` contract address on which the law program is stored.", + "description": "The `axone-objectarium` contract address on which the law program is stored.", "type": "string" } }, diff --git a/schema/axone-objectarium/execute.json b/schema/axone-objectarium/execute.json index d681238..6cc90b5 100644 --- a/schema/axone-objectarium/execute.json +++ b/schema/axone-objectarium/execute.json @@ -5,7 +5,7 @@ "oneOf": [ { "title": "StoreObject", - "description": "StoreObject store an object to the bucket and make the sender the owner of the object. The object is referenced by the hash of its content and this value is returned. If the object is already stored, an error is returned.\n\nThe \"pin\" parameter specifies if the object should be pinned for the sender. In such case, the object cannot be removed (forget) from the storage.\n\nThe \"compression_algorithm\" parameter specifies the algorithm for compressing the object before storing it in the storage, which is optional. If no algorithm is specified, the algorithm used is the first algorithm of the bucket configuration limits. Note that the chosen algorithm can save storage space, but it will increase CPU usage. Depending on the chosen compression algorithm and the achieved compression ratio, the gas cost of the operation will vary, either increasing or decreasing.", + "description": "StoreObject store an object to the bucket and make the sender the owner of the object. The object is referenced by the hash of its content and this value is returned. If the object is already stored, it is a no-op. It may be pinned though.\n\nThe \"pin\" parameter specifies if the object should be pinned for the sender. In such case, the object cannot be removed (forget) from the storage.\n\nThe \"compression_algorithm\" parameter specifies the algorithm for compressing the object before storing it in the storage, which is optional. If no algorithm is specified, the algorithm used is the first algorithm of the bucket configuration limits. Note that the chosen algorithm can save storage space, but it will increase CPU usage. Depending on the chosen compression algorithm and the achieved compression ratio, the gas cost of the operation will vary, either increasing or decreasing.", "type": "object", "required": [ "store_object" diff --git a/schema/axone-objectarium/instantiate.json b/schema/axone-objectarium/instantiate.json index 2cf6682..5871896 100644 --- a/schema/axone-objectarium/instantiate.json +++ b/schema/axone-objectarium/instantiate.json @@ -61,7 +61,7 @@ "type": "object", "properties": { "accepted_compression_algorithms": { - "description": "The acceptable compression algorithms for the objects in the bucket. If this parameter is not set (none or empty array), then all compression algorithms are accepted. If this parameter is set, then only the compression algorithms in the array are accepted.\n\nWhen an object is stored in the bucket without a specified compression algorithm, the first algorithm in the array is used. Therefore, the order of the algorithms in the array is significant. Typically, the most efficient compression algorithm, such as the NoCompression algorithm, should be placed first in the array.\n\nAny attempt to store an object using a different compression algorithm than the ones specified here will fail.", + "description": "The acceptable compression algorithms for the objects in the bucket. If this parameter is not set, then all compression algorithms are accepted. If this parameter is set, then only the compression algorithms in the array are accepted.\n\nWhen an object is stored in the bucket without a specified compression algorithm, the first algorithm in the array is used. Therefore, the order of the algorithms in the array is significant. Typically, the most efficient compression algorithm, such as the NoCompression algorithm, should be placed first in the array.\n\nAny attempt to store an object using a different compression algorithm than the ones specified here will fail.", "default": [ "passthrough", "snappy", diff --git a/schema/axone-objectarium/response_to_bucket.json b/schema/axone-objectarium/response_to_bucket.json index ffc2cfa..bee79b0 100644 --- a/schema/axone-objectarium/response_to_bucket.json +++ b/schema/axone-objectarium/response_to_bucket.json @@ -7,7 +7,8 @@ "config", "limits", "name", - "pagination" + "pagination", + "stat" ], "properties": { "config": { @@ -37,6 +38,14 @@ "$ref": "#/definitions/PaginationConfig" } ] + }, + "stat": { + "description": "The statistics of the bucket.", + "allOf": [ + { + "$ref": "#/definitions/BucketStat" + } + ] } }, "additionalProperties": false, @@ -46,7 +55,7 @@ "type": "object", "properties": { "accepted_compression_algorithms": { - "description": "The acceptable compression algorithms for the objects in the bucket. If this parameter is not set (none or empty array), then all compression algorithms are accepted. If this parameter is set, then only the compression algorithms in the array are accepted.\n\nWhen an object is stored in the bucket without a specified compression algorithm, the first algorithm in the array is used. Therefore, the order of the algorithms in the array is significant. Typically, the most efficient compression algorithm, such as the NoCompression algorithm, should be placed first in the array.\n\nAny attempt to store an object using a different compression algorithm than the ones specified here will fail.", + "description": "The acceptable compression algorithms for the objects in the bucket. If this parameter is not set, then all compression algorithms are accepted. If this parameter is set, then only the compression algorithms in the array are accepted.\n\nWhen an object is stored in the bucket without a specified compression algorithm, the first algorithm in the array is used. Therefore, the order of the algorithms in the array is significant. Typically, the most efficient compression algorithm, such as the NoCompression algorithm, should be placed first in the array.\n\nAny attempt to store an object using a different compression algorithm than the ones specified here will fail.", "default": [ "passthrough", "snappy", @@ -120,6 +129,43 @@ }, "additionalProperties": false }, + "BucketStat": { + "title": "BucketStat", + "description": "BucketStat is the type of the statistics of a bucket.", + "type": "object", + "required": [ + "compressed_size", + "object_count", + "size" + ], + "properties": { + "compressed_size": { + "description": "The total size of the objects contained in the bucket after compression.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "object_count": { + "description": "The number of objects in the bucket.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "size": { + "description": "The total size of the objects contained in the bucket.", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false + }, "CompressionAlgorithm": { "description": "CompressionAlgorithm is an enumeration that defines the different compression algorithms supported for compressing the content of objects. The compression algorithm specified here are relevant algorithms for compressing data on-chain, which means that they are fast to compress and decompress, and have a low computational cost.\n\nThe order of the compression algorithms is based on their estimated computational cost (quite opinionated) during both compression and decompression, ranging from the lowest to the highest. This particular order is utilized to establish the default compression algorithm for storing an object.", "oneOf": [ diff --git a/ts/cognitarium-schema/README.md b/ts/cognitarium-schema/README.md index 4d72eb9..bade32e 100644 --- a/ts/cognitarium-schema/README.md +++ b/ts/cognitarium-schema/README.md @@ -1,6 +1,6 @@ # AXONE cognitarium schema -> Generated typescript types for [axone-cognitarium contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-cognitarium). +> Generated typescript types for [axone-cognitarium contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-cognitarium). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/ts/dataverse-schema/README.md b/ts/dataverse-schema/README.md index 43083d0..77f2ca0 100644 --- a/ts/dataverse-schema/README.md +++ b/ts/dataverse-schema/README.md @@ -1,6 +1,6 @@ # AXONE dataverse schema -> Generated typescript types for [axone-dataverse contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-dataverse). +> Generated typescript types for [axone-dataverse contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-dataverse). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/ts/law-stone-schema/README.md b/ts/law-stone-schema/README.md index abefdb9..98f7748 100644 --- a/ts/law-stone-schema/README.md +++ b/ts/law-stone-schema/README.md @@ -1,6 +1,6 @@ # AXONE law-stone schema -> Generated typescript types for [axone-law-stone contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-law-stone). +> Generated typescript types for [axone-law-stone contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-law-stone). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml) diff --git a/ts/objectarium-schema/README.md b/ts/objectarium-schema/README.md index f1a0e35..532f6dd 100644 --- a/ts/objectarium-schema/README.md +++ b/ts/objectarium-schema/README.md @@ -1,6 +1,6 @@ # AXONE objectarium schema -> Generated typescript types for [axone-objectarium contract](https://github.com/axone-protocol/contracts/tree/v3.0.0-54-gb243e6d/contracts/axone-objectarium). +> Generated typescript types for [axone-objectarium contract](https://github.com/axone-protocol/contracts/tree//contracts/axone-objectarium). [![version](https://img.shields.io/github/v/release/axone-protocol/axone-contract-schema?style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/releases) [![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/axone-contract-schema/build.yml?branch=main&label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/axone-contract-schema/actions/workflows/build.yml)