diff --git a/.clj-kondo/.cache/v1/cljc/ont-app.igraph.core.transit.json b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.core.transit.json new file mode 100644 index 0000000..d9975f8 --- /dev/null +++ b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.core.transit.json @@ -0,0 +1 @@ +["^ ","~:filename","src/ont_app/igraph/core.cljc","~:clj",["^ ","~$IGraphMutable",["^ ","~:row",156,"~:col",1,"~:name","^2","~:ns","~$ont-app.igraph.core","~:top-ns","^7","~:methods",["~$add!","~$subtract!"]],"~$subjects",["^ ","^3",75,"^4",3,"~:fixed-arities",["~#set",[1]],"^5","^<","^6","^7","^8","^7"],"~$IGraphAccumulateOnly",["^ ","^3",174,"^4",1,"^5","^?","^6","^7","^8","^7","^9",["~$claim","~$retract"]],"~$query",["^ ","^3",108,"^4",3,"^=",["^>",[2]],"^5","^B","^6","^7","^8","^7"],"~$subtract",["^ ","^3",147,"^4",3,"^=",["^>",[2]],"^5","^C","^6","^7","^8","^7"],"~$add",["^ ","^3",48,"^4",1,"^=",["^>",[2]],"^5","^D","^6","^7","^8","^7"],"~$union",["^ ","^3",199,"^4",3,"^=",["^>",[2]],"^5","^E","^6","^7","^8","^7"],"~$IGraphImmutable",["^ ","^3",138,"^4",1,"^5","^F","^6","^7","^8","^7","^9",["^D","^C"]],"~$match-or-traverse",["^ ","^3",624,"^4",1,"^5","^G","^6","^7","^8","^7"],"~$get-o",["^ ","^3",90,"^4",3,"^=",["^>",[3]],"^5","^H","^6","^7","^8","^7"],"~$triples-removal-format",["^ ","^3",285,"^4",1,"^=",["^>",[1]],"^5","^I","^6","^7","^8","^7","~:type","~:fn"],"~$ask",["^ ","^3",99,"^4",3,"^=",["^>",[4]],"^5","^L","^6","^7","^8","^7"],"^@",["^ ","^3",175,"^4",5,"^=",["^>",[2]],"^5","^@","^6","^7","^8","^7"],"~$normalize-flat-description",["^ ","^3",706,"^4",1,"^=",["^>",[1]],"^5","^M","^6","^7","^8","^7","^J","^K"],"~$write-to-file",["^ ","^3",28,"^4",4,"^=",["^>",[2]],"^5","^N","^6","^7","^8","^7","~:arities",["^ ","~i2",["^ ","~:ret","~:string"]],"^J","^K"],"~$mutability",["^ ","^3",128,"^4",3,"^=",["^>",[1]],"^5","^R","^6","^7","^8","^7"],"~$claim-unique",["^ ","^3",744,"^4",1,"^5","^S","^6","^7","^8","^7","^J","~:ifn"],"~$normal-form?",["^ ","^3",215,"^4",1,"^=",["^>",[1]],"^5","^U","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P",["^>",["~:nil","~:boolean"]]]],"^J","^K"],"~$intersection",["^ ","^3",202,"^4",3,"^=",["^>",[2]],"^5","^X","^6","^7","^8","^7"],"~$unique",["^ ","^3",649,"^4",4,"^=",["^>",[1,2]],"^5","^Y","^6","^7","^8","^7","^J","^K"],"~$IGraph",["^ ","^3",62,"^4",1,"^5","^Z","^6","^7","^8","^7","^9",["~$normal-form","^<","~$get-p-o","^H","^L","^B","~$invoke","^R"]],"^10",["^ ","^3",82,"^4",3,"^=",["^>",[2]],"^5","^10","^6","^7","^8","^7"],"^:",["^ ","^3",157,"^4",5,"^=",["^>",[2]],"^5","^:","^6","^7","^8","^7"],"~$reduce-spo",["^ ","^3",749,"^4",1,"^=",["^>",[3]],"^5","^12","^6","^7","^8","^7","^J","^K"],"~$t-comp",["^ ","^3",495,"^4",1,"^=",["^>",[1]],"^5","^13","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"^;",["^ ","^3",165,"^4",3,"^=",["^>",[2]],"^5","^;","^6","^7","^8","^7"],"~$remove-from-graph",["^ ","^3",309,"^4",1,"^5","^14","^6","^7","^8","^7"],"~$traverse-or",["^ ","^3",469,"^4",1,"~:varargs-min-arity",0,"^5","^15","^6","^7","^8","^7","^O",["^ ","~:varargs",["^ ","^P","^K","~:min-arity",0]],"^J","^K"],"~$assert-unique-fn",["^ ","^3",720,"^4",1,"^=",["^>",[5]],"^5","^19","^6","^7","^8","^7","^J","^K"],"~$traverse",["^ ","^3",321,"^4",1,"^=",["^>",[4,3,5]],"^5","^1:","^6","^7","^8","^7","^J","^K"],"~$transitive-closure",["^ ","^3",406,"^4",1,"^=",["^>",[1]],"^5","^1;","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"~$maybe-traverse-link",["^ ","^3",448,"^4",1,"^=",["^>",[1]],"^5","^1<","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"~$assert-unique!",["^ ","^3",739,"^4",1,"^5","^1=","^6","^7","^8","^7","^J","^T"],"~$read-from-file",["^ ","^3",50,"^4",4,"^=",["^>",[2]],"^5","^1>","^6","^7","^8","^7","^J","^K"],"~$IGraphSet",["^ ","^3",197,"^4",1,"^5","^1?","^6","^7","^8","^7","^9",["^E","^X","~$difference"]],"^[",["^ ","^3",26,"^4",1,"^=",["^>",[1]],"^5","^[","^6","^7","^8","^7"],"~$add-to-graph",["^ ","^3",262,"^4",1,"^5","^1A","^6","^7","^8","^7"],"~$p-dispatcher",["^ ","^3",616,"^4",1,"^=",["^>",[4,3]],"^5","^1B","^6","^7","^8","^7","^O",["^ ","~i3",["^ ","^P",["^>",["~:keyword"]]],"~i4",["^ ","^P",["^>",["^1C"]]]],"^J","^K"],"^A",["^ ","^3",184,"^4",3,"^=",["^>",[2]],"^5","^A","^6","^7","^8","^7"],"^1@",["^ ","^3",205,"^4",3,"^=",["^>",[2]],"^5","^1@","^6","^7","^8","^7"],"~$flatten-description",["^ ","^3",690,"^4",1,"^=",["^>",[1]],"^5","^1D","^6","^7","^8","^7","^J","^K"],"^11",["^ ","^3",119,"^4",3,"^=",["^>",[1,4,3,2]],"^5","^11","^6","^7","^8","^7"],"~$assert-unique",["^ ","^3",735,"^4",1,"^5","^1E","^6","^7","^8","^7","^J","^T"],"~$traverse-link",["^ ","^3",426,"^4",1,"^=",["^>",[1]],"^5","^1F","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"~$triples-format",["^ ","^3",233,"^4",1,"^=",["^>",[1]],"^5","^1G","^6","^7","^8","^7","^J","^K"],"~$match-or-traverse-tag",["^ ","^=",["^>",[1]],"~:private",true,"^6","^7","^5","^1H","^J","^K","^4",1,"^8","^7","^O",["^ ","~i1",["^ ","^P",["^>",["^1C"]]]],"^3",606]],"~:cljs",["^ ","^2",["^ ","^3",156,"^4",1,"^5","^2","^6","^7","^8","^7","^9",["^:","^;"]],"^<",["^ ","^3",75,"^4",3,"^=",["^>",[1]],"^5","^<","^6","^7","^8","^7"],"^?",["^ ","^3",174,"^4",1,"^5","^?","^6","^7","^8","^7","^9",["^@","^A"]],"^B",["^ ","^3",108,"^4",3,"^=",["^>",[2]],"^5","^B","^6","^7","^8","^7"],"^C",["^ ","^3",147,"^4",3,"^=",["^>",[2]],"^5","^C","^6","^7","^8","^7"],"^D",["^ ","^3",48,"^4",1,"^=",["^>",[2]],"^5","^D","^6","^7","^8","^7"],"^E",["^ ","^3",199,"^4",3,"^=",["^>",[2]],"^5","^E","^6","^7","^8","^7"],"^F",["^ ","^3",138,"^4",1,"^5","^F","^6","^7","^8","^7","^9",["^D","^C"]],"^G",["^ ","^3",624,"^4",1,"^5","^G","^6","^7","^8","^7"],"^H",["^ ","^3",90,"^4",3,"^=",["^>",[3]],"^5","^H","^6","^7","^8","^7"],"^I",["^ ","^3",285,"^4",1,"^=",["^>",[1]],"^5","^I","^6","^7","^8","^7","^J","^K"],"^L",["^ ","^3",99,"^4",3,"^=",["^>",[4]],"^5","^L","^6","^7","^8","^7"],"^@",["^ ","^3",175,"^4",5,"^=",["^>",[2]],"^5","^@","^6","^7","^8","^7"],"^M",["^ ","^3",706,"^4",1,"^=",["^>",[1]],"^5","^M","^6","^7","^8","^7","^J","^K"],"^R",["^ ","^3",128,"^4",3,"^=",["^>",[1]],"^5","^R","^6","^7","^8","^7"],"^S",["^ ","^3",744,"^4",1,"^5","^S","^6","^7","^8","^7","^J","^T"],"^U",["^ ","^3",215,"^4",1,"^=",["^>",[1]],"^5","^U","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P",["^>",["^V","^W"]]]],"^J","^K"],"^X",["^ ","^3",202,"^4",3,"^=",["^>",[2]],"^5","^X","^6","^7","^8","^7"],"^Y",["^ ","^3",649,"^4",4,"^=",["^>",[1,2]],"^5","^Y","^6","^7","^8","^7","^J","^K"],"^Z",["^ ","^3",62,"^4",1,"^5","^Z","^6","^7","^8","^7","^9",["^[","^<","^10","^H","^L","^B","^11","^R"]],"^10",["^ ","^3",82,"^4",3,"^=",["^>",[2]],"^5","^10","^6","^7","^8","^7"],"^:",["^ ","^3",157,"^4",5,"^=",["^>",[2]],"^5","^:","^6","^7","^8","^7"],"^12",["^ ","^3",749,"^4",1,"^=",["^>",[3]],"^5","^12","^6","^7","^8","^7","^J","^K"],"^13",["^ ","^3",495,"^4",1,"^=",["^>",[1]],"^5","^13","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"^;",["^ ","^3",165,"^4",3,"^=",["^>",[2]],"^5","^;","^6","^7","^8","^7"],"^14",["^ ","^3",309,"^4",1,"^5","^14","^6","^7","^8","^7"],"^15",["^ ","^3",469,"^4",1,"^16",0,"^5","^15","^6","^7","^8","^7","^O",["^ ","^17",["^ ","^P","^K","^18",0]],"^J","^K"],"^19",["^ ","^3",720,"^4",1,"^=",["^>",[5]],"^5","^19","^6","^7","^8","^7","^J","^K"],"^1:",["^ ","^3",321,"^4",1,"^=",["^>",[4,3,5]],"^5","^1:","^6","^7","^8","^7","^J","^K"],"^1;",["^ ","^3",406,"^4",1,"^=",["^>",[1]],"^5","^1;","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"^1<",["^ ","^3",448,"^4",1,"^=",["^>",[1]],"^5","^1<","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"^1=",["^ ","^3",739,"^4",1,"^5","^1=","^6","^7","^8","^7","^J","^T"],"^1?",["^ ","^3",197,"^4",1,"^5","^1?","^6","^7","^8","^7","^9",["^E","^X","^1@"]],"^[",["^ ","^3",26,"^4",1,"^=",["^>",[1]],"^5","^[","^6","^7","^8","^7"],"^1A",["^ ","^3",262,"^4",1,"^5","^1A","^6","^7","^8","^7"],"^1B",["^ ","^3",616,"^4",1,"^=",["^>",[4,3]],"^5","^1B","^6","^7","^8","^7","^O",["^ ","~i3",["^ ","^P",["^>",["^1C"]]],"~i4",["^ ","^P",["^>",["^1C"]]]],"^J","^K"],"^A",["^ ","^3",184,"^4",3,"^=",["^>",[2]],"^5","^A","^6","^7","^8","^7"],"^1@",["^ ","^3",205,"^4",3,"^=",["^>",[2]],"^5","^1@","^6","^7","^8","^7"],"^1D",["^ ","^3",690,"^4",1,"^=",["^>",[1]],"^5","^1D","^6","^7","^8","^7","^J","^K"],"^11",["^ ","^3",119,"^4",3,"^=",["^>",[1,4,3,2]],"^5","^11","^6","^7","^8","^7"],"^1E",["^ ","^3",735,"^4",1,"^5","^1E","^6","^7","^8","^7","^J","^T"],"^1F",["^ ","^3",426,"^4",1,"^=",["^>",[1]],"^5","^1F","^6","^7","^8","^7","^O",["^ ","~i1",["^ ","^P","^K"]],"^J","^K"],"^1G",["^ ","^3",233,"^4",1,"^=",["^>",[1]],"^5","^1G","^6","^7","^8","^7","^J","^K"],"^1H",["^ ","^=",["^>",[1]],"^1I",true,"^6","^7","^5","^1H","^J","^K","^4",1,"^8","^7","^O",["^ ","~i1",["^ ","^P",["^>",["^1C"]]]],"^3",606]]] \ No newline at end of file diff --git a/.clj-kondo/.cache/v1/cljc/ont-app.igraph.graph.transit.json b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.graph.transit.json new file mode 100644 index 0000000..74f3c1d --- /dev/null +++ b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.graph.transit.json @@ -0,0 +1 @@ +["^ ","~:filename","src/ont_app/igraph/graph.cljc","~:clj",["^ ","~$Graph",["^ ","~:row",58,"~:col",1,"~:name","^2","~:ns","~$ont-app.igraph.graph","~:top-ns","^7","~:class",true],"~$vector-of-triples",["^ ","^3",118,"^4",1,"~:fixed-arities",["~#set",[1]],"^5","^:","^6","^7","^8","^7","~:type","~:fn"],"~$-triplify-binding",["^ ","^;",["^<",[2]],"~:private",true,"^6","^7","^5","^?","^=","^>","^4",1,"^8","^7","~:arities",["^ ","~i2",["^ ","~:ret","~:vector"]],"^3",643],"~$kw-starts-with-?",["^ ","^;",["^<",[1]],"^@",true,"^6","^7","^5","^D","^=","^>","^4",1,"^8","^7","^A",["^ ","~i1",["^ ","^B",["^<",["~:nil","~:boolean"]]]],"^3",328],"~$make-graph",["^ ","^3",103,"^4",1,"~:varargs-min-arity",0,"^5","^G","^6","^7","^8","^7","^=","^>"],"~$-collect-clause-matches",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^I","^=","^>","^4",1,"^8","^7","^3",661],"~$->Graph",["^ ","^3",58,"^4",1,"^;",["^<",[1]],"^5","^J","^6","^7","^8","^7"],"~$-dissoc-in",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^K","^=","^>","^4",1,"^8","^7","^3",181],"~$get-intersection",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^L","^=","^>","^4",1,"^8","^7","^3",55],"~$query-graph",["^ ","^3",54,"^4",1,"^;",["^<",[3,2]],"^5","^M","^6","^7","^8","^7","^=","^>"],"~$cljc-lazy-seq",["^ ","^3",94,"^4",1,"^5","^N","^6","^7","^8","^7"],"~$get-contents",["^ ","^3",56,"^4",1,"^;",["^<",[1]],"^5","^O","^6","^7","^8","^7","^=","^>"],"~$-collect-p-o-matches",["^ ","^;",["^<",[4]],"^@",true,"^6","^7","^5","^P","^=","^>","^4",1,"^8","^7","^3",381],"~$-collect-clause-match",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^Q","^=","^>","^4",1,"^8","^7","^A",["^ ","~i3",["^ ","^B","~:associative"]],"^3",593],"~$-collect-s-p-o-matches",["^ ","^;",["^<",[4]],"^@",true,"^6","^7","^5","^S","^=","^>","^4",1,"^8","^7","^3",453],"~$-query-clause-matches",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^T","^=","^>","^4",1,"^8","^7","^3",503],"~$-collect-o-match",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^U","^=","^>","^4",1,"^8","^7","^A",["^ ","~i3",["^ ","^B","~:coll"]],"^3",337],"~$shared-keys",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^W","^=","^>","^4",1,"^8","^7","^A",["^ ","~i2",["^ ","^B","~:nilable/set"]],"^3",206]],"~:cljs",["^ ","^2",["^ ","^3",58,"^4",1,"^5","^2","^6","^7","^8","^7"],"^:",["^ ","^3",118,"^4",1,"^;",["^<",[1]],"^5","^:","^6","^7","^8","^7","^=","^>"],"^?",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^?","^=","^>","^4",1,"^8","^7","^A",["^ ","~i2",["^ ","^B","^C"]],"^3",643],"^D",["^ ","^;",["^<",[1]],"^@",true,"^6","^7","^5","^D","^=","^>","^4",1,"^8","^7","^A",["^ ","~i1",["^ ","^B",["^<",["^E","^F"]]]],"^3",328],"^G",["^ ","^3",103,"^4",1,"^H",0,"^5","^G","^6","^7","^8","^7","^=","^>"],"^I",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^I","^=","^>","^4",1,"^8","^7","^3",661],"^J",["^ ","^3",58,"^4",1,"^;",["^<",[1]],"^5","^J","^6","^7","^8","^7"],"^K",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^K","^=","^>","^4",1,"^8","^7","^3",181],"^L",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^L","^=","^>","^4",1,"^8","^7","^3",55],"^M",["^ ","^3",54,"^4",1,"^;",["^<",[3,2]],"^5","^M","^6","^7","^8","^7","^=","^>"],"^N",["^ ","^3",94,"^4",1,"^5","^N","^6","^7","^8","^7"],"^O",["^ ","^3",56,"^4",1,"^;",["^<",[1]],"^5","^O","^6","^7","^8","^7","^=","^>"],"^P",["^ ","^;",["^<",[4]],"^@",true,"^6","^7","^5","^P","^=","^>","^4",1,"^8","^7","^3",381],"^Q",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^Q","^=","^>","^4",1,"^8","^7","^A",["^ ","~i3",["^ ","^B","^R"]],"^3",593],"^S",["^ ","^;",["^<",[4]],"^@",true,"^6","^7","^5","^S","^=","^>","^4",1,"^8","^7","^3",453],"^T",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^T","^=","^>","^4",1,"^8","^7","^3",503],"^U",["^ ","^;",["^<",[3]],"^@",true,"^6","^7","^5","^U","^=","^>","^4",1,"^8","^7","^A",["^ ","~i3",["^ ","^B","^V"]],"^3",337],"^W",["^ ","^;",["^<",[2]],"^@",true,"^6","^7","^5","^W","^=","^>","^4",1,"^8","^7","^A",["^ ","~i2",["^ ","^B","^X"]],"^3",206]]] \ No newline at end of file diff --git a/.clj-kondo/.cache/v1/cljc/ont-app.igraph.test-support.transit.json b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.test-support.transit.json new file mode 100644 index 0000000..32b162a --- /dev/null +++ b/.clj-kondo/.cache/v1/cljc/ont-app.igraph.test-support.transit.json @@ -0,0 +1 @@ +["^ ","~:filename","src/ont_app/igraph/test_support.cljc","~:clj",["^ ","~$report-invalid-test-graph",["^ ","~:row",107,"~:col",1,"~:varargs-min-arity",2,"~:name","^2","~:ns","~$ont-app.igraph.test-support","~:top-ns","^8","~:type","~:fn"],"~$cljc-LazySeq",["^ ","^3",23,"^4",1,"^6","^<","^7","^8","^9","^8"],"~$report-atom",["^ ","^3",91,"^4",1,"~:fixed-arities",["~#set",[1]],"^6","^=","^7","^8","^9","^8","~:arities",["^ ","~i1",["^ ","~:ret","~:atom"]],"^:","^;"],"~$test-readme-eg-mutation-fn",["^ ","^3",576,"^4",1,"^>",["^?",[2]],"^6","^C","^7","^8","^9","^8","^:","^;"],"~$test-cardinality-1",["^ ","^3",499,"^4",1,"^>",["^?",[1]],"^6","^D","^7","^8","^9","^8","^:","^;"],"~$tap-value",["^ ","^3",99,"^4",1,"^>",["^?",[2]],"^6","^E","^7","^8","^9","^8","^:","^;"],"~$test-readme-eg-mutation-dispatch",["^ ","^3",682,"^4",1,"^>",["^?",[1]],"^6","^F","^7","^8","^9","^8","^:","^;"],"~$test-readme-eg-set-operations",["^ ","^3",743,"^4",1,"^>",["^?",[1]],"^6","^G","^7","^8","^9","^8","^:","^;"],"~$cljc-format",["^ ","^3",28,"^4",1,"^6","^H","^7","^8","^9","^8"],"~$query-for-failures",["^ ","^3",821,"^4",1,"^>",["^?",[1]],"^6","^I","^7","^8","^9","^8","^:","^;"],"~$do-report!",["^ ","^3",55,"^4",1,"^>",["^?",[2]],"^6","^J","^7","^8","^9","^8","^:","^;"],"~$types-data",["^ ","^3",345,"^4",1,"^6","^K","^7","^8","^9","^8","^:",["^ ","^:","~:map","~:val",["^ ","~:igraph-test/beer",["^ ","^3",352,"~:end-row",352,"^4",22,"~:end-col",72,"~:tag",["^ ","^:","^L","^M",["^ ","~:igraph-test/subClassOf",["^ ","^3",352,"^O",352,"^4",47,"^P",71,"^Q","~:set"]]]],"~:igraph-test/beef",["^ ","^3",348,"^O",348,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",348,"^O",348,"^4",47,"^P",67,"^Q","^S"]]]],"~:igraph-test/consumable",["^ ","^3",355,"^O",355,"^4",28,"^P",75,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",355,"^O",355,"^4",53,"^P",74,"^Q","^S"]]]],"~:igraph-test/pork",["^ ","^3",350,"^O",350,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",350,"^O",350,"^4",47,"^P",67,"^Q","^S"]]]],"~:igraph-test/chicken",["^ ","^3",349,"^O",349,"^4",25,"^P",71,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",349,"^O",349,"^4",50,"^P",70,"^Q","^S"]]]],"~:igraph-test/person",["^ ","^3",356,"^O",356,"^4",24,"^P",71,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",356,"^O",356,"^4",49,"^P",70,"^Q","^S"]]]],"~:igraph-test/beverage",["^ ","^3",354,"^O",354,"^4",26,"^P",78,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",354,"^O",354,"^4",51,"^P",77,"^Q","^S"]]]],"~:igraph-test/food",["^ ","^3",353,"^O",353,"^4",22,"^P",74,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",353,"^O",353,"^4",47,"^P",73,"^Q","^S"]]]],"~:igraph-test/meat",["^ ","^3",351,"^O",351,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",351,"^O",351,"^4",47,"^P",67,"^Q","^S"]]]]]]],"~$sans-schema",["^ ","^3",39,"^4",1,"^>",["^?",[2]],"^6","^10","^7","^8","^9","^8","^:","^;"],"~$the",["^ ","^3",175,"^4",1,"~:private",true,"^6","^11","^7","^8","^9","^8"],"~$subClassOf*",["^ ","^3",35,"^4",1,"^6","^13","^7","^8","^9","^8"],"~$eg-data",["^ ","^3",169,"^4",1,"^6","^14","^7","^8","^9","^8","^:",["^ ","^:","^L","^M",["^ ","~:igraph-test/john",["^ ","^3",171,"^O",171,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","~:igraph-test/isa",["^ ","^3",171,"^O",171,"^4",22,"^P",44,"^Q","^S"],"~:igraph-test/likes",["^ ","^3",171,"^O",171,"^4",65,"^P",85,"^Q","^S"]]]],"~:igraph-test/mary",["^ ","^3",173,"^O",173,"^4",4,"^P",89,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",173,"^O",173,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",173,"^O",173,"^4",65,"^P",88,"^Q","^S"]]]]]]],"~$run-standard-implementation-tests",["^ ","^3",811,"^4",1,"^>",["^?",[1]],"^6","^19","^7","^8","^9","^8","^:","^;"],"~$test-readme-eg-traversal",["^ ","^3",366,"^4",1,"^>",["^?",[1]],"^6","^1:","^7","^8","^9","^8","^:","^;"],"~$test-readme-eg-access",["^ ","^3",177,"^4",1,"^>",["^?",[1]],"^6","^1;","^7","^8","^9","^8","^:","^;"],"~$do-assert-and-report!",["^ ","^3",65,"^4",1,"^>",["^?",[6]],"^6","^1<","^7","^8","^9","^8","^:","^;"],"~$eg-with-types-data",["^ ","^3",359,"^4",1,"^6","^1=","^7","^8","^9","^8"],"~$test-readme-eg-mutation",["^ ","^3",691,"^4",1,"^6","^1>","^7","^8","^9","^8"],"~$cardinality-1-graph-data",["^ ","^3",491,"^4",1,"^6","^1?","^7","^8","^9","^8"],"~$other-eg-data",["^ ","^3",736,"^4",1,"^6","^1@","^7","^8","^9","^8","^:",["^ ","^:","^L","^M",["^ ","^18",["^ ","^3",739,"^O",739,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",739,"^O",739,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",739,"^O",739,"^4",65,"^P",85,"^Q","^S"]]]],"~:igraph-test/waldo",["^ ","^3",741,"^O",741,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",741,"^O",741,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",741,"^O",741,"^4",65,"^P",85,"^Q","^S"]]]]]]]],"~:cljs",["^ ","^2",["^ ","^3",107,"^4",1,"^5",2,"^6","^2","^7","^8","^9","^8","^:","^;"],"^<",["^ ","^3",23,"^4",1,"^6","^<","^7","^8","^9","^8"],"^=",["^ ","^3",91,"^4",1,"^>",["^?",[1]],"^6","^=","^7","^8","^9","^8","^@",["^ ","~i1",["^ ","^A","^B"]],"^:","^;"],"^C",["^ ","^3",576,"^4",1,"^>",["^?",[2]],"^6","^C","^7","^8","^9","^8","^:","^;"],"^D",["^ ","^3",499,"^4",1,"^>",["^?",[1]],"^6","^D","^7","^8","^9","^8","^:","^;"],"^E",["^ ","^3",99,"^4",1,"^>",["^?",[2]],"^6","^E","^7","^8","^9","^8","^:","^;"],"^F",["^ ","^3",682,"^4",1,"^>",["^?",[1]],"^6","^F","^7","^8","^9","^8","^:","^;"],"^G",["^ ","^3",743,"^4",1,"^>",["^?",[1]],"^6","^G","^7","^8","^9","^8","^:","^;"],"^H",["^ ","^3",28,"^4",1,"^6","^H","^7","^8","^9","^8"],"^I",["^ ","^3",821,"^4",1,"^>",["^?",[1]],"^6","^I","^7","^8","^9","^8","^:","^;"],"^J",["^ ","^3",55,"^4",1,"^>",["^?",[2]],"^6","^J","^7","^8","^9","^8","^:","^;"],"^K",["^ ","^3",345,"^4",1,"^6","^K","^7","^8","^9","^8","^:",["^ ","^:","^L","^M",["^ ","^N",["^ ","^3",352,"^O",352,"^4",22,"^P",72,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",352,"^O",352,"^4",47,"^P",71,"^Q","^S"]]]],"^T",["^ ","^3",348,"^O",348,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",348,"^O",348,"^4",47,"^P",67,"^Q","^S"]]]],"^U",["^ ","^3",355,"^O",355,"^4",28,"^P",75,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",355,"^O",355,"^4",53,"^P",74,"^Q","^S"]]]],"^V",["^ ","^3",350,"^O",350,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",350,"^O",350,"^4",47,"^P",67,"^Q","^S"]]]],"^W",["^ ","^3",349,"^O",349,"^4",25,"^P",71,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",349,"^O",349,"^4",50,"^P",70,"^Q","^S"]]]],"^X",["^ ","^3",356,"^O",356,"^4",24,"^P",71,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",356,"^O",356,"^4",49,"^P",70,"^Q","^S"]]]],"^Y",["^ ","^3",354,"^O",354,"^4",26,"^P",78,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",354,"^O",354,"^4",51,"^P",77,"^Q","^S"]]]],"^Z",["^ ","^3",353,"^O",353,"^4",22,"^P",74,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",353,"^O",353,"^4",47,"^P",73,"^Q","^S"]]]],"^[",["^ ","^3",351,"^O",351,"^4",22,"^P",68,"^Q",["^ ","^:","^L","^M",["^ ","^R",["^ ","^3",351,"^O",351,"^4",47,"^P",67,"^Q","^S"]]]]]]],"^10",["^ ","^3",39,"^4",1,"^>",["^?",[2]],"^6","^10","^7","^8","^9","^8","^:","^;"],"^11",["^ ","^3",175,"^4",1,"^12",true,"^6","^11","^7","^8","^9","^8"],"^13",["^ ","^3",35,"^4",1,"^6","^13","^7","^8","^9","^8"],"^14",["^ ","^3",169,"^4",1,"^6","^14","^7","^8","^9","^8","^:",["^ ","^:","^L","^M",["^ ","^15",["^ ","^3",171,"^O",171,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",171,"^O",171,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",171,"^O",171,"^4",65,"^P",85,"^Q","^S"]]]],"^18",["^ ","^3",173,"^O",173,"^4",4,"^P",89,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",173,"^O",173,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",173,"^O",173,"^4",65,"^P",88,"^Q","^S"]]]]]]],"^19",["^ ","^3",811,"^4",1,"^>",["^?",[1]],"^6","^19","^7","^8","^9","^8","^:","^;"],"^1:",["^ ","^3",366,"^4",1,"^>",["^?",[1]],"^6","^1:","^7","^8","^9","^8","^:","^;"],"^1;",["^ ","^3",177,"^4",1,"^>",["^?",[1]],"^6","^1;","^7","^8","^9","^8","^:","^;"],"^1<",["^ ","^3",65,"^4",1,"^>",["^?",[6]],"^6","^1<","^7","^8","^9","^8","^:","^;"],"^1=",["^ ","^3",359,"^4",1,"^6","^1=","^7","^8","^9","^8"],"^1>",["^ ","^3",691,"^4",1,"^6","^1>","^7","^8","^9","^8"],"^1?",["^ ","^3",491,"^4",1,"^6","^1?","^7","^8","^9","^8"],"^1@",["^ ","^3",736,"^4",1,"^6","^1@","^7","^8","^9","^8","^:",["^ ","^:","^L","^M",["^ ","^18",["^ ","^3",739,"^O",739,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",739,"^O",739,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",739,"^O",739,"^4",65,"^P",85,"^Q","^S"]]]],"^1A",["^ ","^3",741,"^O",741,"^4",4,"^P",86,"^Q",["^ ","^:","^L","^M",["^ ","^16",["^ ","^3",741,"^O",741,"^4",22,"^P",44,"^Q","^S"],"^17",["^ ","^3",741,"^O",741,"^4",65,"^P",85,"^Q","^S"]]]]]]]]] \ No newline at end of file diff --git a/.clj-kondo/.cache/v1/cljc/user.transit.json b/.clj-kondo/.cache/v1/cljc/user.transit.json new file mode 100644 index 0000000..2d46109 --- /dev/null +++ b/.clj-kondo/.cache/v1/cljc/user.transit.json @@ -0,0 +1 @@ +["^ ","~:filename","src/ont_app/igraph/core.cljc","~:clj",["^ "],"~:cljs",["^ "]] \ No newline at end of file diff --git a/.clj-kondo/.cache/v1/lock b/.clj-kondo/.cache/v1/lock new file mode 100644 index 0000000..e69de29 diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn new file mode 100644 index 0000000..3f0face --- /dev/null +++ b/.clj-kondo/config.edn @@ -0,0 +1,9 @@ +{:linters {:missing-protocol-method {:level :off} ;; spurious complaints in graph.cljc + :docstring-no-summary {:level :warning} + :missing-docstring {:level :warning} + :shadowed-var {:level :warning} + :unsorted-imports {:level :warning} + :unsorted-required-namespaces {:level :warning} + :unused-alias {:level :warning} + :used-underscored-binding {:level :warning} + :warn-on-reflection {:level :warning}}} diff --git a/.nvd/config.edn b/.nvd/config.edn new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.nvd/config.edn @@ -0,0 +1 @@ +{} diff --git a/CHANGELOG.md b/CHANGELOG.md index e06009d..fefd02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). +## [0.2.3] - +- Refactoring the dev configurations a bit + ## [0.2.2] - 2023-04-13 - Metadata tweaks for efficiency - Clarifying documentation of test support diff --git a/Makefile b/Makefile index e4c0f29..a008efe 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -## Update dependencies as needed.... -outdated: - clojure -M:outdated +ifneq ("$(wildcard ~/.clojure/Makefile)","") +## Put stuff that references `~/.clojure/deps.edn aiases in ~/.clojure/Makefile... +include ~/.clojure/Makefile +endif ## Testing .... .PHONY: test-jvm @@ -14,7 +15,7 @@ test-js: .PHONY: test-node test-node: - shadow-cljs compile node-test + npx shadow-cljs compile node-test .PHONY: clean-all clean-all: @@ -22,21 +23,6 @@ clean-all: test-all: clean-all test-jvm test-js test-node -## Style .... -kondo: - clojure -M:kondo --lint src - -## Security ... -### assumes that nvd-clojure/nvd-clojure tool has been installed -### see also https://github.com/rm-hull/nvd-clojure -nvd: - clojure -J-Dclojure.main.report=stderr -Tnvd nvd.task/check :classpath \"$(shell clojure -Spath)\" - - -## Generate documentation ... -codox: - clojure -X:codox - ## Publishing... uberjar: clojure -T:build ci diff --git a/README.md b/README.md index 9fd9e8b..763fe6e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ It also defines a `Graph` datatype which implements `IGraph`. There is a [15-minute video introduction here](https://www.youtube.com/watch?v=BlH__4iNHZE&feature=youtu.be). +API docs are available at https://cljdoc.org/d/ont-app/igraph/. + + ## Contents - [Dependencies](#h2-dependencies) - [Motivation](#h2-motivation) diff --git a/build.clj b/build.clj index 0f7b0b4..909ee98 100644 --- a/build.clj +++ b/build.clj @@ -9,7 +9,7 @@ (def lib 'ont-app/igraph) -(def version "0.2.2-SNAPSHOT") +(def version "0.2.3-SNAPSHOT") (defn validate-deps "Throws an `ex-info` of type `::invalid-deps`, or returns `opts` unchanged" @@ -60,7 +60,7 @@ (bb/install))) (defn deploy - "Deploy the JAR to Clojars. Using $CLOJARS_USERNAME and $CLOJARS_PASSWORD" + "Deploy the JAR to Clojars. Using CLOJARS_USERNAME and the CLOJARS_PASSWORD" [opts] (-> opts (assoc :lib lib :version version) diff --git a/deps.edn b/deps.edn index e65f600..7049a2e 100644 --- a/deps.edn +++ b/deps.edn @@ -1,12 +1,8 @@ { :paths ["src" "resources"] :deps { - org.clojure/clojure {:mvn/version "1.11.1"} - org.clojure/clojurescript {:mvn/version "1.11.60" - :exclusions [org.msgpack/msgpack] - ;; ... per nvd warning CVE-2022-41719 - } - } + org.clojure/clojure {:mvn/version "1.12.0"} + org.clojure/clojurescript {:mvn/version "1.12.38"}} :aliases { ;;;;;;;;;;;;;;;; ;; JVM SUPPORT @@ -15,24 +11,18 @@ ;; Informs :build alias, below :test { :extra-paths ["test"] - :extra-deps { - org.clojure/test.check {:mvn/version "1.1.1"} + :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" - :git/sha "dfb30dd"} - } - } + :git/sha "dfb30dd"}}} ;; Building utilities ;; invoke with -T:build ;; for help: clojure -A:deps -T:build help/doc :build { :deps { io.github.seancorfield/build-clj {:git/tag "v0.9.2" - :git/sha "9c9f078" - } - org.clojure/tools.deps {:mvn/version "0.18.1335"} - } - :ns-default build - } + :git/sha "9c9f078"} + org.clojure/tools.deps {:mvn/version "0.23.1512"}} + :ns-default build} ;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CLOJURESCRIPT SUPPORT @@ -41,21 +31,21 @@ ;; Test cljs version with `clojure -M:test-cljs` ;; Get help with clojure -M:test-cljs --help ;; See also https://github.com/Olical/cljs-test-runner - :test-cljs { - :extra-deps {olical/cljs-test-runner {:mvn/version "3.8.0"}} + :test-cljs {:extra-deps {olical/cljs-test-runner {:mvn/version "3.8.1"}} :extra-paths ["test"] - :main-opts ["-m" "cljs-test-runner.main"] - } + :main-opts ["-m" "cljs-test-runner.main"]} ;; SHADOW-CLJS SUPPORT ;; Alias referenced in shadow-cljs.edn - :shadow { - :extra-deps {thheller/shadow-cljs {:mvn/version "2.22.10"}} - :extra-paths ["test"] - } + :shadow {:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.23"}} + :extra-paths ["test"]} + ;;;;;;;;;;;;;;; + ;; NVD support + ;; There are a lot of spurious NVD warnings associated with ClojureScript + ;; This will leave ClojureScript out of the NVD path: + ;; clojure -Tnvd nvd.task/check :classpath \""$(clojure -Spath -A:backend-only)\""" + ;;;;;;;;;;;;;;; + :backend-only {:deps {org.clojure/clojure {:mvn/version "1.12.0"}}} } ;; aliases } -;; NVD notes -;; CVE-2023-0247 is flagged for clojurescript-1.11.60.jar, but seems to pertain to a go repo -;; CVE-2022-45688 jackson-core-2.8.7.jar. Excluding this breaks tests. -;; linked to https://github.com/stleary/JSON-java/issues/708 + diff --git a/doc/ont-app.igraph.test-support.html b/doc/ont-app.igraph.test-support.html index d1f94b1..0a7a462 100644 --- a/doc/ont-app.igraph.test-support.html +++ b/doc/ont-app.igraph.test-support.html @@ -48,7 +48,7 @@ Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`data`] -> `cardinality-1-grap`] + - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`data`] -> `cardinality-1-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `schema-graph`] - `cardinality-1-graph` contains `cardinality-1-graph-data` plus maybe the contents of `schema-graph` diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 81749d9..3045aa4 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -1,5 +1,5 @@ ;; shadow-cljs configuration -{:deps {:aliases [shadow]} +{:deps {:aliases [:shadow]} :builds {;; Runs shadow node-test ;; `shadow-cljs compile node-test` diff --git a/src/ont_app/igraph/core.cljc b/src/ont_app/igraph/core.cljc index 6e7e098..b86ffd5 100644 --- a/src/ont_app/igraph/core.cljc +++ b/src/ont_app/igraph/core.cljc @@ -1,13 +1,16 @@ (ns ^{:author "Eric D. Scott", - :doc "Abstractions over a graph object, intended to sit alongside the -other basic clojure data structures such as maps, vectors and sets. -"} + :doc "Abstractions over a graph object, intended to sit alongside the other basic clojure data structures such as maps, vectors and sets." + :vann/preferredNamespacePrefix "igraph" + :vann/preferredNamespaceUri "http://rdf.naturallexicon.org/ont-app/igraph#" + :dc/description "Abstractions over a Clojure graph object, intended to sit alongside the other basic clojure data structures such as maps, vectors and sets." + :dc/creator "Eric D. Scott"} ont-app.igraph.core - (:require [clojure.pprint :as pp] + (:require [clojure.set :as set] [clojure.spec.alpha :as spec] - [clojure.string :as str] #?(:clj [clojure.java.io :as io]) + #?(:clj [clojure.pprint :as pp]) + #?(:clj [clojure.string :as str]) )) ;; FUN WITH READER MACROS @@ -16,9 +19,9 @@ other basic clojure data structures such as maps, vectors and sets. (enable-console-print!) ) -#?(:cljs - (defn on-js-reload [] ) - ) +;; #?(:cljs +;; (defn on-js-reload [] ) +;; ) (declare normal-form) #?(:clj @@ -45,11 +48,11 @@ NOTE: Anything that would choke the reader on slurp should be removed (declare add) #?(:clj (defn read-from-file - "returns `g` with the contents of `path` added -Where - - `g` implements IGraph - - `path` is an edn file containing a normal-form representation of some graph, - typically the output of save-to-file." + "Returns `g` with the contents of `path` added. + - Where + - `g` implements IGraph + - `path` is an edn file containing a normal-form representation of some graph, + typically the output of save-to-file." [g path] (add g (read-string (slurp (io/as-file path)))) )) @@ -57,20 +60,20 @@ Where ;; No reader macros below this point (defprotocol IGraph - "An abstraction for S-P-O graphs" + "An abstraction for S-P-O graphs." ;;;;;;;;;;;;;;;;;;;; ;; ACCESS FUNCTIONS ;;;;;;;;;;;;;;;;;;;; - (normal-form [g] "Returns {`s` {`p` #{`o`...}...}...} + (normal-form [g] "Returns {`s` {`p` #{`o`...}...}...}. Where - `s` is the subject of a triple := [`s` `p` `o`] in `g` - `p` is predicate of same - `o` is the object of same ") (subjects [g] - "Returns (`s`...) for `g` + "Returns (`s`...) for `g`. Where - `s` is a subject in one or more triples in `g` - `g` is a graph. @@ -94,7 +97,7 @@ Where " ) (ask [g s p o] - "Returns truthy value iff [`s` `p` `o`] appears in `g` + "Returns truthy value iff [`s` `p` `o`] appears in `g`. Where - `g` is a graph - `s` is subject of some triples in `g` @@ -103,7 +106,7 @@ Where " ) (query [g q] - "Returns #{`binding` ...} for query spec `q` applied to `g` + "Returns #{`binding` ...} for query spec `q` applied to `g`. Where - `binding` := {`var` `value`, ...} - `q` is a query specification suitable for the native format of `g` @@ -114,9 +117,8 @@ Where ) ;; for IFn (invoke [g] [g s] [g s p] [g s p o] - "Applies `g` as a function to the rest of its arguments, representing - triples [`s` `p` `o`] in `g` respectively. `p` may optionally be - a traversal function (See `traverse` docs) + "Applies `g` as a function to the rest of its arguments, representing triples [`s` `p` `o`] in `g` respectively. +Arg `p` may optionally be a traversal function (See `traverse` docs). - (g) -> {`s` {`p` #{`o`...}...}...} ;; = (normal-form `g`) - (g s) -> {`p` #{`o`...}, ...} ;; = (get-p-o `g`) - (g s p) -> #{`o` ...} ;; = (match-or-traverse g s p) @@ -124,7 +126,7 @@ Where ") ;; mutability (mutability [g] - "Returns one of ::read-only ::immutable ::mutable ::accumulate-only" + "Returns one of ::read-only ::immutable ::mutable ::accumulate-only." ) ) @@ -180,7 +182,7 @@ NOTE: see Datomic documentation for the 'add' operation for details " ) (retract [g to-retract] - "Returns `g` with `comm` reset to head + "Returns `g` with `comm` reset to head. Side-effect: `to-retract` retracted from `comm` Throws an exception if (mutability g) != ::accumulate-only. Where @@ -195,10 +197,10 @@ NOTE: see Datomic documentation for details (defprotocol IGraphSet "Basic set operations between graphs." (union [g1 g2] - "Returns an IGraph whose normal form contains all triples from g1 and g2" + "Returns an IGraph whose normal form contains all triples from g1 and g2." ) (intersection [g1 g2] - "Returns an IGraph whose normal form contains all and only statements shared by both g1 and g2" + "Returns an IGraph whose normal form contains all and only statements shared by both g1 and g2." ) (difference [g1 g2] "Returns an IGraph whose normal form contains all statements in g1 not present in g2." @@ -229,7 +231,7 @@ NOTE: see Datomic documentation for details :normal-form ::normal-form)) (defn triples-format - "Returns the value of (:triples-format (meta `triples-spec`)) or one of #{:vector :vector-of-vectors :normal-form `type`} inferred from the shape of `triples-spec` + "Returns the value of (:triples-format (meta `triples-spec`)) or one of #{:vector :vector-of-vectors :normal-form `type`} inferred from the shape of `triples-spec`. Where - `args` := [`g` `triples-spec`], arguments to a method add or remove from graph - `g` is a graph @@ -247,8 +249,8 @@ NOTE: see Datomic documentation for details (throw (ex-info "Invalid triples format" (spec/explain-data ::triples-format triples-spec))) ;; else we're good - (let [[format _value_] conform] - format))))) + (let [[format' _value_] conform] + format'))))) (spec/fdef triples-format :ret #{:vector-of-vectors @@ -258,7 +260,7 @@ NOTE: see Datomic documentation for details (defmulti add-to-graph - "Returns `g`, with `to-add` added + "Returns `g`, with `to-add` added. Where - `g` is a Graph - `to-add` is interpetable as a set of triples @@ -281,8 +283,7 @@ NOTE: see Datomic documentation for details :vector-of-vectors ::vector-of-underspecified)) (defn triples-removal-format - "Returns a keyword describing the format of `triples-spec` for removing a - set of triples from a graph. + "Returns a keyword describing the format of `triples-spec` for removing a set of triples from a graph. " [triples-spec] (or (::triples-format (meta triples-spec)) @@ -291,13 +292,13 @@ NOTE: see Datomic documentation for details (throw (ex-info "Invalid triples format" (spec/explain-data ::removal-format triples-spec))) ;; else we're good - (let [[format value] conform] - (if (= format :triples-format) + (let [[format' value] conform] + (if (= format' :triples-format) ;; value is the kind of triples format - (let [[triples-format _] value] - triples-format) + (let [[triples-format' _] value] + triples-format') ;;else :underspecifed - format)))))) + format')))))) (spec/fdef triples-removal-format :ret #{:vector-of-vectors @@ -306,7 +307,7 @@ NOTE: see Datomic documentation for details :underspecified-triple}) (defmulti remove-from-graph - "Returns `g`, with `to-remove` removed + "Returns `g`, with `to-remove` removed. Where - `g` is a Graph - `to-remove` is interpetable as a set of triples @@ -318,7 +319,7 @@ NOTE: see Datomic documentation for details ;;; Traversal ;;;;;;;;;;;;;;;; (defn traverse - "Returns `acc` acquired by applying `traversal` to `g` starting with `queue`, informed by `context` + "Returns `acc` acquired by applying `traversal` to `g` starting with `queue`, informed by `context`. Where - `acc` is an arbitrary clojure 'accumulator' object (similar to a reduce function). Default is `[]`. @@ -423,13 +424,12 @@ NOTE: see Datomic documentation for details (reduce conj (rest queue) (g (first queue) p))])) (defn traverse-link - "Returns traversal function (fn [g context, acc queue]...) - -> [context, acc', queue'], following one `p` in `g` - Where - - `acc` is a set - - `queue` := [`node` ...], nodes to visit in traversal - - `p` is a predicate in `g` - - `g` is a graph + "Returns traversal function (fn [g context, acc queue]...) -> [context, acc', queue'], following one `p` in `g`. + - Where + - `acc` is a set + - `queue` := [`node` ...], nodes to visit in traversal + - `p` is a predicate in `g` + - `g` is a graph NOTE: typically used as one component in a traversal path " @@ -446,8 +446,7 @@ NOTE: see Datomic documentation for details (rest queue)]))) (defn maybe-traverse-link - "Returns traversal function (fn [g context, acc queue]...) - -> [context, acc', queue'], + "Returns traversal function (fn [g context, acc queue]...) -> [context, acc', queue']. Where - `acc'` includes `node` and and as many `o`s as are linked from `node` by `p` in `g` @@ -468,8 +467,7 @@ NOTE: see Datomic documentation for details (rest queue)]))) (defn traverse-or - "Returns traversal function (fn [g context, acc queue]...) - -> [context, acc', queue'], for `ps` + "Returns traversal function (fn [g context, acc queue]...) -> [context, acc', queue'], for `ps`. Where - `acc'` includes `node` and and as many `o`s as are linked from `node` by `p1` | `p2` | ... in `g` @@ -495,7 +493,7 @@ NOTE: see Datomic documentation for details (defn t-comp - "Returns a traversal function composed of elements specified in `comp-spec` + "Returns a traversal function composed of elements specified in `comp-spec`. Where - `comp-spec` := {:path [`spec-element`, ...] `spec-element` {:fn `traversal-fn` @@ -606,7 +604,7 @@ An inferred 'uncle' relation. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn- match-or-traverse-tag - "Returns :traverse if `p` is a function, else :match + "Returns :traverse if `p` is a function, else :match. Informs p-dispatcher " [p] @@ -624,7 +622,7 @@ Informs p-dispatcher (match-or-traverse-tag p))) (defmulti match-or-traverse - "Returns values appropriate for (g s p) or (g s p o) invocations + "Returns values appropriate for (g s p) or (g s p o) invocations. Where - `o` is an object in `g` - `s` is a subject in `g` @@ -650,7 +648,7 @@ Informs p-dispatcher } (declare unique) (let [seek-o (fn seek-o [_context_ acc] - (clojure.set/intersection acc #{o})) + (set/intersection acc #{o})) ] (unique (traverse g p {:seek seek-o} #{} [s]))))) @@ -677,7 +675,7 @@ Informs p-dispatcher only one object. " ([coll on-ambiguity] - (if (seq coll) + (when (seq coll) (if (> (count coll) 1) (on-ambiguity coll) (first coll)))) @@ -690,7 +688,7 @@ Informs p-dispatcher ;; Inverse of normalize-flat-description (defn flatten-description - "Returns `p-o` description with singletons broken out into scalars + "Returns `p-o` description with singletons broken out into scalars. Where - `p-o` := {`p` #{`o`}, ...}, normal form at 'description' level of a graph. " @@ -706,7 +704,7 @@ Where ^{:inverse-of flatten-description} (defn normalize-flat-description - "Returns a normalized p-o description of `m` + "Returns a normalized p-o description of `m`. Where - `m` is a plain clojure map" [m] @@ -720,7 +718,7 @@ Where (reduce-kv maybe-setify {} m))) (defn assert-unique-fn - "Returns `g`', replacing any existing [s p *] with [s p o] per `context` + "Returns `g`', replacing any existing [s p *] with [s p o] per `context`. Where - `g` is a graph - `context` := m s.t. (keys m) = #{:add-fn :subtrct-fn} @@ -735,21 +733,21 @@ Where [s p o])))) (def assert-unique - "fn [g s p o] -> g', asserting a unique triple in immutable graph. + "Fn [g s p o] -> g', asserting a unique triple in immutable graph. - Wrapper around `assert-unique-fn`" (partial assert-unique-fn {:add-fn add :subtract-fn subtract})) (def assert-unique! - "fn [g s p o] -> g', asserting a unique triple in mutable graph. + "Fn [g s p o] -> g', asserting a unique triple in mutable graph. - Wrapper around `assert-unique-fn`" (partial assert-unique-fn {:add-fn add! :subtract-fn subtract!})) (def claim-unique - "fn [g s p o] -> g', asserting a unique triple in an accumulate-only graph . + "Fn [g s p o] -> g', asserting a unique triple in an accumulate-only graph. - Wrapper around `assert-unique-fn`" (partial assert-unique-fn {:add-fn claim :subtract-fn retract})) (defn reduce-spo - "Returns `acc'` s.t. (f acc s p o) -> `acc'` for every triple in `g` + "Returns `acc'` s.t. (f acc s p o) -> `acc'` for every triple in `g`. Where - `f` := (fn [acc s p o] -> `acc'` - `acc` is any value, a reduction accumlator diff --git a/src/ont_app/igraph/graph.cljc b/src/ont_app/igraph/graph.cljc index 3fe44c1..606647c 100644 --- a/src/ont_app/igraph/graph.cljc +++ b/src/ont_app/igraph/graph.cljc @@ -32,16 +32,13 @@ The core type declaration: (intersection [g1 g2] (get-intersection g1 g2)) (difference [g1 g2] (remove-from-graph g1 (g2))) ) -``` -"} +```"} ont-app.igraph.graph (:require [clojure.set :as set] - [clojure.spec.alpha :as spec] [ont-app.igraph.core :as igraph :refer - [ - add + [add add-to-graph get-o get-p-o @@ -52,10 +49,7 @@ The core type declaration: subjects traverse triples-format - unique - ] - ] - )) + unique]])) (declare query-graph) ;; defined below (declare get-intersection) @@ -90,7 +84,7 @@ The core type declaration: ) (defn get-contents - "Returns (.contents g) or (.-contents g) appropriate to clj/cljs" + "Returns (.contents g) or (.-contents g) appropriate to clj/cljs." [^Graph g] #?(:clj (.contents g) @@ -107,7 +101,7 @@ The core type declaration: (defn make-graph - "Returns `graph`, intialized per optional `contents` + "Returns `graph`, intialized per optional `contents`. Where - `graph` is an instance of the `Graph` type, which implments `IGraph`, `Ifn` and `ISet` - `contents` is a normal-form representation of initial contents. @@ -122,7 +116,7 @@ The core type declaration: (defn vector-of-triples - "Returns (g) as [[`s` `p` `o`]...]" + "Returns (g) as [[`s` `p` `o`]...]." [g] (with-meta (reduce-spo @@ -185,8 +179,7 @@ The core type declaration: (defn- -dissoc-in - "removes the last key in `path` from its parent in `map-or-set`, removing - any empty containers along the way. + "Removes the last key in `path` from its parent in `map-or-set`, removing any empty containers along the way. Where - `map-or-set` is typically a sub-tree of graph contents - `path` := [`key` ...] @@ -194,26 +187,24 @@ Note: typically used to inform removal of nodes in a graph, where `key` is a subject, predicate or object " [map-or-set path] - (let [key (first path) - ] + (let [key' (first path)] (assert (seq path)) (if (= (count path) 1) (if (set? map-or-set) - (disj map-or-set key) + (disj map-or-set key') ;; else it's a map - (dissoc map-or-set key)) + (dissoc map-or-set key')) ;; else there's more path - (let [dissociated (-dissoc-in (get map-or-set key) - (rest path)) - ] + (let [dissociated (-dissoc-in (get map-or-set key') + (rest path))] (if (empty? dissociated) - (dissoc map-or-set key) - (assoc map-or-set key + (dissoc map-or-set key') + (assoc map-or-set key' dissociated)))))) (defn- shared-keys - "Returns {`shared key`...} for `m1` and `m2` + "Returns {`shared key`...} for `m1` and `m2`. Where - `shared key` is a key in both maps `m1` and `m2` " @@ -223,23 +214,20 @@ Where (defmethod remove-from-graph [Graph :normal-form] [g to-remove] (letfn [(dissoc-in [shared-path acc value] - (let [shared-path (conj shared-path value) - ] + (let [shared-path (conj shared-path value)] (-dissoc-in acc shared-path))) (dissoc-shared-keys [shared-path acc next-key] (let [shared-path (conj shared-path next-key) v1 (get-in (g) shared-path) - v2 (get-in to-remove shared-path) - ] + v2 (get-in to-remove shared-path)] (if (set? v1) (reduce (partial dissoc-in shared-path) acc (set/intersection v1 v2)) (reduce (partial dissoc-shared-keys shared-path) acc - (shared-keys v1 v2))))) - ] + (shared-keys v1 v2)))))] (if (empty? to-remove) g (make-graph @@ -265,8 +253,7 @@ Where ;; else this specifies one or more triples... (reduce (partial remove-triple (first v)) acc - (partition 2 (rest v))))) - ] + (partition 2 (rest v)))))] (if (empty? triples) g ;; else @@ -295,8 +282,7 @@ Where to-remove) ;; else this is a long vector (let [diminish-contents (fn [s acc [p o]] - (-dissoc-in acc [s p o])) - ] + (-dissoc-in acc [s p o]))] (reduce (partial diminish-contents (first to-remove)) (get-contents g) (partition 2 (rest to-remove)))))))) @@ -304,35 +290,33 @@ Where (defmethod remove-from-graph [Graph :underspecified-triple] [g to-remove] - ;; Underspecified-vector is a distinction without a difference at this point + ;; Underspecified-vector is a distinction without a difference at present (let [f (get-method remove-from-graph [Graph :vector])] (f g to-remove))) (defn- get-intersection - "Returns a new graph whose triples are shared between `g1` and `g2` + "Returns a new graph whose triples are shared between `g1` and `g2`. Where - `g1` and `g2` both implement IGraph. " [g1 g2] (let [collect-p (fn [s acc p] - (let [_intersection + (let [intersection' (set/intersection (set (get-in (g1) [s p])) - (set (get-in (g2) [s p]))) - ] - (if (empty? _intersection) + (set (get-in (g2) [s p])))] + (if (empty? intersection') acc (assoc-in acc [s p] - _intersection)))) + intersection')))) collect-s (fn [acc s] (reduce (partial collect-p s) acc - (shared-keys (g1 s) (g2 s)))) - ] + (shared-keys (g1 s) (g2 s))))] (make-graph :contents (reduce collect-s {} (shared-keys (g1) (g2)))))) @@ -342,8 +326,8 @@ Where ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn- kw-starts-with-? - "Returns true iff `spec` is a symbol whose name - starts with ?. Default for query-var? parameter + "Returns true iff `spec` is a symbol whose name starts with ?. + Default for query-var? parameter. " [spec] (and (keyword? spec) @@ -351,8 +335,7 @@ Where ;; ^reduce-fn (defn- -collect-o-match - " - Adds new `match` to `matches` for `next-o` in `context` + "Adds new `match` to `matches` for `next-o` in `context`. Where - `match` := {`var` `o`, ... }, as set of variable bindings - `matches` := [`match`, ...] @@ -388,17 +371,15 @@ Where collect-bindings (fn [b spo] ;; add value of s|p|o if it's a var ;; spo is one of #{:s :p :o} - (if-let [var (unique (context spo :bound-to))] - (assoc b var (unique (context spo :value))) - b)) - - ] + (if-let [var' (unique (context spo :bound-to))] + (assoc b var' (unique (context spo :value))) + b))] (conj matches (reduce collect-bindings {} [:s :p :o])))) ;; ^reduce-fn (defn- -collect-p-o-matches - "Returns `matches`' for `g` in `context` given `next-p` + "Returns `matches`' for `g` in `context` given `next-p`. Where - `matches` := #{`match` ...} - `match` := {`var` `value`, ...} @@ -430,9 +411,7 @@ Where on the upstream query context. " [^Graph g ^Graph context matches next-p] - {:pre [(set? matches) - ] - } + {:pre [(set? matches)]} (let [o-candidates (context :o :candidate) ;; ... bound to the query-context + (when-let [cs (-> query-context :specified (q-var) (keys))] (set cs))) - - add-candidates (fn [c spo q-var] ;; Updates context s.t. spo *may* have a set of ;; candidate bindings. @@ -567,14 +539,12 @@ Where (if (and candidates (seq candidates)) (add c {spo {:candidate candidates}}) c))) - add-var-context (fn [c spo q-var] ;; updates context s.t. variable bindings ;; for s p or o are accounted for (-> c (add [spo :bound-to q-var]) (add-candidates spo q-var))) - add-graph-element-context (fn [c spo element] ;; updates the context for the case ;; where s p or o is a graph element @@ -583,8 +553,7 @@ Where (-> c (add [[spo :value element] [spo :candidate element] - ] - ))) + ]))) update-clause-context (fn [c spo spec] ;; updates the context appropriately ;; for either a variable or a graph element @@ -595,14 +564,11 @@ Where (not (query-var? spec)) (add-graph-element-context spo spec))) - clause-context (-> (make-graph) ;; Updates the context for s p and o (update-clause-context :s s-spec) (update-clause-context :p p-spec) - (update-clause-context :o o-spec)) - - ] + (update-clause-context :o o-spec))] (reduce (partial -collect-s-p-o-matches g clause-context) @@ -625,7 +591,7 @@ Where [s-spec])))) (defn- -collect-clause-match - "Returns [`match`...] for `context` and `match` + "Returns [`match`...] for `context` and `match`. Where - `clause-state` := {:bindings `bindings` :shared-bound `shared-bound`} s.t. `bindings` membership is appropriately modified per `match` @@ -652,9 +618,7 @@ Where [query-state clause-state match] {:pre [(map? query-state) (map? clause-state) - (map? match) - ] - } + (map? match)]} (assoc clause-state :bindings (set/union @@ -677,7 +641,7 @@ Where (defn- -triplify-binding - "Returns [[`var` `value` `binding`]...] for `binding`, given `query-var?` + "Returns [[`var` `value` `binding`]...] for `binding`, given `query-var?`. Where - `binding` := {`var` `value` ...} - `query-var?` := (fn [var] ...) -> true iff `var` is a variable. @@ -686,18 +650,16 @@ Where NOTE: this is typically used to populate the 'specified' graph in a query-state, which informs the matching process downstream. " - [query-var? binding] - {:pre [(map? binding)] - } - (let [triplify-var (fn [binding qvar] - [qvar (qvar binding) binding]) - ] - (vec (map (partial triplify-var binding) - (filter query-var? (keys binding)))))) + [query-var? binding'] + {:pre [(map? binding')]} + (let [triplify-var (fn [binding' qvar] + [qvar (qvar binding') binding'])] + (vec (map (partial triplify-var binding') + (filter query-var? (keys binding')))))) ;; ^reduce-fn (defn- -collect-clause-matches - "Returns `query-state` modified for matches to `clause` in `g` + "Returns `query-state` modified for matches to `clause` in `g`. Where - `query-state` := {:viable? ... :matches ... :specified ...} modified s.t. each match found for clause is joined with compatible @@ -716,8 +678,7 @@ Where [^Graph g query-state next-clause] {:pre [(map? query-state) (vector? next-clause) - (= (count next-clause) 3)] - } + (= (count next-clause) 3)]} (if-not (:viable? query-state) query-state @@ -735,13 +696,11 @@ Where normal-form keys))) #{}) - (set (filter query-var? next-clause))) - } + (set (filter query-var? next-clause)))} clause-state (reduce (partial -collect-clause-match query-state) initial-clause-state - (-query-clause-matches g query-state next-clause)) - ] + (-query-clause-matches g query-state next-clause))] (if-let [bindings (:bindings clause-state)] (assoc query-state :bindings bindings @@ -752,11 +711,10 @@ Where (:bindings clause-state))))) (assoc query-state :viable? false - :bindings nil - ))))) + :bindings nil))))) (defn query-graph - "Returns #{`binding`...} for `graph-pattern` applied to `g` + "Returns #{`binding`...} for `graph-pattern` applied to `g`. Where - `g` is a Graph - `graph-pattern` := [[`var-or-value` `var-or-value` `var-or-value`]...] @@ -768,8 +726,7 @@ Where " ([^Graph g graph-pattern query-var?] {:pre [(vector? graph-pattern) - (vector? (graph-pattern 0))] - } + (vector? (graph-pattern 0))]} (or (:bindings (reduce (partial -collect-clause-matches g) {:viable? true @@ -779,7 +736,6 @@ Where #{})) ([^Graph g graph-pattern] (query-graph g graph-pattern kw-starts-with-?))) - (comment ) diff --git a/src/ont_app/igraph/test_support.cljc b/src/ont_app/igraph/test_support.cljc index c27c112..ccbc4a7 100644 --- a/src/ont_app/igraph/test_support.cljc +++ b/src/ont_app/igraph/test_support.cljc @@ -1,18 +1,18 @@ (ns ont-app.igraph.test-support "These are tests that should be applicable to implemenations of the IGraph protocols. Most examples are drawn from the README. After running tests, query-for-failures should be empty." - { + {:clj-kondo/config '{:linters {:unresolved-symbol {:level :off} + :redundant-let {:level :off} + }} ;; this metadata can be used by downstream libraries that rely on RDF URIs... :vann/preferredNamespacePrefix "igraph-test" ;; matches :: declarations directly :vann/preferredNamespaceUri - "http://rdf.naturallexicon.org/ont-app/igraph/igraph-test#" - } + "http://rdf.naturallexicon.org/ont-app/igraph/igraph-test#"} (:require [clojure.set] [clojure.spec.alpha :as spec] [ont-app.igraph.core :as igraph] - [ont-app.igraph.graph :as native-normal] - )) + [ont-app.igraph.graph :as native-normal])) ;; SPEX (spec/def ::report @@ -21,23 +21,23 @@ ;; FUN WITH READER MACROS (def cljc-LazySeq - "LazySeq type in clj(s)" + "LazySeq type in clj(s)." #?(:clj clojure.lang.LazySeq :cljs cljs.core/LazySeq)) (def cljc-format - "The format function in clj(s)" + "The format function in clj(s)." #?(:clj clojure.core/format :cljs goog.string.format)) ;; NO READER MACROS BELOW THIS POINT except in try/catch macros (def subClassOf* - "A traversal function. Transitive closure of subClassOf" + "A traversal function. Transitive closure of subClassOf." (igraph/transitive-closure :igraph-test/subClassOf)) (defn sans-schema - "Returns a native-normal graph with the contents of `g` minus `schema-graph` + "Returns a native-normal graph with the contents of `g` minus `schema-graph`. Where - `g` is the test graph implementing IGraph and containing test content - `schema` is a properly configured graph devoid of test content, or nil @@ -53,7 +53,7 @@ :contents (igraph/normal-form schema-graph))))) (defn do-report! - "Side-effect: Modifies `report` in include `desc`. Returns @report + "Side-effect: Modifies `report` in include `desc`; Returns @report. Where - `report` is an atom containing the report graph - `desc` is a normal-form description to be added to `report`" @@ -63,7 +63,7 @@ Where @report) (defn do-assert-and-report! - "Modifies `report` with test results of `test-name` with `comment` from comparing `observed` to `expected`. Returns @report + "Modifies `report` with test results of `test-name` with `comment` from comparing `observed` to `expected`; Returns @report. Where - `report` is an atom containing the report graph - `test-name` is a KWI naming a test @@ -72,33 +72,36 @@ Where - `expected` is the expected value of running the test. NOTE: if observed=expected, `test-name` will be of type ::Passed, else ::Failed. " - [report test-fn-name test-name comment observed expected] + [report test-fn-name test-name comment' observed expected] (if (= observed expected) (do-report! report [test-name :rdf/type ::Passed ::inTest test-fn-name - :rdfs/comment (str comment " as expected")]) + :rdfs/comment (str comment' " as expected")]) ;; else (do-report! report [test-name :rdf/type ::Failed ::inTest test-fn-name - :rdfs/comment (str comment " not as expected") + :rdfs/comment (str comment' " not as expected") ::observed observed ::expected expected]))) (defn report-atom + "Returns an atom containg `g`, with a :validator to check for validity of `g` as a ::report. + - Where + - `g` is a native-normal graph containing the report. + " [g] (atom g :validator (fn [g] (spec/valid? ::report g)))) (defn tap-value - "Returns `tap-val` + "Returns `tap-val`. Side-effect: tap>'s `tap-val` in map {:type `tap-type` :value `tap-val`" [tap-type tap-val] (tap> {:type tap-type - :value tap-val - }) + :value tap-val}) tap-val) (defn report-invalid-test-graph @@ -129,9 +132,7 @@ Where ::inTest test-fn-var :rdfs/comment (cljc-format "Test graph for %s was nil in %s" content-var - test-fn-var - ) - ])) + test-fn-var)])) ;; else the test graph exists (if #?(:clj (and protocol (not (satisfies? protocol test-graph))) :cljs false) ;; cljs doesn't do this well @@ -149,7 +150,7 @@ Where ])) ;; else the graph satisfies. How's the content? - (if (not (= (igraph/normal-form (sans-schema test-graph schema-graph)) + (when (not (= (igraph/normal-form (sans-schema test-graph schema-graph)) (deref content-var))) (tap-value ::FailedContentTest @@ -162,12 +163,10 @@ Where test-fn-var) ::observed (igraph/normal-form (sans-schema test-graph schema-graph)) ::expected (deref content-var) - ]))))) - - ))) + ])))))))) -(def eg-data "Initial data for the `eg` graph in the README" +(def eg-data "Initial data for the `eg` graph in the README." {:igraph-test/john {:igraph-test/isa #{:igraph-test/person}, :igraph-test/likes #{:igraph-test/beef}}, :igraph-test/mary @@ -176,7 +175,7 @@ Where (def ^:private the igraph/unique) (defn test-readme-eg-access - "Returns `report'` for `report`, given `eg-graph`, possibly informed by `readme-schema-graph` + "Returns `report'` for `report`, given `eg-graph`, possibly informed by `readme-schema-graph`. Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: @@ -197,19 +196,17 @@ Where (let [make-graph (the (report ::StandardIGraphImplementationReport ::makeGraphFn)) eg-graph (make-graph eg-data) schema-graph (the (report ::StandardIGraphImplementationReport ::schemaGraph)) - test-fn-var #'test-readme-eg-access - ] + test-fn-var #'test-readme-eg-access] (or (report-invalid-test-graph report eg-graph :test-fn-var test-fn-var :protocol igraph/IGraph :content-var #'eg-data - :schema-graph schema-graph - ) + :schema-graph schema-graph) + ;; ... either the report is invalid or it reports on a specific test failure... (let [report' (report-atom report) - assert-and-report! (partial do-assert-and-report! report' test-fn-var) - ] + assert-and-report! (partial do-assert-and-report! report' test-fn-var)] (assert-and-report! ::SansSchemaTest "eg-graph content after removing any schema" @@ -311,14 +308,14 @@ Where ::igraph/immutable (assert-and-report! ::IGraphImmutableTest - "Whether eg-graph satisfies IGraphMutable" + "Whether eg-graph satisfies IGraphImmutable" (satisfies? igraph/IGraphImmutable eg-graph) true) ::igraph/mutable (assert-and-report! ::IGraphMutableTest - "Whether eg-graph satisfies IGraphAccumuOnly" + "Whether eg-graph satisfies IGraphMutable" (satisfies? igraph/IGraphMutable eg-graph) true) @@ -329,14 +326,11 @@ Where (satisfies? igraph/IGraphAccumulateOnly eg-graph) true) - ::igraph/read-only nil - - ) ;; mutability cases + ::igraph/read-only nil) ;; end mutability cases ;; UTILITIES (letfn [(tally-triples [tally _s _p _o] - (inc tally)) - ] + (inc tally))] (assert-and-report! ::TallyTriplesTest "Tally-triples applied as a reduce-spo should count triples properly" @@ -345,8 +339,7 @@ Where (igraph/reduce-spo tally-triples 0 schema-graph) 0)) 4)) - @report' - ) ;; let level 2 + @report') ;; end second condition of 'or', reports on specific test failures )))) (def types-data @@ -364,15 +357,15 @@ Where }) (def eg-with-types-data - "Data to populate a test graph with the `eg-with-types` example graph in README" + "Data to populate a test graph with the `eg-with-types` example graph in README." (-> (native-normal/make-graph) (igraph/add eg-data) (igraph/add types-data) (igraph/normal-form))) (defn test-readme-eg-traversal - "Returns `report'` given `eg-with-types-graph` - where + "Returns `report'` given `eg-with-types-graph`. + Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`eg-with-types-data`] -> `eg-with-typoes-graph`] @@ -387,8 +380,7 @@ Where schema-graph (the (report ::StandardIGraphImplementationReport ::schemaGraph)) test-fn-var #'test-readme-eg-traversal report' (report-atom report) - assert-and-report! (partial do-assert-and-report! report' test-fn-var) - ] + assert-and-report! (partial do-assert-and-report! report' test-fn-var)] (or (report-invalid-test-graph report eg-with-types-graph @@ -403,8 +395,7 @@ Where ::EgWithTypesGraphContentsTest "Whether contents of eg-with-types-graph argument to test-readme-eg-traversal are as expected" (igraph/normal-form (sans-schema eg-with-types-graph schema-graph)) - eg-with-types-data - ) + eg-with-types-data) (assert-and-report! ::subClassOf*MeatTest @@ -437,7 +428,6 @@ Where #{:igraph-test/person :igraph-test/john :igraph-test/mary}) (let [subsumed-by (igraph/traverse-or :igraph-test/isa :igraph-test/subClassOf)] - (assert-and-report! ::SubsumedByTestIsa "subsumed-by should merge isa and subClassOf. john isa person." @@ -449,22 +439,20 @@ Where "Subsumed-by with meat should return its superclass food" (igraph/traverse eg-with-types-graph subsumed-by #{} [:igraph-test/meat]) #{:igraph-test/food} - ) - ) ;; let subsumed-by + )) ;; end let subsumed-by (let [instance-of (igraph/t-comp [:igraph-test/isa - (igraph/transitive-closure :igraph-test/subClassOf)]) - ] + (igraph/transitive-closure :igraph-test/subClassOf)])] (assert-and-report! ::InstanceOfTest "instance-of = isa/subclassOf*" (igraph/traverse eg-with-types-graph instance-of #{} [:igraph-test/john]) - #{:igraph-test/person :igraph-test/thing})) ;; let instance-of + #{:igraph-test/person :igraph-test/thing})) ;; end let instance-of (assert-and-report! ::SubClassOf*AsPropertyWithOpenObjectTest - "Using subClassOf* as a property arg with open object should deliver all superclasses of beef" + "Using subClassOf* as a property arg with open object should deliver all superclasses of beef." (eg-with-types-graph :igraph-test/beef subClassOf*) #{:igraph-test/consumable :igraph-test/beef :igraph-test/meat @@ -497,11 +485,11 @@ Where (igraph/traverse-link :igraph-test/isa) [:igraph-test/john :igraph-test/mary])) (type [])) - )) ;;cond + )) ;; end cond ))) (def cardinality-1-graph-data - "Data to be loaded into the test graph for cardinality-1 examples in README" + "Data to be loaded into the test graph for cardinality-1 examples in README." (-> (native-normal/make-graph :contents eg-data) (igraph/add {:igraph-test/john {:igraph-test/likes #{:igraph-test/beer} @@ -509,7 +497,7 @@ Where (igraph/normal-form))) (defn test-cardinality-1 - "Returns `report'` using a graph containing data from the README + "Returns `report'` using a graph containing data from the README. Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: @@ -586,7 +574,7 @@ Where ))) (defn test-readme-eg-mutation-fn - "Returns `report'`, given `eg-graph` and maybe `schema-graph` if needed, informed by `context` + "Returns `report'`, given `eg-graph` and maybe `schema-graph` if needed, informed by `context`. Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: @@ -692,17 +680,16 @@ Where (defn test-readme-eg-mutation-dispatch - "Returns the mutability of a graph made according to the report's ::makeGraphFn" + "Returns the mutability of a graph made according to the report's ::makeGraphFn." [report] (let [make-graph (the (report ::StandardIGraphImplementationReport ::makeGraphFn)) ] (-> eg-data (make-graph) - (igraph/mutability)) - )) + (igraph/mutability)))) (defmulti test-readme-eg-mutation - "Returns `report`', modified per tests on mutability, dispatched on the mutability attribute of the graph under examination." + "Returns `report`', modified per tests on mutability, dispatched on `test-readme-eg-mutation-dispatch`." test-readme-eg-mutation-dispatch) (defmethod test-readme-eg-mutation ::igraph/immutable @@ -714,8 +701,7 @@ Where :assert-unique-fn igraph/assert-unique :test-fn-var #'test-readme-eg-mutation } - report - ))) + report))) (defmethod test-readme-eg-mutation ::igraph/mutable ;; "Returns report for mutations under a mutable igraph" @@ -725,10 +711,8 @@ Where :add-fn igraph/add! :subtract-fn igraph/subtract! :assert-unique-fn igraph/assert-unique! - :test-fn-var #'test-readme-eg-mutation - } - report - ))) + :test-fn-var #'test-readme-eg-mutation} + report))) (defmethod test-readme-eg-mutation ::igraph/accumulate-only ;; "Returns report for mutations under an accumulate-only igraph" @@ -738,10 +722,8 @@ Where :add-fn igraph/claim :subtract-fn igraph/retract :assert-unique-fn igraph/claim-unique - :test-fn-var #'test-readme-eg-mutation - } - report - ))) + :test-fn-var #'test-readme-eg-mutation} + report))) (defmethod test-readme-eg-mutation ::igraph/read-only ;; "Returns report for mutations under an accumulate-only igraph" @@ -751,14 +733,15 @@ Where -(def other-eg-data "Contents of the `other-eg` graph in the README" +(def other-eg-data + "Contents of the `other-eg` graph in the README." {:igraph-test/mary {:igraph-test/isa #{:igraph-test/person}, :igraph-test/likes #{:igraph-test/pork}}, :igraph-test/waldo {:igraph-test/isa #{:igraph-test/person}, :igraph-test/likes #{:igraph-test/beer}}}) (defn test-readme-eg-set-operations - "Returns `report'`, given `eg-graph` based on README examples + "Returns `report'`, given `eg-graph` based on README examples. Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: @@ -775,8 +758,7 @@ Where schema-graph (the (report ::StandardIGraphImplementationReport ::schemaGraph)) test-fn-var #'test-readme-eg-set-operations report' (report-atom report) - assert-and-report! (partial do-assert-and-report! report' test-fn-var) - ] + assert-and-report! (partial do-assert-and-report! report' test-fn-var)] (or (report-invalid-test-graph report eg-graph :test-fn-var test-fn-var @@ -824,8 +806,7 @@ Where (igraph/normal-form (igraph/difference other-graph eg-graph)) {:igraph-test/mary {:igraph-test/likes #{:igraph-test/pork}}, :igraph-test/waldo {:igraph-test/isa #{:igraph-test/person}, - :igraph-test/likes #{:igraph-test/beer}}}) - ))))) + :igraph-test/likes #{:igraph-test/beer}}})))))) (defn run-standard-implementation-tests "One-liner to test a fully-featured implemenation of all the IGraph protocols." @@ -835,12 +816,10 @@ Where (test-readme-eg-mutation) (test-readme-eg-set-operations) (test-readme-eg-traversal) - (test-cardinality-1) - ) - ) + (test-cardinality-1))) (defn query-for-failures - "Returns #{`failure-binding`,...} for `report` + "Returns #{`failure-binding`,...} for `report`. Where - `failure-binding` := `m` s.t. (keys m) :~ #{:?test :?comment :?observed :?expected} - `report` is a graph put out by one or more tests in `test-support` @@ -879,12 +858,10 @@ Where (maybe-assoc ::inTest) (maybe-assoc ::expected) (maybe-assoc ::observed) - ))) - ] + )))] (reduce annotate #{} (native-normal/query-graph report [[:?test :rdf/type ::Failed] - [:?test :rdfs/comment :?comment] - ])))) + [:?test :rdfs/comment :?comment]]))))