GithubHelp home page GithubHelp logo

zoren / datalog-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from replikativ/datalog-parser

1.0 0.0 0.0 44 KB

Generic datalog parser compliant to datomic, datascript and datahike queries.

License: Eclipse Public License 2.0

Clojure 100.00%

datalog-parser's Introduction

datalog-parser

A Datalog parser. This parser is used by Datahike and follows the Datalog dialect of Datomic.

Usage

Add the current release of io.lambdaforge/datalog-parser to your project.clj. Start a repl and run:

(require '[datalog.parser :as parser])

(parser/parse '[:find ?x :in $ ?y :where [?x :z ?y]])

;;=> (namespaces omitted for brevity)
;; #Query{:qfind  #FindRel{:elements [#Variable{:symbol ?x}]}
;;        :qwith  nil
;;        :qin    [#BindScalar{:variable #SrcVar{:symbol $}}
;;                 #BindScalar{:variable #Variable{:symbol ?y}}]
;;        :qwhere [#Pattern{:source #DefaultSrc{}
;;                          :pattern [#Variable{:symbol ?x}
;;                                    #Constant{:value  :z}
;;                                    #Variable{:symbol ?y}]}]}

For more examples look at the tests.

Benchmarking and Profiling

To benchmark or profile the parser, change to the parser-perf namespace or require it:

(in-ns 'datalog.parser-perf')

Then run the parse benchmark or profiler:

(parse)
(profile)

To see the produced flame graph, you can start a web server at port:

(in-ns 'datalog.parser-perf')
(prof/server-files port)

TODO

0.2.0

Unparsing support, missing types:

  • PullSpec
  • PullAttrName
  • PullReverseAttrName
  • PullLimitExpr
  • PullDefaultExpr
  • PullWildcard
  • PullRecursionLimit
  • PullMapSpecEntry
  • PullAttrWithOpts

License

Copyright © 2020 lambdaforge UG (haftungsbeschränkt), Nikita Prokopov

This program and the accompanying materials are made available under the terms of the Eclipse Public License 1.0.

datalog-parser's People

Contributors

bsless avatar kordano avatar timokramer avatar whilo avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.