pub trait AsFunctional {
    fn as_ofn<'t>(&'t self) -> Functional<'t, Self> { ... }
fn as_ofn_ctx<'t>(
        &'t self,
        context: &'t Context<'t>
    ) -> Functional<'t, Self> { ... } }
Expand description

A trait for OWL elements that can be serialized to OWL Functional syntax.

Provided methods

Get a handle for displaying the element in functional syntax.

Instead of returning a String, this method returns an opaque struct that implements Display, which can be used to write to a file without having to build a fully-serialized string first, or to just get a string with the ToString implementation.

Example
use horned_functional::AsFunctional;

let axiom = DeclareClass(build.class("http://xmlns.com/foaf/0.1/Person"));
assert_eq!(
    axiom.as_ofn().to_string(),
    "Declaration(Class(<http://xmlns.com/foaf/0.1/Person>))"
);

Get a handle for displaying the element, using the given context.

Use the context to pass around a PrefixMapping, allowing the functional representation to be written using abbreviated IRIs when possible.

Example
use horned_functional::AsFunctional;
use horned_functional::Context;

let mut prefixes = curie::PrefixMapping::default();
prefixes.add_prefix("foaf", "http://xmlns.com/foaf/0.1/");

let axiom = DeclareClass(build.class("http://xmlns.com/foaf/0.1/Person"));
assert_eq!(
    axiom.as_ofn_ctx(&Context::from(&prefixes)).to_string(),
    "Declaration(Class(foaf:Person))"
);

Implementations on Foreign Types

Implementors