Named
SCQL Queries Definition in the Knowledge Base
SCQL queries concerning
the MES system were defined in the separate application domain “Production
Queries”. The application domain contains three nested application domains:
“Material Unit”, “Commercial Order”, “Testing”. The first
and second application domains define practically significant queries. The last
one serves for testing the SCQL-SQL mapping algorithm and has no sensible
queries. See SCM knowledge base definition for
details about queries definition rules.
Production Queries\Material Unit.scm
|
<?xml version="1.0"
encoding="UTF-8" ?> <scm> <import> <conceptimp>General.Physical
Object.Geometry.Thickness</conceptimp> <conceptimp>General.Physical
Object.Geometry.Width</conceptimp> <conceptimp>General.Physical
Object.Gravity.Mass</conceptimp> <conceptimp>Production.Material
Unit.Material Unit</conceptimp> <conceptimp>Production.Material
Unit.Material Unit State</conceptimp> <conceptimp>Production.Indiscrete.Metallurgic.Slab</conceptimp> <conceptimp>Production.Indiscrete.Consumed
Material Unit</conceptimp> <conceptimp>Production.Indiscrete.Mass
Transition</conceptimp> <conceptimp>Production.Commercial
Order.Commercial Order</conceptimp> </import> <query name="Material units thicker
0,5"> <natural>Material
units having thickness more than 0.5</natural> <formal>(Material
Unit-(Thickness>0.5))</formal> <composition> <connection> <roleconcept
concept="Material Unit" role=""/> <roleconcept
concept="Thickness"/> </connection> <predicate
type=">"> <roleconcept
concept="Thickness"/> <function
constant="0.5"/> </predicate> </composition> </query> <query name="Slabs thicker/equial to 100
ordered by thickness"> <natural>Slabs
having thickness more or equal to 100</natural> <formal>(Slab-Material
Unit-(Thickness>100 OR Thickness=100)) ORDER BY Thickness</formal> <order
type="ASC"><roleconcept
concept="Thickness"></roleconcept></order> <composition> <connection> <roleconcept
concept="Slab"/> <roleconcept
concept="Material Unit"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <predicate
type="OR"> <predicate
type=">"> <roleconcept
concept="Thickness"/> <function
constant="100"/> </predicate> <predicate
type="="> <roleconcept
concept="Thickness"/> <function
constant="100"/> </predicate> </predicate> </composition> </query> <query name="Outcoming material unit
mass"> <natural>A
material unit outcoming mass is a sum of its outcoming transitions' masses
</natural> <formal>(Material
Unit-Consumed Material Unit-Mass Transition-Mass).(Material Unit, SUM(Mass)
~Mass)</formal> <transformation> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"> <function
type="SUM"> <roleconcept
concept="Mass"/> </function> </roleconcept> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Consumed Material Unit"/> </connection> <connection> <roleconcept
concept="Consumed Material Unit"/> <roleconcept
concept="Mass Transition"/> </connection> <connection> <roleconcept
concept="Mass Transition"/> <roleconcept
concept="Mass"/> </connection> </composition> </transformation> </query> <query name="The rest material unit
mass"> <natural>The
rest mass of a material unit is: a) mass of the material unit - if it is in a
store; b) mass of the material unit minus masses of all
outcoming transitions - if it is in a production unit c) 0 - if it is consumed;</natural> <formal>((Material
Unit State=1)-Material Unit-Mass).(Material Unit, Mass) union ((((Material Unit State=2)-Material Unit),
query[Outcoming material unit mass]).(Material Unit, Mass)) union ((Material Unit State=3)-Material
Unit).(Material Unit, 0 ~Mass)</formal> <union> <union> <transformation> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> <composition> <predicate
type="="> <roleconcept
concept="Material Unit State"/> <function
constant="1"/> </predicate> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Material Unit State"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> </connection> </composition> </transformation> <transformation> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"> <function
type="-"> <roleconcept
concept="Mass" role="Initial"/> <roleconcept
concept="Mass"/> </function> </roleconcept> <composition> <predicate
type="="> <roleconcept
concept="Material Unit State"/> <function
constant="2"/> </predicate> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Material Unit State"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass" role="Initial"/> </connection> <queryref>Outcoming
material unit mass</queryref> </composition> </transformation> </union> <transformation> <roleconcept
concept="Material Unit"></roleconcept> <roleconcept
concept="Mass"> <function
constant="0"></function> </roleconcept> <composition> <predicate
type="="> <roleconcept
concept="Material Unit State"/> <function
constant="3"/> </predicate> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Material Unit State"/> </connection> </composition> </transformation> </union> </query> <query name="Not slabs"> <natural>All
material units not being slabs</natural> <formal>(Material
Unit-Thickness).(Material Unit) minus (Material Unit-Slab).(Material
Unit)</formal> <minus> <transformation> <roleconcept
concept="Material Unit"/> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> </transformation> <transformation> <roleconcept
concept="Material Unit"/> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Slab"/> </connection> </transformation> </minus> </query> <query name="All material units with
perhaps commercial orders"> <natural>All
material units extended with commercial orders when they are assigned
to</natural> <formal>(Material
Unit-Thickness), (Material Unit-Commercial Order)+</formal> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <connection
outer="true"> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Commercial Order"/> </connection> </composition> </query> </scm> |
Production Queries\Commercial Order.scm
|
<?xml version="1.0"
encoding="UTF-8" ?> <scm> <import> <queryimp>Production
Queries.Material Unit.The rest material unit mass</queryimp> <conceptimp>Production.Material
Unit.Material Unit</conceptimp> <conceptimp>Production.Commercial
Order.Commercial Order</conceptimp> <conceptimp>Production.Commercial
Order.Optimal Mass</conceptimp> <conceptimp>General.Physical
Object.Gravity.Mass</conceptimp> </import> <query name="Commercial order mass in
production"> <natural>Sum
of the rest material unit masses of all material units assigned to the
commercial order</natural> <formal>((Commercial
Order-Material Unit), query[The rest material unit mass]).(Commercial Order,
SUM(Mass) ~Mass)</formal> <transformation> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Mass"> <function
type="SUM"> <roleconcept
concept="Mass"/> </function> </roleconcept> <composition> <connection> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Material Unit"/> </connection> <queryref>The
rest material unit mass</queryref> </composition> </transformation> </query> <query name="The rest of commercial order
mass"> <natural>The
rest of commercial order mass is its optimal mass minus mass in
production</natural> <formal>((Commercial
Order-Optimal Mass-Mass(Optimal)), query[Commercial order mass in
production].(Commercial Order, Mass ~Mass(In production))).(Commercial Order,
Mass(Optimal)-Mass(In production) ~Mass)</formal> <transformation> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Mass"> <function
type="-"> <roleconcept
concept="Mass" role="Optimal"/> <roleconcept
concept="Mass" role="In production"/> </function> </roleconcept> <composition> <connection> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Optimal Mass"/> </connection> <connection> <roleconcept
concept="Optimal Mass"/> <roleconcept
concept="Mass" role="Optimal"/> </connection> <!-- transformation role concept can contain
nested role concept being term function --> <transformation> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Mass" role="In production"> <roleconcept
concept="Mass"/> </roleconcept> <queryref>Commercial
order mass in production</queryref> </transformation> </composition> </transformation> </query> </scm> |
Production Queries\Testing.scm
|
<?xml version="1.0"
encoding="UTF-8" ?> <scm> <import> <conceptimp>General.Physical
Object.Geometry.Thickness</conceptimp> <conceptimp>General.Physical
Object.Geometry.Width</conceptimp> <conceptimp>General.Physical
Object.Gravity.Mass</conceptimp> <conceptimp>Production.Material
Unit.Material Unit</conceptimp> <conceptimp>Production.Material
Unit.Material Unit State</conceptimp> <conceptimp>Production.Commercial
Order.Commercial Order</conceptimp> <conceptimp>Production.Commercial
Order.Optimal Mass</conceptimp> <conceptimp>Production.Production
Division.Production Division</conceptimp> <conceptimp>Production.Production
Division.Production Unit</conceptimp> <conceptimp>Production.Production
Division.Subordinate Production Division</conceptimp> <conceptimp>Production.Production
Division.Higher Production Division</conceptimp> <conceptimp>Production.Production
Division.Full Name</conceptimp> <conceptimp>Production.Indiscrete.Mass
Transition</conceptimp> <conceptimp>Production.Indiscrete.Consumed
Material Unit</conceptimp> <conceptimp>Production.Indiscrete.Produced
Material Unit</conceptimp> </import> <query name="All material units with
commercial orders ordered by sizes"> <natural>All
material units with thier parameters and commerical orders with parameters
ordered by sizes</natural> <formal>((Material
Unit-Thickness), (Material Unit-Width), (Material Unit-Mass(Material Unit)),
(Material Unit-Commercial Order-Optimal Mass-Mass(Commercial
Order)))</formal> <order
type="DESC"> <roleconcept
concept="Thickness"/> </order> <order
type="DESC"> <roleconcept
concept="Width"/> </order> <order> <roleconcept
concept="Mass" role="Material Unit"/> </order> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Width"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass" role="Material Unit"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Commercial Order"/> </connection> <connection> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Optimal Mass"/> </connection> <connection> <roleconcept
concept="Optimal Mass"/> <roleconcept
concept="Mass" role="Commercial Order"/> </connection> </composition> </query> <query name="Higher divisions of
production units (if exist)"> <natural>All
higher divisions of production units only if they exist</natural> <formal>(Production
Unit-Production Division(Subordinate)-Subordinate Production Division-Higher
Production Division-Production Division(Higher))</formal> <composition> <connection> <roleconcept
concept="Production Unit"/> <roleconcept
concept="Production Division" role="Subordinate"/> </connection> <connection> <roleconcept
concept="Production Division" role="Subordinate"/> <roleconcept
concept="Subordinate Production Division"/> </connection> <connection> <roleconcept
concept="Subordinate Production Division"/> <roleconcept
concept="Higher Production Division"/> </connection> <connection> <roleconcept
concept="Higher Production Division"/> <roleconcept
concept="Production Division" role="Higher"/> </connection> </composition> </query> <query name="Mass tansitions with material
units"> <natural>All
mass transitions and their consumed and produced material
units</natural> <formal>(Material
Unit(Consumed)-Consumed Material Unit-Mass Transition-Produced Material
Unit-Material Unit(Produced))</formal> <composition> <connection> <roleconcept
concept="Material Unit" role="Consumed"/> <roleconcept
concept="Consumed Material Unit"/> </connection> <connection> <roleconcept
concept="Consumed Material Unit"/> <roleconcept
concept="Mass Transition"/> </connection> <connection> <roleconcept
concept="Mass Transition"/> <roleconcept
concept="Produced Material Unit"/> </connection> <connection> <roleconcept
concept="Produced Material Unit"/> <roleconcept
concept="Material Unit" role="Produced"/> </connection> </composition> </query> <query name="Grandparent divisions of
production units"> <natural>Divisions
that are higher for higher divisions of production units</natural> <formal>(Production
Unit-Production Division(0)-Subordinate Production Division(0)-Higher
Production Division(0)-Production Division(1)-Subordinate Production
Division(1)-Higher Production Division(1)-Peoduction Division(2)-Full
Name)</formal> <composition> <connection> <roleconcept
concept="Production Unit"/> <roleconcept
concept="Production Division" role="0"/> </connection> <connection> <roleconcept
concept="Production Division" role="0"/> <roleconcept
concept="Subordinate Production Division" role="0"/> </connection> <connection> <roleconcept
concept="Subordinate Production Division" role="0"/> <roleconcept
concept="Higher Production Division" role="0"/> </connection> <connection> <roleconcept
concept="Higher Production Division" role="0"/> <roleconcept
concept="Production Division" role="1"/> </connection> <connection> <roleconcept
concept="Production Division" role="1"/> <roleconcept
concept="Subordinate Production Division" role="1"/> </connection> <connection> <roleconcept
concept="Subordinate Production Division" role="1"/> <roleconcept
concept="Higher Production Division" role="1"/> </connection> <connection> <roleconcept
concept="Higher Production Division" role="1"/> <roleconcept
concept="Production Division" role="2"/> </connection> <connection> <roleconcept
concept="Production Division" role="2"/> <roleconcept
concept="Full Name"/> </connection> </composition> </query> <query name="Material units and commercial
orders having the same mass"> <natural>All
material units and commercial orders having the same mass and optimal
mass</natural> <formal>(Material
Unit-Mass-Optimal Mass-Commercial Order)</formal> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> </connection> <connection> <roleconcept
concept="Mass"/> <roleconcept
concept="Optimal Mass"/> </connection> <connection> <roleconcept
concept="Optimal Mass"/> <roleconcept
concept="Commercial Order"/> </connection> </composition> </query> <query name="Material units used for
production of other material units"> <natural>All
material units that are consumed for producing other material
units</natural> <formal>(Material
Unit(Consumed)-Consumed Material Unit-Mass Transition-Produced Material
Unit-Material Unit(Produced))</formal> <composition> <connection> <roleconcept
concept="Material Unit" role="Consumed"/> <roleconcept
concept="Consumed Material Unit"/> </connection> <connection> <roleconcept
concept="Consumed Material Unit"/> <roleconcept
concept="Mass Transition"/> </connection> <connection> <roleconcept
concept="Mass Transition"/> <roleconcept
concept="Produced Material Unit"/> </connection> <connection> <roleconcept
concept="Produced Material Unit"/> <roleconcept
concept="Material Unit" role="Produced"/> </connection> </composition> </query> <query name="Grandparent material units
used for production of other material units"> <natural>All
material units that are consumed for producing other material
units</natural> <formal>(Material
Unit(0)-Consumed Material Unit(0)-Mass Transition(0)-Produced Material
Unit(0)-Material Unit(1)-Consumed Material Unit(1)-Mass Transition(1)-Produced
Material Unit(1)-Material Unit(2)-Mass)</formal> <composition> <connection> <roleconcept
concept="Material Unit" role="0"/> <roleconcept
concept="Consumed Material Unit" role="0"/> </connection> <connection> <roleconcept
concept="Consumed Material Unit" role="0"/> <roleconcept
concept="Mass Transition" role="0"/> </connection> <connection> <roleconcept
concept="Mass Transition" role="0"/> <roleconcept
concept="Produced Material Unit" role="0"/> </connection> <connection> <roleconcept
concept="Produced Material Unit" role="0"/> <roleconcept
concept="Material Unit" role="1"/> </connection> <connection> <roleconcept
concept="Material Unit" role="1"/> <roleconcept
concept="Consumed Material Unit" role="1"/> </connection> <connection> <roleconcept
concept="Consumed Material Unit" role="1"/> <roleconcept
concept="Mass Transition" role="1"/> </connection> <connection> <roleconcept
concept="Mass Transition" role="1"/> <roleconcept
concept="Produced Material Unit" role="1"/> </connection> <connection> <roleconcept
concept="Produced Material Unit" role="1"/> <roleconcept
concept="Material Unit" role="2"/> </connection> <connection> <roleconcept
concept="Material Unit" role="2"/> <roleconcept
concept="Mass"/> </connection> </composition> </query> <query name="Calculated length of material
units"> <natural>Length
of material units calculated from their thickness, width, and
mass</natural> <formal>((Thickness-Material
Units-Width), (Material Unit-Mass)).(Material Unit,
Thickness*Width/(Mass*(8-0,2)) ~(Length))</formal> <transformation> <roleconcept
concept="Material Unit"/> <roleconcept
role="Length"> <function
type="/"> <function
type="*"> <roleconcept
concept="Thickness"/> <roleconcept
concept="Width"/> </function> <function
type="*"> <roleconcept
concept="Mass"/> <function
type="-"> <function
constant="7.8"/> <function
constant="0.2"/> </function> </function> </function> </roleconcept> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Width"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> </connection> </composition> </transformation> </query> <!-- errors checking mechanism verifying: <query name="Wrong composition of outer
connections"> <formal>(Material
Unit-Thickness), (Material Unit-Commercial Order)+, (Commercial Order-Optimal
Mass)+</formal> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <connection
outer="true"> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Commercial Order"/> </connection> <connection
outer="true"> <roleconcept
concept="Commercial Order"/> <roleconcept
concept="Optimal Mass"/> </connection> </composition> </query> --> <query name="Material units with checking
of outer composition with several nested outer connection
selections"> <formal>(Material
Unit-Mass), (Material Unit-Width)+, (Mass-Optimal Mass-Commercial
Order)+</formal> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> </connection> <connection
outer="true"> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Width"/> </connection> <composition
outer="true"> <connection> <roleconcept
concept="Mass"/> <roleconcept
concept="Optimal Mass"/> </connection> <connection> <roleconcept
concept="Optimal Mass"/> <roleconcept
concept="Commercial Order"/> </connection> </composition> </composition> </query> <query name="Average mass of material
units within each thickness/width pair"> <formal>((Thickness-Material
Unit-Width), (Material Unit-Mass)).(AVG(Mass) ~Mass, Thickness,
Width)</formal> <transformation> <roleconcept
concept="Thickness"/> <roleconcept
concept="Width"/> <roleconcept
concept="Mass"> <function
type="AVG"> <roleconcept
concept="Mass"/> </function> </roleconcept> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Mass"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Width"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> </composition> </transformation> </query> <query name="Material units having area
between 1000 and 5000, and thickness less 0,5 or width less 1"> <formal>((Thickness-Material
Unit-Width), query[Calculated length of material units]).(Material Unit,
(Width*(Length)) ~Area, Thickness, Width), (Thickness < 0,5 OR Width
< 1), ((Area)>=1000 AND (Area) <= 5000)</formal> <composition> <transformation> <roleconcept
concept="Material Unit"/> <roleconcept
role="Area"> <function
type="*"> <roleconcept
concept="Width"/> <roleconcept
role="Length"/> </function> </roleconcept> <roleconcept
concept="Thickness"/> <roleconcept
concept="Width"/> <composition> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Thickness"/> </connection> <connection> <roleconcept
concept="Material Unit"/> <roleconcept
concept="Width"/> </connection> <queryref>Calculated
length of material units</queryref> </composition> </transformation> <predicate
type="OR"> <predicate
type="<"> <roleconcept
concept="Thickness"/> <function
constant="0.5"/> </predicate> <predicate
type="<"> <roleconcept
concept="Width"/> <function
constant="1"/> </predicate> </predicate> <predicate
type="AND"> <predicate
type=">="> <roleconcept
role="Area"/> <function
constant="1000"/> </predicate> <predicate
type="<="> <roleconcept
role="Area"/> <function
constant="5000"/> </predicate> </predicate> </composition> </query> </scm> |