Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cosmos-dev] Re: Query Builder - Example MDR that shows Nodes and Edges

Hi Martin,

   I'm cc cosmos-dev.

   I fixed the caching problem in bug 220220 that was checked in yesterday.
I think there is still another problem.  It seems you can't create
relationship elements in the query builder.  I think the servicemetadata is
not returning the relationship capability.  I have to investigate this.

   It seems that you can't add  mdrId or localid on the instanceid this is
a new bug can you open a bug for this.

   I made the XML preview pane read-only.  This was intentionally to
simplify the work.  When you introduce the ability to allow the user to
modify the XML you have to synchronize the changes with the query builder
model.  If the user types the wrong syntax or adds a capability that the
mdr doesn't support it brings up other issues.   For example, if the user
adds a itemtemplate in a relationship that doesn't exist ...what should
happen?  This is not a simple problem.

   Maybe there should be an option to allow the user to submit a raw query
to the MDR.

   If you're stuck you can add the following json object to the menutype
array in the COSMOSUI\views\nav\datamap.jprop file.  This will provide a
textarea to submit a xml query.


{clazz:"org.eclipse.cosmos.provisional.dr.ps.components.widget.QueryMenu",
query:{clazz:"org.eclipse.cosmos.provisional.dr.ps.components.query.QueryDialog",

queryHandler:"json?service=org/eclipse/cosmos/internal/dr/drs/service/outputter/CMDBfQuery",labelDialogQuery:"Enter
 the query, or paste the query below.", title:"Submit Raw Query"}, label:
"Submit Raw Query"}

   Here's the modified file.

   (See attached file: datamap.jprop)

   Yes the intention is to export and deploy the query to a repository
eventually that will allow the user to modify, delete and create queries.
.

Thanks,

Sheldon
______________________________________
Sheldon Lee-Loy



                                                                       
             "Simmonds,                                                
             Martin"                                                   
             <Martin.Simmonds@                                          To
             ca.com>                   Sheldon Lee-Loy/Toronto/IBM@IBMCA
                                                                        cc
             02/26/2008 03:52          "Richardson, Leonard A"         
             AM                        <LEONARD.RICHARDSON@xxxxxx>,    
                                       "Muldoon, William H"            
                                       <William.Muldoon@xxxxxx>, "Todd,
                                       John A" <John.Todd@xxxxxx>      
                                                                   Subject
                                       Query Builder - Example MDR that
                                       shows Nodes and Edges           
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       




Sheldon,

I had already worked my way through your example for doing a query builder
against the example mdr.

I was asking how do you this so that you can create the query against the
Example MDR that will show Nodes and Edges ?

When I look at the query:



<!-- This query selects all students taught by the teacher with -->
<!-- the id: "staff01"
-->
<s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel";>
                <s:itemTemplate id="teacher">
                                <s:instanceIdConstraint>
                                                <s:instanceId>

<s:mdrId>org.eclipse.cosmos.samples.cmdbf.XMLRepository</s:mdrId>

<s:localId>staff01</s:localId>
                                                </s:instanceId>
                                </s:instanceIdConstraint>
                </s:itemTemplate>

                <s:itemTemplate id="students">
                                <s:recordConstraint>
                                                <s:recordType namespace=""
localName="student"/>
                                </s:recordConstraint>
                </s:itemTemplate>

                <s:relationshipTemplate id="Teaches">
                                <s:sourceTemplate ref="teacher"/>
                                <s:targetTemplate ref="students"/>
                </s:relationshipTemplate>
</s:query>


I ask the question.... What do i need to do to produce this query using the
QueryBuilder.  So I would like your help on coming up with the steps that
you have to take to achieve this please.

I was able to add an itemTemplate for teacher and Student, but I think
there is a bug.  When I try to change the localName for the second one, it
defaults to the one from the first, and when you change it, you change it
for both itemTemplates.

If that had worked, I thought I then click on the teachers leaf in the top
tree, and select add relationship, and then I think it would produce the
right query.  I would still have to somewhere specify the mdrId and
localid.

The closets I got to producing it created this:

<?xml version="1.0" encoding="UTF-8"?>
<s:query xmlns:s="http://cmdbf.org/schema/1-0-0/datamodel";>
   <s:itemTemplate id="teachers" suppressFromResult="false" >
      <s:recordConstraint >
         <s:recordType namespace="" localName="teacher" >
         </s:recordType>
      </s:recordConstraint>
   </s:itemTemplate>
   <s:itemTemplate id="students" suppressFromResult="false" >
      <s:recordConstraint >
         <s:recordType namespace="" localName="teacher" >
         </s:recordType>
      </s:recordConstraint>
      <s:instanceIdConstraint >
         <s:instanceId instanceId="staff01" >
         </s:instanceId>
      </s:instanceIdConstraint>
   </s:itemTemplate>
</s:query>


If you submit this, it gives an invalid xml error.

I think it would be a good idea to have an external option somewhere that
would allow you to modify this xml manually in the preview box, so that you
are not reliant on the query builder producing a valid query.  By that I
mean, I would just like to run the existing Example MDR query against the
mdr and produce the json that we have been doing during testing.  We know
what the GraphResponseViewer should show, but we are being stopped.

I do not know the intentions of the query builder fully, but it seems to me
that you have to have a mechanism for saving the query you built, as you
will have to go through building it each time.  That suggest that you will
require to save the xml that is produced by the builder, and to have a
mechanism for reading that xml and generating the query as it would look in
the query builder.

I saw Bill?s comments on this subject, and I reiterate his questions.

Martin...

Attachment: datamap.jprop
Description: Binary data


Back to the top