(var target (baseAbsolute (argv 1))) (var G (semantics target)) (select ?p from G where { ?s ?p ?o } (add properties (racine ?p))) (select ?c from G where { ?s a ?c } (add classes (racine ?c))) (for racine in properties ((var P (semanticsOrError racine)) (if (type P Formula) (add pschemata P)) (else (say "ERROR: Can't access " racine)))) (for racine in classes ((var C (semanticsOrError racine)) (if (type C Formula) (add cschemata C)) (else (say "ERROR: Can't access " racine)))) (for schema in pschemata ((var results (select ?s where { )) ) ) * * * (create validation) (var target (baseAbsolute (argv 1))) (var G (semantics target)) (select ?p from G where { ?s ?p ?o } ((var r (racine ?p)) (store validation { ?p a Prop; root r }))) (select ?c from G where { ?s a ?c } ((var r (racine ?c)) (store validation { ?c a Class; root r }))) (select ?uri from validation where { ?term root ?uri } ((var S (semanticsOrError ?uri)) (if (type S Formula) (store validation { ?uri triples S })) (else (say "ERROR: Can't access" ?uri)))) (var Q { ?term root ?uri . ?uri triples ?S }) (select ?term ?uri ?S from validation where Q ((var defs (select ?sch from ?S where { ?term rdfs:isDefinedBy ?sch })) (if (defs) (store validation { ?term docschema ?sch )) (else (store validation { ?term docschema ?uri })))) (select ?term ?uri from validation where { ?term a Prop; docschema ?uri } ((var aug (entail (semantics ?uri))) (if (not (includes aug { ?term a rdf:Property })) (say ?term "is not defined as a property in" ?uri)))) (select ?term ?uri from validation where { ?term a Class; docschema ?uri } ((var aug (entail (semantics ?uri))) (if (not (includes aug { ?term a rdfs:Class })) (say ?term "is not defined as a class in" ?uri)))) * * * get_racine_triples = (G v q class) (select v from G where q ((var root (racine v)) main = (create validation) (var target (baseAbsolute (argv 1))) (var G (semantics target)) (get_racine_triples G ?p { ?s ?p ?o } Property) (get_racine_triples G ?c { ?s a ?c } Class) (select ?p from G where { ?s ?p ?o } ((var root (racine ?p)) ( (store validation { ?p a Prop; root r }))) (select ?c from G where { ?s a ?c } ((var r (racine ?c)) (store validation { ?c a Class; root r }))) (select ?uri from validation where { ?term root ?uri } ((var S (semanticsOrError ?uri)) (if (type S Formula) (store validation { ?uri triples S })) (else (say "ERROR: Can't access" ?uri)))) (var Q { ?term root ?uri . ?uri triples ?S }) (select ?term ?uri ?S from validation where Q ((var defs (select ?sch from ?S where { ?term rdfs:isDefinedBy ?sch })) (if (defs) (store validation { ?term docschema ?sch )) (else (store validation { ?term docschema ?uri })))) (select ?term ?uri from validation where { ?term a Prop; docschema ?uri } ((var aug (entail (semantics ?uri))) (if (not (includes aug { ?term a rdf:Property })) (say ?term "is not defined as a property in" ?uri)))) (select ?term ?uri from validation where { ?term a Class; docschema ?uri } ((var aug (entail (semantics ?uri))) (if (not (includes aug { ?term a rdfs:Class })) (say ?term "is not defined as a class in" ?uri)))) * * * for each property: uri = racine(property) triples = semanticsOrError(uri) if not triples: ERROR: semantics undefined of uri continue def = definition(property, triples) if def: dtriples = semanticsOrError(def) if not dtriples: ERROR: semantics undefined of def continue aug = entail(dtriples) else: aug = entail(triples) if not (property a rdf:Property) in aug: ERROR: property not defined (for ?p from INPUT where { ?s ?p ?o } ((var uri (racine ?p)) (var triples (semanticsOrError uri)) (if (not triples) (say "Error: can't access" ?uri) (continue)) (var def (first (select ?d from triples { ?p rdfs:isDefinedBy ?d }))) (if (def) (var dtriples (semanticsOrError def)) (if (not dtriples) (say "Error: can't access" ?uri) (continue)) (var aug (entail dtriples))) (else (var aug (entail triples))) (if (not (includes aug { ?p a rdf:Property })) (say "Error:" ?p "is undefined")))) DEFINITION = { ?p a rdf:Property } check def ((t expected) ((var uri (racine t)) (var triples (semanticsOrError uri)) (if (not triples) (say "Error: can't access" ?uri) (return)) (var defn (first (select ?d from triples { t rdfs:isDefinedBy ?d }))) (if (defn) (var dtriples (semanticsOrError defn)) (if (not dtriples) (say "Error: can't access" defn) (return)) (var aug (entail dtriples))) (else (var aug (entail triples))) (if (not (includes aug expected)) (say "Error:" t "is undefined")))) ) . main script ( (for ?p from INPUT where { ?s ?p ?o } (check ?p { ?p a rdf:Property })) (for ?c from INPUT where { ?s a ?c } (check ?c { ?c a rdfs:Class })) ) . * * * first def ((seq) (if seq (return (seq 0))) (else (return (list))) ) . entail def ((triples) (create entailment) (store entailment ) (return (conclude triples entailment)) ) . check def ((t expected) ((var uri (racine t)) (var triples (semanticsOrError uri ((say "Error: can't access" ?uri) (return)))) (var defn (first (select ?d from triples { t rdfs:isDefinedBy ?d }))) (if defn (var dtriples (semanticsOrError defn ((say "Error: can't access" defn) (return)))) (var aug (entail dtriples))) (else (var aug (entail triples))) (if (not (includes aug expected)) (say "Error:" t "is undefined in" (or defn uri))))) ) . validate def ((input) (for ?p from input where { ?s ?p ?o } (check ?p { ?p a rdf:Property })) (for ?c from input where { ?s a ?c } (check ?c { ?c a rdfs:Class })) ) . main script ( (var target (baseAbsolute (argv 1))) (var input (semantics target)) (validate input) ) .