Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/rdf dataset format #579

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions contracts/axone-dataverse/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ pub mod query {
#[cfg(test)]
mod tests {
use super::*;
use crate::msg::{DataverseResponse, RdfFormat, TripleStoreConfig, TripleStoreLimitsInput};
use crate::msg::{
DataverseResponse, RdfDatasetFormat, TripleStoreConfig, TripleStoreLimitsInput,
};
use crate::testutil::testutil::read_test_data;
use axone_cognitarium::msg::{
DataFormat, Head, Node, Results, SelectItem, SelectQuery, SelectResponse,
Expand Down Expand Up @@ -271,7 +273,7 @@ mod tests {

let msg = ExecuteMsg::SubmitClaims {
metadata: Binary::from("data".as_bytes()),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
};

let result = execute(deps.as_mut(), env, info, msg);
Expand Down Expand Up @@ -338,7 +340,7 @@ mod tests {
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary(read_test_data("vc-eddsa-2020-ok.nq")),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand Down Expand Up @@ -400,7 +402,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary("notrdf".as_bytes().to_vec()),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand All @@ -416,7 +418,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary(vec![]),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand All @@ -435,7 +437,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary(read_test_data("vc-eddsa-2020-ok-unsecured.nq")),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand All @@ -454,7 +456,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary(read_test_data("vc-unsupported-1.nq")),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand Down Expand Up @@ -502,7 +504,7 @@ _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/exam
mock_info("axone1072nc6egexqr2v6vpp7yxwm68plvqnkf5uemr0", &[]),
ExecuteMsg::SubmitClaims {
metadata: Binary(read_test_data("vc-eddsa-2020-ok.nq")),
format: Some(RdfFormat::NQuads),
format: Some(RdfDatasetFormat::NQuads),
},
);

Expand Down
11 changes: 6 additions & 5 deletions contracts/axone-dataverse/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ pub enum ExecuteMsg {
/// The serialized metadata intended for attachment.
/// This metadata should adhere to the format specified in the `format` field.
metadata: Binary,
/// RDF format in which the metadata is represented.
/// 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: Option<RdfFormat>,
format: Option<RdfDatasetFormat>,
},

/// # RevokeClaims
Expand Down Expand Up @@ -150,11 +150,12 @@ impl From<TripleStoreLimitsInput> for axone_cognitarium::msg::StoreLimitsInput {
}
}

/// # RdfFormat
/// `RdfFormat` represents the various serialization formats for RDF (Resource Description Framework) data.
/// # RdfDatasetFormat
/// 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)).
#[cw_serde]
#[derive(Default)]
pub enum RdfFormat {
pub enum RdfDatasetFormat {
/// # NQuads
/// N-Quads Format
///
Expand Down
16 changes: 8 additions & 8 deletions docs/axone-dataverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ To maintain integrity and coherence in the dataverse, several preconditions are

- `DataIntegrity` with the following cryptosuites: `eddsa-2022`, `eddsa-rdfc-2022`.

| parameter | description |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `submit_claims` | _(Required.) _ **object**. |
| `submit_claims.format` | **[RdfFormat](#rdfformat)\|null**. RDF format in which the metadata is represented. If not provided, the default format is [N-Quads](https://www.w3.org/TR/n-quads/) format. |
| `submit_claims.metadata` | _(Required.) _ **[Binary](#binary)**. The serialized metadata intended for attachment. This metadata should adhere to the format specified in the `format` field. |
| parameter | description |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `submit_claims` | _(Required.) _ **object**. |
| `submit_claims.format` | **[RdfDatasetFormat](#rdfdatasetformat)\|null**. RDF dataset serialization format for the metadata. If not provided, the default format is [N-Quads](https://www.w3.org/TR/n-quads/) format. |
| `submit_claims.metadata` | _(Required.) _ **[Binary](#binary)**. The serialized metadata intended for attachment. This metadata should adhere to the format specified in the `format` field. |

### ExecuteMsg::RevokeClaims

Expand Down Expand Up @@ -174,9 +174,9 @@ N-Quads is an extension of N-Triples to support RDF datasets by adding an option
| ----------- |
| `"n_quads"` |

### RdfFormat
### RdfDatasetFormat

`RdfFormat` represents the various serialization formats for RDF (Resource Description Framework) data.
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)).

| variant | description |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -238,5 +238,5 @@ let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```

---

*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-dataverse.json` (`daa1f5839f39568e`)*
*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-dataverse.json` (`6c036ea055d1bbb8`)*
````
Loading