pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
210 stars 23 forks source link

Macro for authoring graphs using defined terms. #125

Open damooo opened 1 year ago

damooo commented 1 year ago

A macro for authoring a graph/dataset, or their respective sources would be helpful in writing data, test cases, using pre defined terms. Say like following.


import rdf_vocabularies::ns;
let term1: Term = <>;
let terms2: Term = <>;

let graph: FastGraph = sophia::graph!(
   term1 ns::rdf::type_ ns::ldp::BasicContainer, ns::ldp::Resource;
       ns::solid::storageDescription term2.
);
pchampin commented 6 months ago

This would be a really cool feature indeed. I gave it a try with macro_rules, and came to the conclusion that it can only be achieved with procedural macros...