linked_data_schema/
lib.rs1mod linked_data_schema_field_visitor;
2
3pub use linked_data_schema_derive::LinkedDataSchema;
4pub use linked_data_schema_field_visitor::LinkedDataSchemaFieldVisitor;
5use shacl_ast::Schema;
6use shacl_ast::component::Component;
7use srdf::SRDFGraph;
8
9pub mod reexports {
10 pub use iri_s;
11 pub use prefixmap;
12 pub use shacl_ast;
13 pub use srdf;
14 pub use uuid;
15}
16
17pub trait LinkedDataSchema {
18 fn shacl() -> Schema<SRDFGraph>;
19
20 fn components() -> Vec<Component>;
21}
22
23#[macro_export]
24macro_rules! print_linked_data_schema_for {
25 ( $x:ty ) => {
26 let schema = <$x>::shacl();
27 let mut shacl_writer = ShaclWriter::<SRDFGraph>::default();
28
29 shacl_writer.write(&schema).unwrap();
30
31 let mut cursor = Cursor::new(Vec::new());
32
33 shacl_writer
34 .serialize(&RDFFormat::Turtle, &mut cursor)
35 .unwrap();
36
37 let content = cursor.into_inner();
38 let s = String::from_utf8(content).unwrap();
39 println!("{}", s);
40 };
41}