Skip to content

Commit

Permalink
docs(cognitarium): improve documentation of the contract (minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel authored and amimart committed Apr 20, 2023
1 parent 4568e49 commit 59387f7
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions contracts/okp4-cognitarium/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ pub struct StoreLimits {
pub max_insert_data_triple_count: Option<Uint128>,
}

/// # GraphInput
/// # DataInput
/// Represents the input data for the [ExecuteMsg::InsertData] message as RDF triples in a specific format.
#[cw_serde]
pub enum DataInput {
/// # RDF XML
/// Input in [RDF/XML](https://www.w3.org/TR/rdf-syntax-grammar/) format.
RDFXml(Binary),

/// # Turtle
/// Input in [Turtle](https://www.w3.org/TR/turtle/) format.
Turtle(Binary),

/// # N-Triples
/// Input in [N-Triples](https://www.w3.org/TR/n-triples/) format.
NTriples(Binary),
}
Expand All @@ -87,10 +88,12 @@ pub enum DataInput {
/// Represents an IRI.
#[cw_serde]
pub enum IRI {
/// # Prefixed
/// An IRI prefixed with a prefix.
/// The prefixed IRI is expanded to a full IRI using the prefix definition specified in the query.
/// For example, the prefixed IRI `rdf:type` is expanded to `http://www.w3.org/1999/02/22-rdf-syntax-ns#type`.
Prefixed(String),
/// # Full
/// A full IRI.
Full(String),
}
Expand Down Expand Up @@ -125,12 +128,13 @@ pub struct Results {
#[cw_serde]
#[serde(tag = "type")]
pub enum Value {
/// # URI
/// Represents an IRI.
URI {
/// The value of the IRI.
value: IRI,
},

/// # Literal
/// Represents a literal S with optional language tag L or datatype IRI D.
Literal {
/// The value of the literal.
Expand All @@ -141,7 +145,7 @@ pub enum Value {
/// The datatype of the literal.
datatype: Option<IRI>,
},

/// # BlankNode
/// Represents a blank node.
BlankNode {
/// The identifier of the blank node.
Expand Down Expand Up @@ -184,6 +188,7 @@ pub struct Prefix {
/// Represents an item to select in a [SelectQuery].
#[cw_serde]
pub enum SelectItem {
/// # Variable
/// Represents a variable.
Variable(String),
}
Expand All @@ -196,6 +201,7 @@ pub type WhereClause = Vec<WhereCondition>;
/// Represents a condition in a [WhereClause].
#[cw_serde]
pub enum WhereCondition {
/// # Simple
/// Represents a simple condition.
Simple(SimpleWhereCondition),
}
Expand All @@ -204,6 +210,7 @@ pub enum WhereCondition {
/// Represents a simple condition in a [WhereCondition].
#[cw_serde]
pub enum SimpleWhereCondition {
/// # TriplePattern
/// Represents a triple pattern, i.e. a condition on a triple based on its subject, predicate and
/// object.
TriplePattern(TriplePattern),
Expand All @@ -226,8 +233,10 @@ pub struct TriplePattern {
#[cw_serde]
pub enum SubjectPattern {
/// # Variable
/// A variable.
Variable(String),
/// # Node
/// A node, i.e. an IRI or a blank node.
Node(Node),
}

Expand All @@ -236,8 +245,10 @@ pub enum SubjectPattern {
#[cw_serde]
pub enum PredicatePattern {
/// # Variable
/// A variable.
Variable(String),
/// # Node
/// A node, i.e. an IRI or a blank node.
Node(Node),
}

Expand All @@ -246,11 +257,14 @@ pub enum PredicatePattern {
#[cw_serde]
pub enum ObjectPattern {
/// # Variable
/// A variable.
Variable(String),
/// # Node
/// A node, i.e. an IRI or a blank node.
Node(Node),
/// # Literal
/// An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal).
/// 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.
Literal(Literal),
}

Expand Down

0 comments on commit 59387f7

Please sign in to comment.