English 中文(简体)
How do I build a domain-specific query language?
原标题:
  • 时间:2009-11-17 23:58:41
  •  标签:
  • database
  • dsl

I have a biology database that I would like to query. There is also a given terminology bank I have access to that has formalizable predicates. I would like to build a query language for this DB using the predicates mentioned. How would you go about it? My solution is the following:

  1. formalize the predicates
  2. translate into a query language (sql, sparql, depends)
  3. Build a specific language with ANTLR or other such tools
  4. Translate from 3 to 2.

Is this a valid approach? Are there better ones? Any pointers would be much appreciated.

最佳回答

Use BNF to get a head-start into the language semantics..GoldParser will help you by playing around with the semantics and syntax (link here: http://www.devincook.com/). Once you have the BNF semantics sorted out, you can then build up actions based on the inputs, for example, a bnf grammar section dealing with extracting a composition of a limb s genetic makeup classification (I do not know if that is in existence, abstract example here but you get the gist) for a particular query... fetch stats on limb where limb is leg , then behind the scenes you would issue a SQL select on a column alias or name from a predefined table ... I could be wrong on the approach... Hope it helps?

问题回答

Take a look at Booleano.

I suggest you take a look at the i2b2 framework, it s a graphical query language and query engine platform for patient databases.

It s probably hard to grasp all first but do take a look at the CRC cell or webservice in there, you ll see how they approached SQL generation from a clinical graphical query language in an interesting way (albeit, not so performance friendly :))

Consider using Irony.NET from here: Irony.NET





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签