This module provides the following features on top of the fabric-core compute graph setup:
- Triple or Quad fact graphs
- Specialized, more lightweight fact vertices
- Fact indexing
- Optional, customizable fact transformations (and untransform) for optimizing graph internal storage
- Fact graph logging / fact persistence (via core.async)
- Conversion of nested Clojure maps to facts (triples)
- Query tree construction (vertex based)
- Query variable bindings (SPARQL / Datalog style pattern queries)
- Sub-queries (each with own filters, limits, projections)
- Joins
- Optional joins
- Unions
- Negation (result subtraction)
- Bounded length path queries (min/max limits, forward & reverse)
- Arbitrary filters at any query level
- Pre-bound query variables (pre-filtered queries)
- Result variable injection
- Nested result sorting
- Arbitrary result grouping
- Grouped & un-grouped result aggregation fns & expressions
- Result limiting
- Map based query expression DSL (EDN serializable)
- Query visualization (via Graphviz)
- Extensive query & sub-query reuse/caching
- Intelligent recursive query tree removal
- Queries are only computed once, results are cached and only updated automatically when underlying fact set is changing
- Rule based inferencing based on any query (execute arbitrary action for each new result, e.g. to add/remove facts)
- RDF N-Triple parser
ALPHA quality, in active development.
The main README contains an example for this module and more detailed information can be found in the core and test namespaces:
- thi.ng.fabric.facts.core - Fact graph, indexing & query tree functionality
- thi.ng.fabric.facts.dsl - High-level, declarative query DSL
- thi.ng.fabric.facts.queryviz - Visualization of DSL query specs
- thi.ng.fabric.facts.io.ntriples - RDF N-Triples parser
In addition to the examples in the literate source code, currently there’re 150+ tests & examples showing common usage patterns of this module:
Please see the parent project for further information.
thi.ng/fabric-facts
[thi.ng/dstruct "0.1.1"]
(defproject <<project-name>> "<<conf-version()>>"
:description "Signal/Collect inspired compute graph infrastructure - fact graph module"
:url "<<conf-project-url>>"
:license {:name "Apache Software License 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"
:distribution :repo}
:scm {:name "git"
:url "<<conf-project-url>>"}
:min-lein-vesion "2.4.0"
:dependencies [<<dep-clj>>
<<dep-cljs>>
[thi.ng/fabric-core "<<conf-version()>>"]
<<dep-strf>>
<<dep-dstruct>>
<<dep-int-map>>]
:profiles {:dev {:dependencies [<<dep-criterium>>]
:plugins [<<dep-cljsbuild>>
<<dep-cljs-test>>]
:global-vars {*warn-on-reflection* true}
:jvm-opts ^:replace []
:aliases {"cleantest" ["do" "clean," "test," "cljsbuild" "test"]}}}
:cljsbuild {:builds [{:source-paths ["src" "test"]
:id "dev"
:compiler {:output-to "<<cljs-artefact-path>>"
:optimizations :whitespace
:pretty-print true}}
{:source-paths ["src"]
:id "prod"
:compiler {:output-to "<<cljs-artefact-path>>"
:optimizations :advanced
:pretty-print false}}]
:test-commands {"unit-tests" ["phantomjs" :runner "<<cljs-artefact-path>>"]}}
:pom-addition [:developers [:developer
[:name "Karsten Schmidt"]
[:url "http://thi.ng/fabric"]
[:timezone "0"]]])
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><<project-name>> <<conf-version()>> test</title>
</head>
<body>
<script type="text/javascript" src="<<cljs-artefact-path>>"></script>
</body>
</html>
The autogenerated namespace thi.ng.fabric.facts.version
contains a single
symbol version
holding the version string defined above:
(use '[thi.ng.fabric.facts.version])
(prn version)
; "<<conf-version()>>"
Copyright © 2015 Karsten Schmidt
This project is open source and licensed under the Apache Software License 2.0.