Skip to content

Commit

Permalink
refactor(dataverse): refine dataverse contract specification
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Oct 24, 2023
1 parent d775eb4 commit 77c471a
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions contracts/okp4-dataverse/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::Binary;
#[allow(unused_imports)]
use okp4_logic_bindings::AskResponse;

/// `InstantiateMsg` is used to initialize a new instance of the dataverse.
#[cw_serde]
Expand All @@ -28,8 +26,7 @@ pub enum ExecuteMsg {
/// ExecuteMsg::RegisterService {
/// subject: "https://ontology.okp4.space/dataverse/service/metadata/52549532-887d-409b-a9c0-fb68f9e521d2",
/// identity: "did:key:z6MkrpCPVDHcsqi3aaqnemLC1aBTUwkfPwTyzc8sFWYwm1PA",
/// identifier: "urn:uuid:803cd033-2eed-4db7-847b-f46715a42a70",
/// registrar: "did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp",
/// identifier: "urn:uuid:803cd033-2eed-4db7-847b-f46715a42a70"
/// }
/// ```
RegisterService {
Expand All @@ -43,25 +40,28 @@ pub enum ExecuteMsg {
/// 1. **Identification**: It provides a unique identifier for the service, ensuring that each service can be distinctly recognized within the dataverse.
/// 2. **Endpoint**: The URI acts as the access point or endpoint for the service. It specifies where the service can be accessed and how interactions with the service should be initiated.
identifier: Uri,
/// The URI of the entity responsible for registering and managing the service.
registrar: Uri,
/// The URI of the entity responsible for registering and managing the service in the dataverse (i.e. on the blockchain).
/// It's an optional field, if not provided the service is registered by the entity that invokes the transaction.
registrar: Option<Did>,
},

/// # RegisterDataset
/// Registers a new dataset within the dataverse.
///
/// A `Dataset` represents a collection of related data that is organized and presented in a specific format by the provider. This data can be in various forms, such as CSV files, images, videos, and more. It can also refer to data sources like databases and APIs.
/// A `Dataset` represents a collection of related data that is organized and presented in a specific format by the provider.
/// This data can be in various forms, such as CSV files, images, videos, and more. It can also refer to data sources like databases and APIs.
///
/// Each dataset is uniquely identified by its URI, which serves as both the identifier and the access point for the dataset. When accessing a dataset, it's crucial to understand the protocol and methods supported by the dataset's endpoint. For instance, a dataset with an HTTP-based URI might be accessible via GET requests and may require specific headers or parameters for successful retrieval.
/// Each dataset is uniquely identified by its URI, which serves as both the identifier and the access point for the dataset.
/// When accessing a dataset, it's crucial to understand the protocol and methods supported by the dataset's endpoint. For instance, a dataset
/// with an HTTP-based URI might be accessible via GET requests and may require specific headers or parameters for successful retrieval.
///
/// #### Examples:
///
/// ```rust
/// ExecuteMsg::RegisterDataset {
/// subject: "https://ontology.okp4.space/dataverse/dataset/96a562a9-5feb-4a41-bcf2-cc8610af9f78",
/// identifier: "urn:uuid:3ed871dc-72d0-499f-b8c2-7edcad56a76e",
/// provided_by: "urn:uuid:803cd033-2eed-4db7-847b-f46715a42a70",
/// registrar: "did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp",
/// identifier: "ipfs://bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4",
/// provided_by: "urn:uuid:803cd033-2eed-4db7-847b-f46715a42a70"
/// }
/// ```
RegisterDataset {
Expand All @@ -71,8 +71,9 @@ pub enum ExecuteMsg {
identifier: Uri,
/// The URI of the service, already registered in the dataverse, that provides the dataset.
provided_by: Uri,
/// The URI of the entity responsible for registering and managing the dataset.
registrar: Uri,
/// The URI of the entity responsible for registering and managing the dataset in the dataverse (i.e. on the blockchain).
/// It's an optional field, if not provided the dataset is registered by the entity that invokes the transaction.
registrar: Option<Did>,
},

/// # FoundZone
Expand All @@ -86,26 +87,26 @@ pub enum ExecuteMsg {
/// ```
/// ExecuteMsg::FoundZone {
/// subject: "https://ontology.okp4.space/dataverse/zone/ef347285-e52a-430d-9679-dcb76b962ce7",
/// identifier: "urn:uuid:6d1aaad8-9411-4758-a9f9-ed43358af1fd",
/// registrar: "did:key:0x04d1f1b8f8a7a28f9a5a254c326a963a22f5a5b5d5f5e5d5c5b5a5958575655",
/// identifier: "urn:uuid:6d1aaad8-9411-4758-a9f9-ed43358af1fd"
/// }
/// ```
FoundZone {
/// The unique RDF identifier for the resource representation of the zone within the dataverse.
subject: Iri,
/// The unique URI that identifies the zone.
identifier: Uri,
/// The URI of the entity responsible for registering and managing the zone.
registrar: Uri,
/// The URI of the entity responsible for registering and managing the zone in the dataverse (i.e. on the blockchain).
/// It's an optional field, if not provided the zone is registered by the entity that invokes the transaction.
registrar: Option<Did>,
},

/// # AttachMetadata
/// Attaches metadata to a specified resource registered in the dataverse.
///
/// Metadata provides additional information or details about a resource.
AttachMetadata {
/// The RDF identifier of the resource for which the metadata should be attached.
subject: Uri,
/// The unique RDF identifier of the resource for which the metadata should be attached.
subject: Iri,
/// RDF format in which the metadata is represented.
/// If not provided, the default format is [Turtle](https://www.w3.org/TR/turtle/) format.
format: Option<RdfFormat>,
Expand All @@ -119,14 +120,14 @@ pub enum ExecuteMsg {
/// Once removed the metadata is no longer accessible.
DetachMetadata {
/// The RDF identifier of the metadata to be removed.
resource_identifier: Uri,
subject: Iri,
},

/// # ReviseMetadata
/// Revises a previously associated metadata in order to update it or amend it.
ReviseMetadata {
/// The RDF identifier of the metadata to be revised.
subject: Uri,
subject: Iri,
/// RDF format in which the metadata is represented.
/// If not provided, the default format is [Turtle](https://www.w3.org/TR/turtle/) format.
format: Option<RdfFormat>,
Expand Down Expand Up @@ -175,11 +176,6 @@ pub enum RdfFormat {
NQuads,
}

/// # Did
/// `Did` represents a Decentralized Identifier (DID), a globally unique identifier.
/// see https://www.w3.org/TR/did-core/.
type Did = String;

/// # Uri
/// `Uri` represents a Uniform Resource Identifier (URI), a string of characters that provides a simple way
/// to identify a resource.
Expand All @@ -190,6 +186,11 @@ type Uri = String;
/// `Iri` (Internationalized Resource Identifier) represents a unique identifier used to identify resources.
type Iri = String;

/// # Did
/// `Did` represents a Decentralized Identifier (DID), a globally unique identifier.
/// see https://www.w3.org/TR/did-core/.
type Did = Uri;

/// `QueryMsg` defines the set of possible queries that can be made to retrieve information about the dataverse.
///
/// This enum provides variants for querying the dataverse's details and other related information.
Expand Down

0 comments on commit 77c471a

Please sign in to comment.