Skip to main content

Crate asimov_patterns

Crate asimov_patterns 

Source
Expand description

Execution traits and configuration values for ASIMOV program patterns.

A pattern describes a program’s role and logical input/output contract: for example, a Reader imports a document into RDF, an Adapter queries a dataset with SPARQL, and a Writer exports RDF to another representation. The Program Patterns Specification defines their command-line interfaces and the requirements for hosts that invoke them.

This crate provides two building blocks:

  • Execute<T> is the asynchronous operation shared by all pattern traits, with an implementation-specific associated Error type.
  • programs contains role-specific marker traits and owned option values such as ReaderOptions, with builders for configuring invocations. Optional native support is described separately by capability metadata such as ListerCapabilities, using OptionSupport to distinguish unknown support from an explicit declaration. Callers supply this metadata; this crate does not discover capabilities or read module manifests.

Executable lookup, process management, stream transport, and result decoding belong to implementations. The companion asimov-runner crate supplies Tokio-backed process wrappers and re-exports these option types. asimov-remote supplies HTTP-backed fetch/list operations using the same traits. Shared raw JSONL payloads live in asimov-flow; each executor chooses its own error type. These role traits are the execution boundary for reusable components, while explicit typed port schemas and generalized graph scheduling are still evolving. Consult its documentation for supported output modes and current limitations; implementing a marker trait does not by itself establish PPS conformance.

§Configuring an operation

use asimov_patterns::ListerOptions;

let options = ListerOptions::builder()
    .limit(25)
    .output("jsonl")
    .build();

assert_eq!(options.limit, Some(25));
assert_eq!(options.output.as_deref(), Some("jsonl"));
assert!(options.other.is_empty());

Building options neither executes a program nor validates its capabilities. Unset fields remain None: asimov-runner omits the corresponding flags and lets the program apply its specified defaults. In particular, input and output fields name formats, not files or stream endpoints.

§Payloads and representations

Pattern traits describe semantics without fixing a Rust representation for the result. Their type parameter T can represent serialized bytes, parsed data, a fallible stream, or another documented result representation; it is not the number of RDF statements or logical results. Indexer fixes its result to () because indexing has no payload output. A streaming implementation can return successful startup before execution finishes; its result must expose subsequent failures. See programs for links to concrete transport, completion, and result semantics.

The options do not parse, validate, or transcode RDF. The spec’s default jsonl token requires a shared RDF mapping profile; it does not imply JSON-LD or a particular JSON object shape. Composing two graph patterns requires agreement on both serialization and profile.

§Features

The crate declares no_std and uses alloc for strings, collections, and boxed futures. None of its public APIs is gated on the std feature. The default features are all and std; std enables standard-library support in dependencies. all, tracing, and unstable currently enable no additional behavior in this crate. Disabling std here does not guarantee that the dependency graph is usable on a target without a standard library. Currently, a standalone --no-default-features build fails in the transitive dogma dependency because collection traits are enabled without its alloc feature; the ungated API should not be read as a working no-std build guarantee.

Re-exports§

pub use execute::*;
pub use capabilities::*;
pub use programs::*;

Modules§

capabilities
Caller-supplied metadata about a program’s native option support.
execute
The asynchronous execution interface shared by all program patterns.
programs
Role-specific execution traits and command-line configuration values.