rudof_lib::rudof

Struct Rudof

Source
pub struct Rudof { /* private fields */ }
Expand description

This represents the public API to interact with rudof

Implementations§

Source§

impl Rudof

Source

pub fn new(config: &RudofConfig) -> Rudof

Source

pub fn config(&self) -> &RudofConfig

Source

pub fn update_config(&mut self, config: &RudofConfig)

Source

pub fn reset_data(&mut self)

Resets the current RDF Data

Source

pub fn reset_dctap(&mut self)

Resets the current DCTAP

Source

pub fn reset_shacl(&mut self)

Resets the current SHACL shapes graph

Source

pub fn reset_all(&mut self)

Resets all current values

Source

pub fn get_shacl_from_data(&mut self) -> Result<()>

Get the shapes graph schema from the current RDF data

Source

pub fn get_shacl(&self) -> Option<&ShaclSchema>

Get the current SHACL

Source

pub fn get_shex(&self) -> Option<&ShExSchema>

Get the current ShEx Schema

Source

pub fn get_dctap(&self) -> Option<&DCTAP>

Get the current DCTAP

Source

pub fn get_shapemap(&self) -> Option<&QueryShapeMap>

Get the current shapemap

Source

pub fn dctap2shex(&mut self) -> Result<()>

Converts the current DCTAP to a ShExSchema Stores the value of the ShExSchema in the current shex

Source

pub fn shex2plant_uml<W: Write>( &self, mode: &UmlGenerationMode, writer: &mut W, ) -> Result<()>

Generate a UML Class-like representation of a ShEx schema according to PlantUML syntax

Source

pub fn serialize_data<W: Write>( &self, format: &RDFFormat, writer: &mut W, ) -> Result<()>

Source

pub fn serialize_shapemap<W: Write>( &self, format: &ShapeMapFormat, formatter: &ShapeMapFormatter, writer: &mut W, ) -> Result<()>

Serialize the current ShapeMap

Source

pub fn serialize_shex<W: Write>( &self, format: &ShExFormat, formatter: &ShExFormatter, writer: &mut W, ) -> Result<()>

Serialize the current ShEx Schema

Source

pub fn run_query_str(&mut self, str: &str) -> Result<QuerySolutions<RdfData>>

Source

pub fn run_query<R: Read>( &mut self, reader: &mut R, ) -> Result<QuerySolutions<RdfData>>

Source

pub fn serialize_shacl<W: Write>( &self, format: &ShaclFormat, writer: &mut W, ) -> Result<()>

Source

pub fn reset_validation_results(&mut self)

Resets the current ShEx validation results The action is necessary to start a fresh validation

Source

pub fn reset_shex(&mut self)

Resets the current validator This operation removes the current shex_schema

Source

pub fn read_shacl<R: Read>( &mut self, reader: R, format: &ShaclFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<()>

Reads a SHACL schema from a reader

  • base is used to resolve relative IRIs
  • format indicates the Shacl format
Source

pub fn read_dctap<R: Read>( &mut self, reader: R, format: &DCTAPFormat, ) -> Result<()>

Reads a DCTAP and replaces the current one

  • format indicates the DCTAP format
Source

pub fn read_dctap_path<P: AsRef<Path>>( &mut self, path: P, format: &DCTAPFormat, ) -> Result<()>

Reads a DCTAP and replaces the current one

  • format indicates the DCTAP format
Source

pub fn read_shex<R: Read>( &mut self, reader: R, format: &ShExFormat, base: Option<&str>, ) -> Result<()>

Reads a ShExSchema and replaces the current one It also updates the current ShEx validator with the new ShExSchema

  • base is used to resolve relative IRIs
  • format indicates the ShEx format according to ShExFormat
Source

pub fn validate_shacl( &mut self, mode: &ShaclValidationMode, shapes_graph_source: &ShapesGraphSource, ) -> Result<ValidationReport>

Validate RDF data using SHACL

mode: Indicates whether to use SPARQL or native Rust implementation shapes_graph_source: Indicates the source of the shapes graph, which can be extracted from the current RDF data, or from the current SHACL schema. If there is no current SHACL schema, it tries to get it from the current RDF data

Source

pub fn validate_shex(&mut self) -> Result<ResultShapeMap>

Validate RDF data using ShEx It uses a ShEx validator which is current ShEx schema and the current ShapeMap that should

Source

pub fn add_endpoint(&mut self, iri: &IriS, prefixmap: &PrefixMap) -> Result<()>

Adds an endpoint to the current RDF data

Source

pub fn read_data<R: Read>( &mut self, reader: R, format: &RDFFormat, base: Option<&str>, reader_mode: &ReaderMode, ) -> Result<()>

Parses an RDF graph from a reader and merges it with the current graph

Source

pub fn clean_rdf_graph(&mut self)

Cleans the in-memory graph

Source

pub fn shapemap_add_node_shape_selectors( &mut self, node: NodeSelector, shape: ShapeSelector, )

Add a pair of node selector and shape selector to the current shapemap

Source

pub fn read_shapemap<R: Read>( &mut self, reader: R, shapemap_format: &ShapeMapFormat, ) -> Result<()>

Read a shapemap

Source

pub fn reset_shapemap(&mut self)

Source

pub fn nodes_prefixmap(&self) -> PrefixMap

Returns the RDF data prefixmap

Source

pub fn shex_shapes_prefixmap(&self) -> Option<PrefixMap>

Returns the shapes prefixmap

If no ShEx schema has been set, returns None

Source

pub fn get_rdf_data(&self) -> &RdfData

Get current RDF Data

Source

pub fn shex_schema_without_imports(&mut self) -> Result<SchemaWithoutImports>

Obtains the current shex_schema after resolving import declarations

If the import declarations in the current schema have not been resolved, it resolves them

Trait Implementations§

Source§

impl Debug for Rudof

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for Rudof

Auto Trait Implementations§

§

impl Freeze for Rudof

§

impl !RefUnwindSafe for Rudof

§

impl !Sync for Rudof

§

impl Unpin for Rudof

§

impl !UnwindSafe for Rudof

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T