in

The ORM Foundation

Get the facts!

Queries in Norma?

Last post 05-28-2011 22:35 by mnnoon. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-26-2011 3:59

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Geeked [8-|] Queries in Norma?

    Hi,

    Is it possible to create only queries in Norma?   If not I think it would be a good future candidate for adding to the tool.  The reason I'm asking is because I think that Norma is a perfect tool for describing queries and it puts a report, form, or business rules into manageable chunks that can be referred to later.

    thx,

    Marc

  • 05-26-2011 12:40 In reply to

    Re: Queries in Norma?

    Hi Marc,
    Please will you tell us a bit more about your requirements for "Queries".
    You may also find it helpful to refer to Chapter 16.3 of the BBB which has nine pages on queries.

    Ken 

  • 05-26-2011 21:10 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    Hi Ken,

     Not sure what the abbreviation is unfortunately.  Is that listed on this website somewhere?

     Thanks,
    Marc

  • 05-26-2011 21:21 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    I see. Its the Big Brown Book.  I really do think it would be a great idea to add query generation in Norma. ;)  Who do I talk to, or do I just start making my own xslt. 

    Thanks.

    Filed under:
  • 05-26-2011 23:58 In reply to

    Re: Queries in Norma?

    NORMA Pro has derived fact types, which are the ORM equivalent of SQL's views (both are essentially just objectified queries). I'm not sure how complete the mapping is to SQL queries/views though. The mapping to Datalog is the first and most complete generation target. Also, the user interface for creating derived fact types... leaves a lot to be desired, in my opinion.

    NORMA Pro is not publicly available yet, however.

  • 05-27-2011 3:01 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    Hi Clifford,

    That is outstanding.  I would definitely like to get my hands on the professional version and try it out.  The queries and proper verbalization and documentation of those queries is what I find most useful in a production environment.  I wish the Norma tool had better support for derived fact types to be code generated for use with SQL queries.  But I suppose its not a simple problem given all the different patterns.  It would seem likely some form of ai or user verifying and steering of the code generation process would need to be employed to make any query generation effective.

    I'm hoping it will be released within the year. 

  • 05-27-2011 3:05 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    What is DataLog, is it specific to Norma Expert tool? Thx

  • 05-27-2011 3:43 In reply to

    Re: Queries in Norma?

    Datalog is a derivative of Prolog, and LogicBlox (who employ Terry and Matt, NORMA's authors) has their own version of it.

    NORMA Pro is not yet available, I'm sorry. I have a development version only because I'm corresponding with Matt as I build my own ORM-derived modeling language, the Constellation Query Language (CQL). NORMA doesn't yet generate SQL for queries or derived fact types anyhow (confirmed with Matt this afternoon).

    CQL is a plain-text language that shares an ORM2 metamodel, and my tools can export CQL from a NORMA model (as long a you remember to provide readings for all fact types, and a few other little rules like that). The tools also generate database designs, and also understand both derived fact types and queries (and a few other things that NORMA doesn't, like units conversions). Unfortunately CQL doesn't yet generate SQL for queries, although that's not too far away. The implementation is open source, so if you want to help, you can fork the code on GitHub and send me pull requests for any additions that you make. But before you look at the code, read about the project here.

  • 05-27-2011 17:17 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    Ok that sounds great I definitely will.  I'm working on a project that automates the processing of claims and I have a real need to generate sql queries from a model to bring team members on board.  Its more of a training philosophy versus going back to the barbarian days of relaxing the database b/c no one can get the query to work. ;)  When people can clearly see how a query is related to the model or even a part of it and what constraints are involved then it help greatly to reduce harm caused by the rush rush rush of a production environment. 

  • 05-28-2011 22:35 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on 04-16-2008
    • Lawndale, CA
    • Posts 56

    Re: Queries in Norma?

    What I would really like to see is a new tool in the toolbox for Norma.  It would be like a ? or a Query icon.  Basically what it would do is generate a query from the rmap of all the valuetypes, and if you select them.   If you select an entity it will basically place those priamry keys into the query.  I think that would be at least a first step approach.   This might be done easiest if a check box poped up when you used the query on entities that appear closest to the mouse cursor?  Or something like that.

    The second step would be to select an entity or value type that was selected with the query and determine if it should be left outer join or right outer join union etc..   I don't know if CQL can do that by default?

    The third step would then be the add to the where clause for inner queries, and then add where clause to outer queries.

    Then maybe focus on aggregates, calcuations and derivation and cases as a last step.

    After all thats done, then for any query you selected... it would then allow you to generate a "Process Map"  i.e.  a map that says you need to first fill out this table.  You need to make sure these fields are filled out b/c it has a not null constraint, or uniqueness constraint, or specifc value constraint.  After filling out this table, then you need to insert into these three tables. 

     Or maybe a delete process table from a query it would generate the process for deleting sections in a particular query and if anything else outside the query would be affected.

    This is really getting complicated.  I read section 16.3 and it just gave me a bad head ache but I did like the part about nai’ve users.  We can avoid that part by hopefully relying on the Norma model.

Page 1 of 1 (10 items)
© 2008-2014 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service