Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleExpand to see legends and methodology

Include Page
Legends and methodologyLegends and methodologyMethodology
Methodology

Go to page

Anchor
TqlQuery grammar
TqlQuery grammar
Gliffy
nameTqlQuery Grammar

solid
Panel
borderStyle
Paste code macro
languageyaml
titleTqlQuery grammar
Example

 

Referenced by:

Query

  • Label: Query label, will be copied into result
  • From: Dot-delimited path to source container
  • TqlAs is written as "As": Colon-separated whole result: result set [:instance] container specifiers
  • FsExpression: any facet script expressions. They can be used both before the "Find/DeleteAll/Save/Create/Update/Delete" tags or after them. In either case, the execution is different
  • ListQName Using: List of namespace hints
  • Tag Using: Additional model definitions
    Query:
      var: "some"
      Documentation: >
        This query finds all pairs of illuminated street lights next to vacant (or about to become vacant) parking
        meters operated by the same business outside of 1000 feet radius of a Chevron gas station if any.
      Find:
        using: "Sensity,City,Business"
        Entity:
          QType: "Business"
          as: "some.Business"
        Light:
          operatedBy: "some.Business.EIN"
          not:
            state: "OutOfOrder"
          as: "MyLight"
          Brightness:
            gt: "80%"
          Location:
            Lattitude:
              between: "1.234,0.9876"
        Parking.Meter:
          operatedBy: "some.Business.EIN"
          as: "MyParkingMeter"
          or:
            - eq:
                target: "state"
                value: "vacant"
            - and:
                - eq:
                    target: "state"
                    value: "occupied"
                - le:
                    target: "remainingTime"
                    value: "PT10M"
        not:
          Business:
            name: "Chevron"
            businessType: "GasStation"
            as: "Chevron"
          Distance:
            from: "Chevron.EID"
            to: "var.MyLight.LID"
            feet:
              le: "1000"
    
    


    Anchor
    TqlAs grammar
    TqlAs grammar
    Gliffy
    nameTqlAs Grammar

    Example

     

    Referenced by:

    TqlAs

  • TqlAs: This defines a micro-language for a string value
  • TqlContainer - Instance container - this part is only used in Find. 
    Panel
    borderStylesolid
    titleTqlAs grammar
    Paste code macro
    languageyaml
    Query:
      Find:
        as: "X:Y:Z"
        format: "version,current"
        Zone:
          as: "var.Zone"
          ZoneID:
            ne: ""
        ZoneInfo:
          ZoneName:
            eq: "var.Zone.Name"



    Anchor
    TqlContainer grammar
    TqlContainer grammar
    Gliffy
    nameTqlContainer Grammar

    Example

     

    Referenced by:

    TqlContainer

  • TqlContainer: This is a [partial] string value definition.
  • ValueOf(sid): use SID as a container
  • ValueOf(name): use [model] name as a container
  • $none: no container requested 
    Panel
    borderStylesolid
    titleTqlContainer grammar
    Paste code macro
    languageyaml
    Query:
      Find:
        as: "$none:Zone:$none"
        format: "version,current"
        Zone:
          as: "var.Zone"
          ZoneID:
            ne: ""
        ZoneInfo:
          ZoneName:
            eq: "var.Zone.Name"
    
    


    Anchor
    TqlFindDeleteAll grammar
    TqlFindDeleteAll grammar
    Gliffy
    nameTqlFindDeleteAll Grammar

    Example

     

    Referenced by:

    TqlFindDeleteAll

  • TqlFindDeleteAll: Find or DeleteAll content
  • From: Dot-delimited path to source container
  • TqlAs is written as "As": Colon-separated whole result:result set[:instance] container specifiers
  • Distinct: Reference to a model
  • TqlOnly is written as "Only": List of attributes to fetch 
    Panel
    borderStylesolid
    titleTqlFindDeleteAll grammar
    Paste code macro
    languageyaml
    Query:
      Find:
        as: "$none:Zone:$none"
        Only: "Zone:Name"
        format: "version,current"
        Zone:
          as: "var.Zone"
          ZoneID:
            ne: ""


    Anchor
    TqlOnly grammar
    TqlOnly grammar
    Gliffy
    nameTqlOnly Grammar

    Panel
    borderStylesolid
    titleTqlOnly grammar
    Example

    <Query>

      <Find as="$none:Zone:$none" Only="Zone:Name" format="version,current">

        <Zone as="var.Zone">

          <ZoneID ne=""/>

        </Zone>

      </Find>

    </Query>

    Returns

    <Zone>
      <Name Value="CV-F1-Zone-1" Version="1"/>
    </Zone>
    <Zone>
    ...

    Referenced by:


    TqlOnly

    • TqlOnly: comma-separated list of attribute names with optional predicates
    • Has optional "not." or "!" prefix
    • not.: canonical prefix
    • !: abbreviated prefix
    • Attribute reference: can be qualified by a model name or a variable name
    • "," and optional white space between attribute references

    ...

    Panel
    borderStylesolid
    titleTqlFindModel grammar
    Example

    <Query>

      <Find as="$none:Zone:$none"  format="version,current">

        <gateway.agriculture.Zone as="var.X">

          <ZoneID ne=""/>

        </gateway.agriculture.Zone>

      </Find>

    </Query>



    Referenced by:


    TqlFindModel

    • TqlFindModel: Tql Find query model content
    • $Model=SubtypeOf(DataModel): this should set the $Model variable to be the name of any subtypes of DataModel (i.e. all Models). This variable value will be carried on to be used by TqlFindAttribute.
    • TqlFindAttribute: This will use the $Model variable

    ...

    Panel
    borderStylesolid
    titleTqlFindAttribute grammar
    Example

    <Query>

      <Find as="$none:Zone:$none"  format="version,current">

        <Zone as="var.X">

          <And>

            <ZoneID ne=""/>

            <Name ne="CV-F1-Zone-1" />

          </And>

        </Zone>

      </Find>

    </Query>

    Returns all the records except with Name as CV-F1-Zone-1.


    Referenced by:


    TqlFindAttribute

    • TqlFindAttribute: Tql Find query model attribute content
    • AttributeOf($Model): name of an attribute of the enclosing model.
    • ConditionExpression: see definition on TQL Model Grammar

    ...

    Panel
    borderStylesolid
    titleTqlCrud grammar
    Example
     


    <Query>

       <Create>

            <Zone>

                   <Name = "Zone-1" />

            </Zone>

        </Create>

    </Query>


    Referenced by:


    TqlCrud

    • TqlCrud: CRUD operation content
    • From: Dot-delimited path to source container
    • TqlAs is written as "As": Colon-separated whole result:instance container specifiers
    • TqlOnly is written as "Only": List of attributes to store

    ...

    Panel
    borderStylesolid
    titleTqlCrudModel grammar
    Example
     
    <Query>

       <Create>

            <gateway.agriculture.Zone>

                   <Name = "Zone-1" />

            </gateway.agriculture.Zone>

        </Create>

    </Query>


    Referenced by:


    TqlCrudModel

    • TqlCrudModel: Tql CRUD query model content
    • $Model=SubtypeOf(DataModel): this should set the $Model variable to be the name of any subtypes of DataModel (i.e. all Models). This variable value will be carried on to be used by TqlCrudAttribute.
    • TqlCrudAttribute: This will use the $Model variable

    ...

    Panel
    borderStylesolid
    titleTqlCrudAttribute grammar
    Example
     

    <Query>

        <Create format="version,order,timestamp">

          <User UserId="User1">

            <UserName>myName</UserName>

            <Password>pass</Password>

            <isActive>true</isActive>

            <Address Label="Work">

              <Street>1151 Sonora Ct, Suite 2</Street>

              <City>Sunnyvale</City>

              <State>CA</State>

              <ZipCode>94086</ZipCode>

            </Address>

          </User>

          <User>

          ...

        </Create>

    </Query>


    Referenced by:


    TqlCrudAttribute

    • TqlCrudAttribute: Tql CRUD query model attribute content
    • AttributeOf($Model): name of an attribute of the enclosing model; abbreviated form or extended form
    • Value: actual value
    • Version: optional version
    • do: optional operation

    ...

    Panel
    borderStylesolid
    titleTqlCrudAttribute grammar
    Example
     
     

    <Query>

        <Update format="version,order,timestamp">

          <User UserId="User1">

            <UserName>myName</UserName>

            <Password>pass</Password>

            <isActive>true</isActive>

            <Role Do="Create">user</Role>

            <Address Label="Work">

              <Street>1151 Sonora Ct, Suite 2</Street>

              <City>Sunnyvale</City>

              <State>CA</State>

              <ZipCode>94086</ZipCode>

            </Address>

          </User>

          <User>

          ...

        </Update>

    </Query>

    Referenced by: