[tmql-wg] Toma - A suggestion for TMQL

Rani Pinchuk Rani.Pinchuk@spaceapplications.com
Mon, 16 Feb 2004 15:04:06 +0100


--=-lQFFCVwI4y3Q74wS0NA2
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Dear all,

Attached a description of the Toma language. Toma is a suggestion for
a topic map query language. It is inspired by Tolog, AsTMa* and SQL,
but uses also some notations that are used in OO languages.

In the past I published in the tmql-wg mailing list an even more
un-ready description of the language. Currently the language is a bit
more mature - and a prototype that partly implement it was
written. 
In fact, all the examples in the attached document are actually run
using that prototype.

As the language is still very young, there are some issues that should
be changes or fixed. I would appreciate any feedback about it.

Thanks 

Rani


-- 
Rani Pinchuk
Software Engineer
Space Applications Services
Leuvensesteenweg, 325
B-1932 Zaventem
Belgium

Tel.: + 32 2 721 54 84
Fax.: + 32 2 721 54 44

http://www.spaceapplications.com 

--=-lQFFCVwI4y3Q74wS0NA2
Content-Disposition: attachment; filename=SAS-Computers-TM.xml
Content-Type: text/xml; name=SAS-Computers-TM.xml; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<?xml version=3D"1.0"?>

<!DOCTYPE topicMap PUBLIC "-//TopicMaps.Org//DTD XML Topic Map (XTM) V1.0//=
EN"=20
                          "http://www.topicmaps.org/xtm/1.0/xtm1.dtd">

<!--=20

	A small and basic Topic Map about a computer
=09
	This topic map was created to support
	various Topic Maps development activities.
=09
	Author/contact:
	Olivier Lamborelle
	(ol@spaceapplications.com)
=09
	Copyright =A9 2004, Space Applications Services. All rights reserved.
=09
-->
	=20
<topicMap id=3D"computers"
	xmlns		=3D 'http://www.topicmaps.org/xtm/1.0/'
	xmlns:xlink =3D 'http://www.w3.org/1999/xlink'>

<!--
    Topic Map of a Computer
-->

<!--
  pc-part
  io-part
  processing-part
  structural-part
  case            structural-part
  keyboard        i/o-part
  motherboard     processing-part
  mouse           i/o-part
  network-card    processing-part
  pc             =20
  processor       processing-part
  screen          i/o-part
  ventilator1     structural-part
  ventilator2     structural-part
  video-card      processing-part
-->

<topic id=3D"pc-part">
</topic>

<topic id=3D"processing-part">
	<instanceOf>
		<topicRef xlink:href=3D"#pc-part"/>
	</instanceOf>
</topic>

<topic id=3D"io-part">
	<instanceOf>
		<topicRef xlink:href=3D"#pc-part"/>
	</instanceOf>
</topic>

<topic id=3D"structural-part">
	<instanceOf>
		<topicRef xlink:href=3D"#pc-part"/>
	</instanceOf>
</topic>

<topic id=3D"pc">
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<baseNameString>computer</baseNameString>=09
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>A personal desktop computer.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/pc.png">
                </resourceRef>
	</occurrence>=09
</topic>

<!-- external elements -->

<topic id=3D"case">
	<instanceOf>
		<topicRef xlink:href=3D"#structural-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<baseNameString>case</baseNameString>=09
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The case of the computer is the metal box that contains all=
 internal devices.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>=09
		<resourceRef xlink:href=3D"http://www.some.where/case.png">
                </resourceRef>
	</occurrence>=09
</topic>

<topic id=3D"mouse">
	<instanceOf>
		<topicRef xlink:href=3D"#io-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>=09
		<baseNameString>mouse</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The mouse is the small external device with a ball or a LED=
 that the user move on the desk.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The mouse is the device used by the user to determine the p=
osition of the pointer on the screen.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/mouse.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>=09
		<resourceRef xlink:href=3D"http://www.some.where/mouse_motherboard_diagra=
m.png">
                </resourceRef>=09
	</occurrence>
</topic>

<topic id=3D"keyboard">
	<instanceOf>
		<topicRef xlink:href=3D"#io-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>=09
		<baseNameString>keyboard</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The keyboard is the  external device with keys on it that t=
he user strokes with his fingers.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The keyboard is the device used by the user to enter letter=
s and commands.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/keyboard.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/keyboard_motherboard_dia=
gram.png">
                </resourceRef>
	</occurrence>
</topic>

<topic id=3D"screen">
	<instanceOf>
		<topicRef xlink:href=3D"#io-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<baseNameString>screen</baseNameString>=09
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The screen is the external device on the desk that the user=
 looks at.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The screen is the external device that displays information=
 and that the user looks at.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/screen.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/screen_video_card_diagra=
m">
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#mouse"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#screen"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#mouse"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#keyboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#screen"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#keyboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#mouse"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#keyboard"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#screen"/>
	</member>
</association>

<!-- internal elements -->

<topic id=3D"motherboard">
	<instanceOf>
		<topicRef xlink:href=3D"#processing-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>=09
		<baseNameString>motherboard</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The motherboard is the internal device on which certain int=
ernal devices are installed and to which some external devices are connecte=
d</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The motherboard is the device that collects and organizes a=
ll data flows.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceRef xlink:href=3D"http://www.some.where/motherboard.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/motherboard_diagram.png"=
>
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<topic id=3D"processor">
	<instanceOf>
		<topicRef xlink:href=3D"#processing-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
			<topicRef xlink:href=3D"#thermal" />
		</scope>=09
		<baseNameString>processor</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The processor is an internal device mounted on the motherbo=
ard.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The processor is the device that processes all instructions=
.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>
		<resourceData>The processor is the internal device that produces the most=
 heat by Joule effect.</resourceData>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/processor.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/processor_diagram.png">
                </resourceRef>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>=09
		<resourceRef xlink:href=3D"http://www.some.where/heat_frequency_graph.png=
">
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<topic id=3D"video-card">
	<instanceOf>
		<topicRef xlink:href=3D"#processing-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
			<topicRef xlink:href=3D"#thermal" />
		</scope>=09
		<baseNameString>video-card</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The video-card is an internal device mounted on the motherb=
oard.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The video-card is the device that manage the displays.</res=
ourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>
		<resourceData>The video-card is an internal device that produces heat by =
Joule effect.</resourceData>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceRef xlink:href=3D"http://www.some.where/video_card.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/video_card_diagram.png">
                </resourceRef>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/heat_resolution_graph.pn=
g">
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
</association>

<topic id=3D"network-card">
	<instanceOf>
		<topicRef xlink:href=3D"#processing-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#logical" />
		</scope>=09
		<baseNameString>network-card</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The network-card is an internal device mounted on the mothe=
rboard.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceData>The network-card is the device that manage the network conn=
ection.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/network_card.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#logical" />
		</scope>
		<resourceRef xlink:href=3D"http://www.some.where/network_card_diagram.png=
">
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#network-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#network-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#network-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#network-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#logical-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#logical" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sender"/></roleSpec>
		<topicRef xlink:href=3D"#network-card"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#receiver"/></roleSpec>
		<topicRef xlink:href=3D"#motherboard"/>
	</member>
</association>

<topic id=3D"ventilator1">
	<instanceOf>
		<topicRef xlink:href=3D"#structural-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#thermal" />
		</scope>=09
		<baseNameString>processor ventilator</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The processor ventilator is an internal device mounted on t=
he processor.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>
		<resourceData>The processor ventilator dissipates heat produces by the pr=
ocessor.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/ventilator.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>
		<resourceRef xlink:href=3D"http://www.some.where/heat_rotation_graph.png"=
>
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator1"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator1"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#thermal-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#thermal" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#source"/></roleSpec>
		<topicRef xlink:href=3D"#processor"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sink"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator1"/>
	</member>
</association>

<topic id=3D"ventilator2">
	<instanceOf>
		<topicRef xlink:href=3D"#structural-part"/>
	</instanceOf>
	<baseName>
		<scope>
			<topicRef xlink:href=3D"#location" />
			<topicRef xlink:href=3D"#thermal" />
		</scope>=09
		<baseNameString>video-card ventilator</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>
		<resourceData>The video-card ventilator is an internal device mounted on =
the video-card.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>
		<resourceData>The video-card ventilator dissipates heat produces by the v=
ideo-card.</resourceData>
	</occurrence>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#location" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/ventilator.png">
                </resourceRef>
	</occurrence>=09
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#graphic"/>
		</instanceOf>
		<scope>
			<topicRef xlink:href=3D"#thermal" />
		</scope>	=09
		<resourceRef xlink:href=3D"http://www.some.where/heat_rotation_graph.png"=
>
                </resourceRef>
	</occurrence>
</topic>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator2"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#close-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator2"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#device"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#in-location"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#location" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#container"/></roleSpec>
		<topicRef xlink:href=3D"#case"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#contained"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator2"/>
	</member>
</association>

<association>
	<instanceOf>
		<topicRef xlink:href=3D"#thermal-exchange"/>
	</instanceOf>
	<scope>
		<topicRef xlink:href=3D"#thermal" />
	</scope>
	<member>
		<roleSpec><topicRef xlink:href=3D"#source"/></roleSpec>
		<topicRef xlink:href=3D"#video-card"/>
	</member>
	<member>
		<roleSpec><topicRef xlink:href=3D"#sink"/></roleSpec>
		<topicRef xlink:href=3D"#ventilator2"/>
	</member>
</association>

<!-- associations -->

<topic id=3D"thermal-exchange">
	  <baseName>
	  	<scope>
	      <topicRef xlink:href=3D"#source"/>
	    </scope>
	    <baseNameString>heats</baseNameString>
	  </baseName>
	  <baseName>
	    <scope>
	      <topicRef xlink:href=3D"#sink"/>
	    </scope>
	    <baseNameString>is heated by</baseNameString>
	  </baseName>
</topic>

<topic id=3D"logical-exchange">
	  <baseName>
	  	<scope>
	      <topicRef xlink:href=3D"#sender"/>
	    </scope>
	    <baseNameString>sends data to</baseNameString>
	  </baseName>
	  <baseName>
	    <scope>
	      <topicRef xlink:href=3D"#receiver"/>
	    </scope>
	    <baseNameString>receives data from</baseNameString>
	  </baseName>
</topic>

<topic id=3D"close-location">
	  <baseName>
	    <baseNameString>is next to</baseNameString>
	  </baseName>
</topic>

<topic id=3D"in-location">
	  <baseName>
	  	<scope>
	      <topicRef xlink:href=3D"#container"/>
	    </scope>
	    <baseNameString>contains</baseNameString>
	  </baseName>
	  <baseName>
	    <scope>
	      <topicRef xlink:href=3D"#contained"/>
	    </scope>
	    <baseNameString>is in</baseNameString>
	  </baseName>
</topic>

<!-- association roles types -->

<topic id=3D"sender">
	  <baseName>
	    <baseNameString>sender</baseNameString>
	  </baseName>
</topic>

<topic id=3D"receiver">
	  <baseName>
	    <baseNameString>receiver</baseNameString>
	  </baseName>
</topic>

<topic id=3D"source">
	  <baseName>
	    <baseNameString>source</baseNameString>
	  </baseName>
</topic>

<topic id=3D"sink">
	  <baseName>
	    <baseNameString>sink</baseNameString>
	  </baseName>
</topic>

<topic id=3D"device">
	  <baseName>
	    <baseNameString>device</baseNameString>
	  </baseName>
</topic>

<topic id=3D"container">
	  <baseName>
	    <baseNameString>container</baseNameString>
	  </baseName>
</topic>

<topic id=3D"contained">
	  <baseName>
	    <baseNameString>contained</baseNameString>
	  </baseName>
</topic>

=09
<!-- classes -->

<topic id=3D"internal">
	<baseName>
		<baseNameString>internal</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>Internal components of the computer.</resourceData>
	</occurrence>
</topic>

<topic id=3D"external">
	<baseName>
		<baseNameString>external</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>External components of the computer.</resourceData>
	</occurrence>
</topic>

<!-- scopes -->

<topic id=3D"thermal">
	<baseName>
		<baseNameString>thermal</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>Thermal scope type; used to filter thermal aspect.</resourc=
eData>
	</occurrence>
</topic>

<topic id=3D"location">
	<baseName>
		<baseNameString>location</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>Location scope type; used to filter location aspect.</resou=
rceData>
	</occurrence>
</topic>

<topic id=3D"logical">
	<baseName>
		<baseNameString>logical</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>Logical scope type; used to filter logical aspect.</resourc=
eData>
	</occurrence>
</topic>

<!-- occurrence types -->

<topic id=3D"graphic">
	<baseName>
		<baseNameString>graphic</baseNameString>
	</baseName>
	<occurrence>
		<instanceOf>
			<topicRef xlink:href=3D"#text"/>
		</instanceOf>=09
		<resourceData>Graphic occurrence type; used to provide link to external g=
raphic resource.</resourceData>
	</occurrence>
</topic>

<topic id=3D"text">
	<baseName>
		<baseNameString>text</baseNameString>
	</baseName>
	<occurrence>
		<resourceData>Text occurrence type; used to provide internal short inform=
ation about a topic.</resourceData>
	</occurrence>
</topic>

</topicMap>
--=-lQFFCVwI4y3Q74wS0NA2
Content-Disposition: attachment; filename=Toma.html
Content-Type: text/html; name=Toma.html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Toma - Topic Map Query Language</title>

<link rel="stylesheet" href="style.css" type="text/css" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">

<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->

<ul>

	<li><a href="#toma__topic_map_query_language">Toma - Topic Map Query Language</a></li>
	<li><a href="#language_description">LANGUAGE DESCRIPTION</a></li>
	<ul>

		<li><a href="#whitespaces_and_comments">Whitespaces and Comments</a></li>
		<li><a href="#quoted_strings">Quoted Strings</a></li>
		<li><a href="#labels">Labels</a></li>
		<li><a href="#topic_variable">Topic variable</a></li>
		<li><a href="#operators_over_topics">Operators over Topics</a></li>
		<ul>

			<li><a href="#id_of_a_topic__id">Id of a Topic - id</a></li>
			<li><a href="#base_name__bn">Base name - bn</a></li>
			<li><a href="#subject_identity_of_a_topic__si_tr__si_sir_and_si_rr">Subject identity of a Topic - si.tr, si.sir and si.rr</a></li>
			<li><a href="#occurrences_with_the_type_of_the_occurrence__oc___rd__oc___rr">Occurrences with the type of the occurrence - oc().rd, oc().rr</a></li>
			<li><a href="#instanceof_relationship__type__">instanceOf relationship - <code>type()</code></a></li>
		</ul>

		<li><a href="#associations">Associations</a></li>
		<ul>

			<li><a href="#association___">Association - -&gt;</a></li>
			<li><a href="#chaining_associations">Chaining Associations</a></li>
		</ul>

		<li><a href="#scopes">Scopes</a></li>
		<ul>

			<li><a href="#scope___">Scope - @</a></li>
		</ul>

		<li><a href="#general_statements_syntax">General Statements Syntax</a></li>
		<li><a href="#use_statement">USE statement</a></li>
		<li><a href="#select_statement">SELECT statement</a></li>
		<ul>

			<li><a href="#the_select_clause_of_the_select_statement">The SELECT clause of the SELECT statement</a></li>
			<li><a href="#the_from_clause_of_the_select_statement">The FROM clause of the SELECT statement</a></li>
			<li><a href="#the_where_clause">The WHERE clause</a></li>
			<ul>

				<li><a href="#comparison_clause">Comparison clause</a></li>
				<li><a href="#exists_clause">EXISTS clause</a></li>
				<li><a href="#not_clause">NOT clause</a></li>
				<li><a href="#and_clause">AND clause</a></li>
				<li><a href="#or_clause">OR clause</a></li>
			</ul>

		</ul>

		<li><a href="#examples">EXAMPLES</a></li>
		<ul>

			<li><a href="#the_prototype_implementation">The Prototype Implementation</a></li>
			<li><a href="#topics__base_names_and_scopes">Topics, Base Names and Scopes</a></li>
			<li><a href="#types__instanceof_relationship_">Types (instanceOf relationship)</a></li>
			<li><a href="#occurences">Occurences</a></li>
			<li><a href="#associations">Associations</a></li>
		</ul>

		<li><a href="#missing_features">Missing Features</a></li>
	</ul>

	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="toma__topic_map_query_language">Toma - Topic Map Query Language</a></h1>
<p>The following is the language description of <strong>Toma</strong> which is a Topic
Map query language.</p>
<p>A prototype that implement most of the features described in this
document was written, and the examples below are run using that
prototype. Thus it is clear that the language as written in this
document is quite easy to implement.</p>
<p>
</p>
<hr />
<h1><a name="language_description">LANGUAGE DESCRIPTION</a></h1>
<p>
</p>
<h2><a name="whitespaces_and_comments">Whitespaces and Comments</a></h2>
<p>Whitespace characters are used to as token separators, and apart from 
that, they are ignored by the parser. One exception to that rule are 
whitespaces within quotes.</p>
<p>Any line starting with hash character '#' is ignoed by the parser and 
can be used to comment the code.</p>
<p>
</p>
<h2><a name="quoted_strings">Quoted Strings</a></h2>
<p>A string of whatever characters that is surrounded by single quotes is
a quoted string. If the string supposed to contain a single quote, it
is escaped with another single quote. Example:</p>
<pre>
  'this is a quoted string'
 
  'and that''s also a quoted string'</pre>
<p>
</p>
<h2><a name="labels">Labels</a></h2>
<p>Labels are used to indicate topic ids, topic maps ids, association
types, roles types and scope topics. They can come in two formats - as
an alphanumeric + underscore string, or an alphanumeric + underscore +
hyphen string surrounded by square brackets. Examples:</p>
<pre>
 container
 
 [logical-exchange]</pre>
<p>When the label comes with square brackets, only the string within the
brackets is taken as the label.</p>
<p>
</p>
<h2><a name="topic_variable">Topic variable</a></h2>
<p>Dollar followed by any alphanumeric character or underscore is a 
topic variable and it represents a topic.</p>
<pre>
  $&lt;variable_name&gt;</pre>
<p>Examples:</p>
<pre>
  $a
 
  $person</pre>
<p>Through out this document we will refer to topic variable as</p>
<pre>
  &lt;topic_variable&gt;</pre>
<p>However, we will refer to expression that is evaluated to a topic
as</p>
<pre>
  &lt;topic&gt;</pre>
<p>Note that the second can be but is not always equivalent to the first - 
any topic variable is evaluated to a topic but there are other 
expressions that are not topic variables which are evaluated to topics.</p>
<p>
</p>
<h2><a name="operators_over_topics">Operators over Topics</a></h2>
<p>
</p>
<h3><a name="id_of_a_topic__id">Id of a Topic - id</a></h3>
<p><strong>.id</strong> gives the topic id as a <strong>string</strong>:</p>
<pre>
  &lt;topic&gt;.id</pre>
<p>Example:</p>
<pre>
  $person.id</pre>
<p>
</p>
<h3><a name="base_name__bn">Base name - bn</a></h3>
<p><strong>.bn</strong> gives the topic base name as a <strong>string</strong>:</p>
<pre>
  &lt;topic&gt;.bn</pre>
<p>Example:</p>
<pre>
  $person.bn</pre>
<p>
</p>
<h3><a name="subject_identity_of_a_topic__si_tr__si_sir_and_si_rr">Subject identity of a Topic - si.tr, si.sir and si.rr</a></h3>
<p><strong>.si.tr</strong>, <strong>.si.sir</strong> and <strong>.si.rr</strong> give the topic <em>subjectIdentity</em> 
as a <strong>string</strong> (xlink:href), and refer respectively to 
<em>topicRef</em>, <em>subjectIndicatorRef</em> or <em>resourceRef</em>:</p>
<pre>
  &lt;topic&gt;.si.tr
  &lt;topic&gt;.si.sir
  &lt;topic&gt;.si.rr</pre>
<p>Example:</p>
<pre>
  $person.si.tr
  $person.si.sir
  $person.si.rr</pre>
<p>
</p>
<h3><a name="occurrences_with_the_type_of_the_occurrence__oc___rd__oc___rr">Occurrences with the type of the occurrence - oc().rd, oc().rr</a></h3>
<p><strong>.oc().rd</strong> and <strong>.oc().rr</strong> give the occurrences of the topic as a 
<strong>string</strong>. The occurrences are respectively <em>resourceData</em> or
<em>resourceRef</em>. However, it also take into account the type (instanceOf) 
of the occurrence - if within the brackets there is a label, it is 
taken as the topic id of the type of the occurrence. If within the
brackets there is a topic variable, it will be set to the type of 
the occurrence. The occurrences are respectively <em>resourceData</em> or 
<em>resourceRef</em>.</p>
<pre>
   &lt;topic&gt;.oc(&lt;topic_varibale&gt;).rd
   &lt;topic&gt;.oc(&lt;topic_varibale&gt;).rr
   &lt;topic&gt;.oc(&lt;topic_id&gt;).rd
   &lt;topic&gt;.oc(&lt;topic_id&gt;).rr</pre>
<p>Example:
</p>
<pre>

   $person.oc('cv').rd
   $person.oc('cv').rr
   $person.oc($type).rd
   $person.oc($type).rr</pre>
<p>$type will hold the type of the occurrence.</p>
<p>
</p>
<h3><a name="instanceof_relationship__type__">instanceOf relationship - <code>type()</code></a></h3>
<p><strong>.type(&lt;level_ref</strong>)&gt; gives a type (<em>instanceOf</em> relationship) of the
topic as a <strong>topic</strong>:</p>
<pre>
  &lt;topic&gt;.type(&lt;level_ref&gt;)</pre>
<p>The type of a topic is a topic by itself.</p>
<p>The <em>level_ref</em> inside the brackets can be a number which gives the 
superclass of that level.</p>
<p>For example, the type of $person topic:</p>
<pre>
  $person.type(0)</pre>
<p>The type of the occurrence of the $person:</p>
<pre>
  $person.oc.type(0)</pre>
<p>The type of the type of $person topic (the type of the superclass of
$person topic):</p>
<pre>
  $person.type(1)</pre>
<p>which is equivalent to:
</p>
<pre>

  $person.type(0).type(0)</pre>
<p>
</p>
<h2><a name="associations">Associations</a></h2>
<p>
</p>
<h3><a name="association___">Association - -&gt;</a></h3>
<p><strong>-&gt;</strong> is the association operator. It provides the ability to
refer to a certain role of certain association:
</p>
<pre>

  &lt;topic_variable_or_topic_id&gt;-&gt;&lt;topic_variable_or_topic_id&gt;</pre>
<p>Where <em>topic_variable_or_topic_id</em> can be a topic variable or a label
which is a topic id. The <em>topic_variable_or_topic_id</em> in the left
represents the <strong>type</strong> of the association, while the right
<em>topic_variable_or_topic_id</em> represents the <em>roleSpec</em>.</p>
<p>The whole argument gives a <strong>topic</strong> which is the topic that plays the
role in that association.</p>
<p>For example,</p>
<p>The location role of the association 'city':</p>
<pre>
  city-&gt;location</pre>
<p>The location role of certain association:</p>
<pre>
  $association-&gt;location</pre>
<p>A certain role of certain association:
</p>
<pre>

  $association-&gt;$role</pre>
<p>The base name of the topic which plays the certain role of the certain
association is:</p>
<pre>
  $association-&gt;$role.bn</pre>
<p>
</p>
<h3><a name="chaining_associations">Chaining Associations</a></h3>
<p>Usually when quering about association, the aim is to find a
connection between topics. For example -</p>
<pre>
                [logical-exchange]-&gt;sender.id = 'motherboard'
            and [logical-exchange]-&gt;receiver = $receiver;</pre>
<p>The target of the above query is to get all the topics that
receive something from the 'motherboard'. However, it is not clear how
the first condition above is linked to the second: The first condition
states that 'motherboard' is the topic id of the topic that plays the
role 'sender' in the association <strong>of type</strong> 'logical-exchange'. The
second condition states that the topic $receiver suppose to play the 
'receiver' role in the association <strong>of type</strong> 'logical-exchange'. But
in no place it is stated that it is the very same association - only
the type of the association is the same. So, $receiver might be
'video-card' which really receives something directly from the
'motherboard', but it can be also 'screen' that is a topic that plays
the 'receiver' role in <strong>other</strong> association <strong>of type</strong> 'logical-exchange'.</p>
<p>This confustion is solved by the chainging rule: <strong>Any association
expression in a statement that has the same <em>topic id</em> or <em>topic
variable</em> as the association type share the same association
object</strong>. So in the above example 'screen' will not play the 'receiver'
role in the association, because it must be <strong>the same</strong> association in
both lines.</p>
<p>If it is not desirable to force that two association expressions will share 
the same association object, we should re-write the above as:</p>
<pre>
                $le-&gt;sender.id = 'motherboard'
            and [logical-exchange]-&gt;receiver = $receiver;
            and $le.id = 'logical-exchange';</pre>
<p>This looks equivalent to the former example, however, here the two
association expressions do not have the same topic id or topic
variable, and therefore they do not have to share the same association
object and therefore  'screen' can play the 'receiver' role in the
association.</p>
<p><em>This rule is an obvious flaw in the language syntax. However the
author could not find a more elegant way to symbolize the association
objects and their interactions - any other way seem to be very
unreadable. However, if the reader has a suggestion for a more elegant 
solution, any <a href="#author">feedback</a> is welcomed.</em></p>
<p>
</p>
<h2><a name="scopes">Scopes</a></h2>
<p>
</p>
<h3><a name="scope___">Scope - @</a></h3>
<p><strong>@</strong> is the scope operator, and it defines the scope of the object to
its left, by a topic id or topic variable on its right:</p>
<pre>
  &lt;scoped_object&gt;@&lt;topic_id&gt;</pre>
<pre>
  &lt;scoped_object&gt;@&lt;topic_variable&gt;</pre>
<p>The possible <em>scoped_object</em>s are base names, occurrences and
associations. The scope comes immedaitly after <strong>bn</strong> and  <strong>oc()</strong>. 
In association, the scope will come just after the topic that
represents the type of the association and before the <strong>-&gt;</strong>
operator.</p>
<p><em>topic_id</em> is a string defines the topic id of the topic that
represents the scope. <em>topic_variable</em> is a topic variable which
represents the scope.</p>
<p>Examples:</p>
<p>The base name of a topic in English</p>
<pre>
  $city.bn@en</pre>
<p>The base name of a topic in a variable scope</p>
<pre>
  $city.bn@$scope</pre>
<p>The resourceData of an English occurrence of a topic</p>
<pre>
  $person.oc($oc)@en.rd</pre>
<p>The type of the occurrence of a topic in certain scope $scope</p>
<pre>
  $person.oc@$scope.type(0)</pre>
<p>The 'whole' role of the association 'part-of' in the scope 'detailed'</p>
<pre>
  part-of@detailed-&gt;whole</pre>
<p>A certain role $role1 of a certain association $association in a
certain scope $scope</p>
<pre>
  $association@$scope-&gt;$role1</pre>
<p>
</p>
<h2><a name="general_statements_syntax">General Statements Syntax</a></h2>
<p>All statements are terminated with the semicolon ';'.</p>
<p>
</p>
<h2><a name="use_statement">USE statement</a></h2>
<p>The <strong>USE</strong> statement is used in order to define which Topic Maps are
queried when no specific Topic Map is defined within the query (using
the <strong>FROM</strong> clause).</p>
<pre>
   use &lt;tm_id_list&gt;;</pre>
<p>where <em>tm_id_list</em> is a comma separated list labels which are Topic Map IDs.</p>
<p>Example:</p>
<pre>
   use computers;</pre>
<p>or</p>
<pre>
   use topicmap1, topicmap2;</pre>
<p>The definition that is done by the <strong>USE</strong> statement is in scope till
other definition is done by an other <strong>USE</strong> statement.</p>
<p>
</p>
<h2><a name="select_statement">SELECT statement</a></h2>
<p>The <strong>SELECT</strong> statement is used in order to presents queries over Topic 
Maps.</p>
<p>The syntax of the <strong>SELECT</strong> statement is as follows:</p>
<pre>
   SELECT &lt;selection&gt; WHERE &lt;search_condition&gt;;</pre>
<p>or</p>
<pre>
   SELECT &lt;selection&gt; FROM &lt;tm_id_list&gt; WHERE &lt;search_condition&gt;;</pre>
<p>
</p>
<h3><a name="the_select_clause_of_the_select_statement">The SELECT clause of the SELECT statement</a></h3>
<p>The SELECT clause of the <strong>SELECT</strong> statement is used to define which 
topics are expected to be retreived. It contains comma separated list
of topic variables that are present in the search condition clause.</p>
<p>
</p>
<h3><a name="the_from_clause_of_the_select_statement">The FROM clause of the SELECT statement</a></h3>
<p>The FROM clause of the <strong>SELECT</strong> statement is used to
define which Topic Maps are queried for that specific query.</p>
<pre>
   FROM &lt;tm_id_list&gt;</pre>
<p>where <em>tm_id_list</em> is a comma separated list labels which are Topic Map IDs.</p>
<p>Example:</p>
<pre>
   from topicmap1, topicmap2</pre>
<p>When the FROM clause is present, the definition made by a preceding
<strong>USE</strong> statement is ignored. When the FROM clause is not present, the
query will be made over the topic maps that were defined in the last
<strong>USE</strong> statement.</p>
<p>
</p>
<h3><a name="the_where_clause">The WHERE clause</a></h3>
<p>The WHERE clause may contain one of the following clauses:</p>
<p>
</p>
<h4><a name="comparison_clause">Comparison clause</a></h4>
<p>Comparison clause consists of two expressions and a comparison sign
between them:</p>
<pre>
   &lt;expression1&gt; &lt;comparison_sign&gt; &lt;expression2&gt;</pre>
<p>An <strong>expression</strong> might be a an expression that is evaluated to a topic
(like topic variable, type, association etc), or expression that is
evaluated to a string (like a quoted string, topic id, a base name,
occurence resourceData or resourceRef, etc).</p>
<p>It is crucial that the two expressions are both evaluated to a topic
or are both evaluated to a string. When using the regular expressions
comparison signs, the two expressions must be evaluated to a string.</p>
<p>A <strong>comparison sign</strong> can be one of the following:</p>
<ul>
<li><strong><a name="item__3d_equal_sign">=    Equal sign</a></strong><br />
</li>
If the two expressions around the equal sign are equal to each other,
the clause is evaluated to be true.
<p>Examples:</p>
<pre>
 # the id of the topic type is 'motherboard'
 $topic.type(0).id = 'motherboard'
  
 # $topic2 is the type of $topic1
 $topic1.type(0) = $topic2</pre>
<p></p>
<li><strong><a name="item__21_3d_non_2dequal_sign">!=   Non-equal sign</a></strong><br />
</li>
If the two expressions around the non-equal sign are different from
each other, the clause is evaluated to be true.
<p>Examples:</p>
<pre>
 # the id of the topic that plays the 'container' role  
 # in the association of type 'in-location' is not 'case'
 [in-location]-&gt;container.id != 'case'
  
 # the topic that plays the 'sender' role in the 
 # association of type 'logical-exchange' is not $sender.
 [logical-exchange]-&gt;sender != $sender</pre>
<p></p>
<li><strong><a name="item__7e_matches_regular_expression_2c_case_sensitive">~    Matches regular expression, case sensitive</a></strong><br />
</li>
A regular expression match operator. Its behaviour is identical to the
behaviour of the same operator in Postgres SQL.
<p>Example:</p>
<pre>
 # the id of $topic starts with the letter c 
 $topic.id ~ '^c';</pre>
<p></p>
<li><strong><a name="item__7e_2a_matches_regular_expression_2c_case_insensit">~*   Matches regular expression, case insensitive</a></strong><br />
</li>
A regular expression match operator. Its behaviour is identical to the
behaviour of the same operator in Postgres SQL.
<p>Example:</p>
<pre>
 # the id of $topic starts with the letter c or C
 $topic.id ~* '^c';</pre>
<p></p>
<li><strong><a name="item__21_7e_does_not_match_regular_expression_2c_case_s">!~   Does not match regular expression, case sensitive</a></strong><br />
</li>
A regular expression match operator. Its behaviour is identical to the
behaviour of the same operator in Postgres SQL.
<p>Example:</p>
<pre>
 # the id of $topic does not start with the letter c 
 $topic.id !~ '^c';</pre>
<p></p>
<li><strong><a name="item__21_7e_2a_does_not_match_regular_expression_2c_cas">!~*  Does not match regular expression, case insensitive</a></strong><br />
</li>
A regular expression match operator. Its behaviour is identical to the
behaviour of the same operator in Postgres SQL.
<p>Example:</p>
<pre>
 # the id of $topic does not start with the letter c or C
 $topic.id !~* '^c';</pre>
<p></p></ul>
<p>
</p>
<h4><a name="exists_clause">EXISTS clause</a></h4>
<p>EXISTS clause consists of an exression (as the expression in the
<a href="#comparison_clause">comparison clause</a>).</p>
<pre>
   exists &lt;expression&gt;</pre>
<p>If the expression exists, the clause is evaluated to be true.</p>
<p>Examples:</p>
<pre>
 # $topic exists
 exists $topic;
 
 # $topic has a basename in scope 'location'
 exists $topic.bn@location;</pre>
<p>
</p>
<h4><a name="not_clause">NOT clause</a></h4>
<p>NOT clause consists one search condition.</p>
<pre>
   not &lt;search_condition&gt;</pre>
<p>If the <em>search_condition</em> is evaluated to be false, the Not clause is
evaluated to be true.</p>
<p>Example:</p>
<pre>
 # $topic does not have a basename in scope 'location'
 not (exists $topic.bn@location);</pre>
<p>
</p>
<h4><a name="and_clause">AND clause</a></h4>
<p>AND clause consists of two search conditions.</p>
<pre>
   &lt;search_condition&gt; and &lt;search_condition&gt;</pre>
<p>If <strong>both</strong> <em>search_condition</em>s are evaluated to be true, the AND clause
is evaluated to be true.</p>
<p>Example:</p>
<pre>
 # $topic has a basename is scope 'location' and is of type 'io-part'
 exists $topic.bn@location and $topic.type(0).id = 'io-part';</pre>
<p>
</p>
<h4><a name="or_clause">OR clause</a></h4>
<p>OR clause consists of two search conditions.</p>
<pre>
   &lt;search_condition&gt; or &lt;search_condition&gt;</pre>
<p>If <strong>one</strong> of the <em>search_condition</em>s is evaluated to be true, the OR clause
is evaluated to be true.</p>
<p>Example:</p>
<pre>
 # $topic has a basename is scope 'location' or is of type 'io-part'
 exists $topic.bn@location or $topic.type(0).id = 'io-part';</pre>
<p>
</p>
<h2><a name="examples">EXAMPLES</a></h2>
<p>
</p>
<h3><a name="the_prototype_implementation">The Prototype Implementation</a></h3>
<p>The following examples are all run on the prototype implementation of
the language. The XTM source is parsed using XML::Parser Perl module
and populate a rational database (Postgres). The <strong>Toma</strong> queries are
parsed by Lex &amp; Yacc (Flex &amp; Bison), and the syntax tree that is
created is then converted to Perl data structure. A Perl module is
implemented to walk that syntax tree, to generate SQL code, to run
that SQL code and to generate the Postgres-like resuslt tables.</p>
<p>As a prototype, many features are not yet implemented. Among them, the
choice between Topic Maps (so the <strong>USE</strong> statement). That means that
the database holds only one Topic Map.</p>
<p>However, the prototype helped to understand better the language that
is needed, and contributed in some features of the language. Apart
from that the prototype demonstrates that the language might be useful
(hopefully, it becomes clear from the examples below), and that it is
quite easy to implement such a language.</p>
<p>In order to make the example clear, a very simple, and very far from
being complete, topic map about computers was created. The XTM of this
topic map can be found in <a href='SAS-Computers-TM.xml'>SAS-Computers-TM.xml</a>.</p>
<p>
</p>
<h3><a name="topics__base_names_and_scopes">Topics, Base Names and Scopes</a></h3>
<ul>
<li><strong><a name="item_all_the_existing_topics_3a">All the existing topics:</a></strong><br />
</li>
<pre>
 select $topic where exists $topic;
 
      topic       
 -----------------
  case            
  close-location  
  contained       
  container       
  device          
  external        
  graphic         
  in-location     
  internal        
  io-part         
  keyboard        
  location        
  logical         
  logical-exchange
  motherboard     
  mouse           
  network-card    
  pc              
  pc-part         
  processing-part 
  processor       
  receiver        
  screen          
  sender          
  sink            
  source          
  structural-part 
  text            
  thermal         
  thermal-exchange
  ventilator1     
  ventilator2     
  video-card      
 (33 rows)</pre>
<li><strong><a name="item_all_the_topics_that_their_base_name_contains_the_l">All the topics that their base name contains the letter 'p'</a></strong><br />
</li>
<pre>
 select $topic where $topic.bn ~ 'p';
 
    topic    
 ------------
  graphic    
  pc         
  processor  
  ventilator1
 (4 rows)</pre>
<li><strong><a name="item_all_the_topics_that_their_base_name_has_scope__27l">All the topics that their base name has scope 'location'</a></strong><br />
</li>
<pre>
 select $topic where exists $topic.bn@location;
 
    topic     
 -------------
  case        
  keyboard    
  motherboard 
  mouse       
  network-card
  pc          
  processor   
  screen      
  ventilator1 
  ventilator2 
  video-card  
 (11 rows)</pre>
<li><strong><a name="item_all_the_topics_that_their_base_name_has_certain_sc">All the topics that their base name has certain scope</a></strong><br />
</li>
<pre>
 select $topic, $scope where exists $topic.bn@$scope;
 
      topic        |  scope   
 ------------------+----------
  case             | location 
  in-location      | contained
  in-location      | container
  keyboard         | location 
  keyboard         | logical  
  logical-exchange | receiver 
  logical-exchange | sender   
  motherboard      | location 
  motherboard      | logical  
  mouse            | location 
  mouse            | logical  
  network-card     | location 
  network-card     | logical  
  pc               | location 
  pc               | logical  
  pc               | thermal  
  processor        | location 
  processor        | logical  
  processor        | thermal  
  screen           | location 
  screen           | logical  
  thermal-exchange | sink     
  thermal-exchange | source   
  ventilator1      | location 
  ventilator1      | thermal  
  ventilator2      | location 
  ventilator2      | thermal  
  video-card       | location 
  video-card       | logical  
  video-card       | thermal  
 (30 rows)</pre>
</ul>
<p>
</p>
<h3><a name="types__instanceof_relationship_">Types (instanceOf relationship)</a></h3>
<ul>
<li><strong><a name="item_topics">All the topics that have parent topics (instanceOf
relationship), and their parents</a></strong><br />
</li>
<pre>
 select $child, $parent where $child.type(0) = $parent;
 
      child       |    parent      
 -----------------+----------------
  case            | structural-part
  io-part         | pc-part        
  keyboard        | io-part        
  motherboard     | processing-part
  mouse           | io-part        
  network-card    | processing-part
  processing-part | pc-part        
  processor       | processing-part
  screen          | io-part        
  structural-part | pc-part        
  ventilator1     | structural-part
  ventilator2     | structural-part
  video-card      | processing-part
 (13 rows)</pre>
<li><strong><a name="item_all_the_topics_that_have_grand_parents_and_their_g">All the topics that have grand parents and their grand parents</a></strong><br />
</li>
<pre>
 select $child, $grand_parent where $child.type(1) = $grand_parent;
 
    child      | grand_parent
 --------------+-------------
  case         | pc-part     
  keyboard     | pc-part     
  motherboard  | pc-part     
  mouse        | pc-part     
  network-card | pc-part     
  processor    | pc-part     
  screen       | pc-part     
  ventilator1  | pc-part     
  ventilator2  | pc-part     
  video-card   | pc-part     
 (10 rows)</pre>
<li><strong><a name="item_all_the_topics_that_have_a_grand_parent">All the topics that have a grand parent</a></strong><br />
</li>
<pre>
 select $child where exists $child.type(1);
 
    child     
 -------------
  case        
  keyboard    
  motherboard 
  mouse       
  network-card
  processor   
  screen      
  ventilator1 
  ventilator2 
  video-card  
 (10 rows)</pre>
<li><strong><a name="item_all_the_topics_that_have_grand_children">All the topics that have grand children</a></strong><br />
</li>
<pre>
 select $grand_parent where $child.type(1) = $grand_parent;
 
  grand_parent
 -------------
  pc-part     
 (1 rows)</pre>
<li><strong><a name="item_all_the_topics_that_are_children_of_the_topic__27i">All the topics that are children of the topic 'io-part'.</a></strong><br />
</li>
<pre>
 select $child where $child.type(0).id = 'io-part';
 
  child   
 ---------
  keyboard
  mouse   
  screen  
 (3 rows)</pre>
<li><strong><a name="item_all_the_topics_that_are_grand_children_of_the_topi">All the topics that are grand children of the topic 'pc-part'
but are not children of 'io-part'</a></strong><br />
</li>
<pre>
 select $child where $child.type(1).id = 'pc-part' 
                 and $child.type(0).id != 'io-part';
 
    child     
 -------------
  case        
  motherboard 
  network-card
  processor   
  ventilator1 
  ventilator2 
  video-card  
 (7 rows)</pre>
</ul>
<p>
</p>
<h3><a name="occurences">Occurences</a></h3>
<ul>
<li><strong><a name="item_all_the_topics_that_have_resourcedata_occurences_2">All the topics that have resourceData occurences, with 
the occurence type.</a></strong><br />
</li>
<pre>
 select $topic, $oc_type where exists $topic.oc($oc_type).rd;
 
    topic      | oc_type
 --------------+--------
  case         | graphic
  case         | text   
  external     | text   
  graphic      | text   
  internal     | text   
  keyboard     | graphic
  keyboard     | text   
  location     | text   
  logical      | text   
  motherboard  | graphic
  motherboard  | text   
  mouse        | graphic
  mouse        | text   
  network-card | graphic
  network-card | text   
  pc           | graphic
  pc           | text   
  processor    | graphic
  processor    | text   
  screen       | graphic
  screen       | text   
  thermal      | text   
  ventilator1  | graphic
  ventilator1  | text   
  ventilator2  | graphic
  ventilator2  | text   
  video-card   | graphic
  video-card   | text   
 (28 rows)</pre>
<li><strong><a name="item_all_the_topics_that_have_resourceref_occurences_2c">All the topics that have resourceRef occurences, with
the occurence type.</a></strong><br />
</li>
<pre>
 select $topic, $oc_type where exists $topic.oc($oc_type).rr;
 
    topic      | oc_type
 --------------+--------
  case         | graphic
  keyboard     | graphic
  motherboard  | graphic
  mouse        | graphic
  network-card | graphic
  pc           | graphic
  processor    | graphic
  screen       | graphic
  ventilator1  | graphic
  ventilator2  | graphic
  video-card   | graphic
 (11 rows)</pre>
<li><strong>All the topics that have resourceRef occurences, and that 
those occurences have also a scope</strong><br />
</li>
<pre>
 select $topic, $oc_type, $scope where exists $topic.oc($oc_type)@$scope.rr;
 
    topic      | oc_type | scope   
 --------------+---------+---------
  case         | graphic | location
  keyboard     | graphic | location
  keyboard     | graphic | logical 
  motherboard  | graphic | location
  motherboard  | graphic | logical 
  mouse        | graphic | location
  mouse        | graphic | logical 
  network-card | graphic | location
  network-card | graphic | logical 
  pc           | graphic | location
  pc           | graphic | logical 
  pc           | graphic | thermal 
  processor    | graphic | location
  processor    | graphic | logical 
  processor    | graphic | thermal 
  screen       | graphic | location
  screen       | graphic | logical 
  ventilator1  | graphic | location
  ventilator1  | graphic | thermal 
  ventilator2  | graphic | location
  ventilator2  | graphic | thermal 
  video-card   | graphic | location
  video-card   | graphic | logical 
  video-card   | graphic | thermal 
 (24 rows)</pre>
<li><strong>All the topics that have resourceRef occurences, but only of
the logical scope.</strong><br />
</li>
<pre>
 select $topic, $oc_type where exists $topic.oc($oc_type)@logical.rr;
 
    topic      | oc_type
 --------------+--------
  keyboard     | graphic
  motherboard  | graphic
  mouse        | graphic
  network-card | graphic
  pc           | graphic
  processor    | graphic
  screen       | graphic
  video-card   | graphic
 (8 rows)</pre>
</ul>
<p>
</p>
<h3><a name="associations">Associations</a></h3>
<ul>
<li><strong><a name="item_which_associations_there_are_and_which_roles_do_th">Which associations there are and which roles do they have</a></strong><br />
</li>
<pre>
 select $association, $role where exists $association-&gt;$role;
 
   association     |  role    
 ------------------+----------
  close-location   | device   
  in-location      | contained
  in-location      | container
  logical-exchange | receiver 
  logical-exchange | sender   
  thermal-exchange | sink     
  thermal-exchange | source   
 (7 rows)</pre>
<li><strong><a name="item_come">Which associations there are, which roles do they have, and in
which scopes they come (will show only associations that have scope,
in our case, all of them).</a></strong><br />
</li>
<pre>
 select $association, $role, $scope where exists $association@$scope-&gt;$role;
 
   association     |  role     | scope   
 ------------------+-----------+---------
  close-location   | device    | location
  in-location      | contained | location
  in-location      | container | location
  logical-exchange | receiver  | logical 
  logical-exchange | sender    | logical 
  thermal-exchange | sink      | thermal 
  thermal-exchange | source    | thermal 
 (7 rows)</pre>
<li><strong><a name="item_all_the_topics_that_play_certain_role_in_certain_a">All the topics that play certain role in certain association
in certain scope, and show them all.</a></strong><br />
</li>
<pre>
 select $topic, $role, $association, $scope
      where $association@$scope-&gt;$role = $topic;
 
    topic      |  role     |  association     | scope   
 --------------+-----------+------------------+---------
  case         | container | in-location      | location
  keyboard     | device    | close-location   | location
  keyboard     | sender    | logical-exchange | logical 
  motherboard  | contained | in-location      | location
  motherboard  | device    | close-location   | location
  motherboard  | receiver  | logical-exchange | logical 
  motherboard  | sender    | logical-exchange | logical 
  mouse        | device    | close-location   | location
  mouse        | sender    | logical-exchange | logical 
  network-card | contained | in-location      | location
  network-card | device    | close-location   | location
  network-card | receiver  | logical-exchange | logical 
  network-card | sender    | logical-exchange | logical 
  processor    | contained | in-location      | location
  processor    | device    | close-location   | location
  processor    | receiver  | logical-exchange | logical 
  processor    | sender    | logical-exchange | logical 
  processor    | source    | thermal-exchange | thermal 
  screen       | device    | close-location   | location
  screen       | receiver  | logical-exchange | logical 
  ventilator1  | contained | in-location      | location
  ventilator1  | device    | close-location   | location
  ventilator1  | sink      | thermal-exchange | thermal 
  ventilator2  | contained | in-location      | location
  ventilator2  | device    | close-location   | location
  ventilator2  | sink      | thermal-exchange | thermal 
  video-card   | contained | in-location      | location
  video-card   | device    | close-location   | location
  video-card   | receiver  | logical-exchange | logical 
  video-card   | sender    | logical-exchange | logical 
  video-card   | source    | thermal-exchange | thermal 
 (31 rows)</pre>
<li><strong><a name="item_which_scopes_we_have_over_associations">Which scopes we have over associations</a></strong><br />
</li>
<pre>
 select $scope where exists $association@$scope-&gt;$role;
 
  scope   
 ---------
  location
  logical 
  thermal 
 (3 rows)</pre>
<li><strong><a name="item_show_the_associations_in_scope__27location_27">Show the associations in scope 'location'</a></strong><br />
</li>
<pre>
 select $topic1, $role1, $association, $topic2, $role2
                 where $association@location-&gt;$role1 = $topic1
                   and $association@location-&gt;$role2 = $topic2
                   and $topic1 != $topic2;
 
    topic1     |  role1    | association    |   topic2     |  role2   
 --------------+-----------+----------------+--------------+----------
  case         | container | in-location    | motherboard  | contained
  case         | container | in-location    | network-card | contained
  case         | container | in-location    | processor    | contained
  case         | container | in-location    | ventilator1  | contained
  case         | container | in-location    | ventilator2  | contained
  case         | container | in-location    | video-card   | contained
  keyboard     | device    | close-location | mouse        | device   
  keyboard     | device    | close-location | screen       | device   
  motherboard  | contained | in-location    | case         | container
  motherboard  | device    | close-location | network-card | device   
  motherboard  | device    | close-location | processor    | device   
  motherboard  | device    | close-location | video-card   | device   
  mouse        | device    | close-location | keyboard     | device   
  mouse        | device    | close-location | screen       | device   
  network-card | contained | in-location    | case         | container
  network-card | device    | close-location | motherboard  | device   
  network-card | device    | close-location | video-card   | device   
  processor    | contained | in-location    | case         | container
  processor    | device    | close-location | motherboard  | device   
  processor    | device    | close-location | ventilator1  | device   
  screen       | device    | close-location | keyboard     | device   
  screen       | device    | close-location | mouse        | device   
  ventilator1  | contained | in-location    | case         | container
  ventilator1  | device    | close-location | processor    | device   
  ventilator2  | contained | in-location    | case         | container
  ventilator2  | device    | close-location | video-card   | device   
  video-card   | contained | in-location    | case         | container
  video-card   | device    | close-location | motherboard  | device   
  video-card   | device    | close-location | network-card | device   
  video-card   | device    | close-location | ventilator2  | device   
 (30 rows)</pre>
<li><strong><a name="item_show_the_associations_in_scope__27logical_27">Show the associations in scope 'logical'</a></strong><br />
</li>
<pre>
 select $topic1, $role1, $association, $topic2, $role2
                 where $association@logical-&gt;$role1 = $topic1
                   and $association@logical-&gt;$role2 = $topic2
                   and $topic1 != $topic2;
 
    topic1     | role1    |  association     |   topic2     | role2   
 --------------+----------+------------------+--------------+---------
  keyboard     | sender   | logical-exchange | motherboard  | receiver
  motherboard  | receiver | logical-exchange | keyboard     | sender  
  motherboard  | receiver | logical-exchange | mouse        | sender  
  motherboard  | receiver | logical-exchange | network-card | sender  
  motherboard  | receiver | logical-exchange | processor    | sender  
  motherboard  | sender   | logical-exchange | network-card | receiver
  motherboard  | sender   | logical-exchange | processor    | receiver
  motherboard  | sender   | logical-exchange | video-card   | receiver
  mouse        | sender   | logical-exchange | motherboard  | receiver
  network-card | receiver | logical-exchange | motherboard  | sender  
  network-card | sender   | logical-exchange | motherboard  | receiver
  processor    | receiver | logical-exchange | motherboard  | sender  
  processor    | sender   | logical-exchange | motherboard  | receiver
  screen       | receiver | logical-exchange | video-card   | sender  
  video-card   | receiver | logical-exchange | motherboard  | sender  
  video-card   | sender   | logical-exchange | screen       | receiver
 (16 rows)</pre>
<li><strong><a name="item_show_the_associations_in_scope__27thermal_27">Show the associations in scope 'thermal'</a></strong><br />
</li>
<pre>
 select $topic1, $role1, $association, $topic2, $role2
                 where $association@thermal-&gt;$role1 = $topic1
                   and $association@thermal-&gt;$role2 = $topic2
                   and $topic1 != $topic2;
 
   topic1     | role1  |  association     |  topic2     | role2 
 -------------+--------+------------------+-------------+-------
  processor   | source | thermal-exchange | ventilator1 | sink  
  ventilator1 | sink   | thermal-exchange | processor   | source
  ventilator2 | sink   | thermal-exchange | video-card  | source
  video-card  | source | thermal-exchange | ventilator2 | sink  
 (4 rows)</pre>
<li><strong><a name="item_all_the_devices_that_sends_data_to_the_motherboard">All the devices that sends data to the motherboard</a></strong><br />
</li>
<pre>
 select $topic where [logical-exchange]-&gt;sender = $topic
                 and [logical-exchange]-&gt;receiver.id = 'motherboard';
 
    topic     
 -------------
  keyboard    
  mouse       
  network-card
  processor   
 (4 rows)</pre>
<li><strong>All the devices that sends data to the motherboard that
are I/O parts</strong><br />
</li>
<pre>
 select $topic where [logical-exchange]-&gt;sender = $topic
                 and [logical-exchange]-&gt;receiver.id = 'motherboard'
                 and $topic.type(0) = 'io-part';
 
  topic   
 ---------
  keyboard
  mouse   
 (2 rows)</pre>
<li><strong><a name="item_all_the_devices_that_sends_data_to_other_device_th">All the devices that sends data to other device that
sends data to the processor.</a></strong><br />
</li>
<pre>
 select $topic where [logical-exchange]-&gt;sender = $topic
                 and [logical-exchange]-&gt;receiver = $middle
                 and $association-&gt;sender = $middle
                 and $association-&gt;receiver.id = 'processor'
                 and $association.id = 'logical-exchange';
 
    topic     
 -------------
  keyboard    
  mouse       
  network-card
  processor   
 (4 rows)</pre>
<pre>
 
Note that in this example we use the L&lt;chaining rule|/&quot;Chaining
Associations&quot;&gt;, which is the reason for using the topic variable
I&lt;$association&gt;.</pre>
<li><strong><a name="item_all_the_devices_that_send_data_to_the_motherboard_">All the devices that send data to the motherboard and are
contained within the case.</a></strong><br />
</li>
<pre>
 select $topic where [logical-exchange]-&gt;sender = $topic
                 and [logical-exchange]-&gt;receiver.id = 'motherboard'
                 and [in-location]-&gt;contained = $topic
                 and [in-location]-&gt;container.id = 'case';
 
    topic     
 -------------
  network-card
  processor   
 (2 rows)</pre>
<li><strong><a name="item_how_are_the_video_card_and_the_motherboard_associa">How are the video card and the motherboard associated?</a></strong><br />
</li>
<pre>
 select $association, $motherboard_role, $video_card_role
               where $association-&gt;$motherboard_role.id = 'motherboard'
                 and $association-&gt;$video_card_role.id = 'video-card';
 
   association     | motherboard_role | video_card_role
 ------------------+------------------+----------------
  close-location   | device           | device         
  logical-exchange | sender           | receiver       
 (2 rows)</pre>
<li><strong>How are the video card and the motherboard associated in the
logical scope only?</strong><br />
</li>
<pre>
 select $association, $motherboard_role, $video_card_role 
            where $association@logical-&gt;$motherboard_role.id = 'motherboard'
              and $association@logical-&gt;$video_card_role.id = 'video-card';
 
   association     | motherboard_role | video_card_role
 ------------------+------------------+----------------
  logical-exchange | sender           | receiver       
 (1 rows)</pre>
<li><strong><a name="item_what_is_inside_the_case">What is inside the case</a></strong><br />
</li>
<pre>
 select $topic where [in-location]-&gt;contained = $topic 
                 and [in-location]-&gt;container.id = 'case';
 
    topic     
 -------------
  motherboard 
  network-card
  processor   
  ventilator1 
  ventilator2 
  video-card  
 (6 rows)</pre>
<li><strong><a name="item_to_what_the_motherboard_is_associated_in_the_diffe">To what the motherboard is associated in the different scopes</a></strong><br />
</li>
<pre>
 select $topic, $role2, $association, $scope 
                where $association@$scope-&gt;$role1 = 'motherboard'
                  and $association@$scope-&gt;$role2 = $topic
                  and $role1 != $role2;
 
    topic      |  role2    |  association     | scope   
 --------------+-----------+------------------+---------
  case         | container | in-location      | location
  keyboard     | sender    | logical-exchange | logical 
  mouse        | sender    | logical-exchange | logical 
  network-card | receiver  | logical-exchange | logical 
  network-card | sender    | logical-exchange | logical 
  processor    | receiver  | logical-exchange | logical 
  processor    | sender    | logical-exchange | logical 
  video-card   | receiver  | logical-exchange | logical 
 (8 rows)</pre>
</ul>
<p>
</p>
<h2><a name="missing_features">Missing Features</a></h2>
<p>Although the language might be already useful in many cases, there are
many missing features that should be added to it in the future. Among
those features are:</p>
<ul>
<li><strong><a name="item_order_by_clause">ORDER BY clause</a></strong><br />
</li>
Example:
<pre>
 select $child, $parent 
    where $child.type(0) = $parent 
    order by child.bn, parent.bn;</pre>
<p></p>
<li><strong><a name="item_different_functions_like_the_existing_functions_in">Different functions like the existing functions in SQL</a></strong><br />
</li>
This will probably be only string functions.
<p></p></ul>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Rani Pinchuk, &lt;<a href="mailto:rani.pinchuk@spaceapplications.com">rani.pinchuk@spaceapplications.com</a>&gt;

</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright (C) 2004 by Space Applications Services

</p>

</body>

</html>

--=-lQFFCVwI4y3Q74wS0NA2
Content-Disposition: attachment; filename=style.css
Content-Type: text/css; name=style.css; charset=UTF-8
Content-Transfer-Encoding: 7bit

BODY {
  background: white;
  color: black;
  font-family: arial,sans-serif;
  margin: 0;
  padding: 1ex;
}

TABLE {
  border-collapse: collapse;
  border-spacing: 0;
  border-width: 0;
  color: inherit;
}

IMG { border: 0; }
FORM { margin: 0; }
input { margin: 2px; }

A.fred {
  text-decoration: none;
}

A:link, A:visited {
  background: transparent;
  color: #006699;
}

A[href="#POD_ERRORS"] {
  background: transparent;
  color: #FF0000;
}

TD {
  margin: 0;
  padding: 0;
}

DIV {
  border-width: 0;
}

DT {
  margin-top: 1em;
}

.credits TD {
  padding: 0.5ex 2ex;
}

.huge {
  font-size: 32pt;
}

.s {
  background: #dddddd;
  color: inherit;
}

.s TD, .r TD {
  padding: 0.2ex 1ex;
  vertical-align: baseline;
}

TH {
  background: #bbbbbb;
  color: inherit;
  padding: 0.4ex 1ex;
  text-align: left;
}

TH A:link, TH A:visited {
  background: transparent;
  color: black;
}

.box {
  border: 1px solid #006699;
  margin: 1ex 0;
  padding: 0;
}

.distfiles TD {
  padding: 0 2ex 0 0;
  vertical-align: baseline;
}

.manifest TD {
  padding: 0 1ex;
  vertical-align: top;
}

.l1 {
  font-weight: bold;
}

.l2 {
  font-weight: normal;
}

.t1, .t2, .t3, .t4  {
  background: #006699;
  color: white;
}
.t4 {
  padding: 0.2ex 0.4ex;
}
.t1, .t2, .t3  {
  padding: 0.5ex 1ex;
}

/* IE does not support  .box>.t1  Grrr */
.box .t1, .box .t2, .box .t3 {
  margin: 0;
}

.t1 {
  font-size: 1.4em;
  font-weight: bold;
  text-align: center;
}

.t2 {
  font-size: 1.0em;
  font-weight: bold;
  text-align: left;
}

.t3 {
  font-size: 1.0em;
  font-weight: normal;
  text-align: left;
}

/* width: 100%; border: 0.1px solid #FFFFFF; */ /* NN4 hack */

.datecell {
  text-align: center;
  width: 17em;
}

.cell {
  padding: 0.2ex 1ex;
  text-align: left;
}

.label {
  background: #aaaaaa;
  color: black;
  font-weight: bold;
  padding: 0.2ex 1ex;
  text-align: right;
  white-space: nowrap;
  vertical-align: baseline;
}

.categories {
  border-bottom: 3px double #006699;
  margin-bottom: 1ex;
  padding-bottom: 1ex;
}

.categories TABLE {
  margin: auto;
}

.categories TD {
  padding: 0.5ex 1ex;
  vertical-align: baseline;
}

.path A {
  background: transparent;
  color: #006699;
  font-weight: bold;
}

.pages {
  background: #dddddd;
  color: #006699;
  padding: 0.2ex 0.4ex;
}

.path {
  background: #dddddd;
  border-bottom: 1px solid #006699;
  color: #006699;
 /*  font-size: 1.4em;*/
  margin: 1ex 0;
  padding: 0.5ex 1ex;
}

.menubar TD {
  background: #006699;
  color: white;
}

.menubar {
  background: #006699;
  color: white;
  margin: 1ex 0;
  padding: 1px;
}

.menubar .links     {
  background: transparent;
  color: white;
  padding: 0.2ex;
  text-align: left;
}

.menubar .searchbar {
  background: black;
  color: black;
  margin: 0px;
  padding: 2px;
  text-align: right;
}

A.m:link, A.m:visited {
  background: #006699;
  color: white;
  font: bold 10pt Arial,Helvetica,sans-serif;
text-decoration: none;
}

A.o:link, A.o:visited {
  background: #006699;
  color: #ccffcc;
  font: bold 10pt Arial,Helvetica,sans-serif;
text-decoration: none;
}

A.o:hover {
  background: transparent;
  color: #ff6600;
  text-decoration: underline;
}

A.m:hover {
  background: transparent;
  color: #ff6600;
  text-decoration: underline;
}

table.dlsip     {
  background: #dddddd;
  border: 0.4ex solid #dddddd;
}

PRE     {
  background: #eeeeee;
  border: 1px solid #888888;
  color: black;
  padding: 1em;
  white-space: pre;
}

H1      {
  background: transparent;
  color: #006699;
  font-size: +4;
}

H2      {
  background: transparent;
  color: #006699;
  font-size: +3;
}

H3      {
  background: transparent;
  color: #006699;
  font-size: +2;
}

H4      {
  background: transparent;
  color: #006699;
  font-size: +1;
}


IMG     {
  vertical-align: top;
}

.toc A  {
  text-decoration: none;
}

.toc LI {
  line-height: 1.2em;
  list-style-type: none;
}

.faq DT {
  font-size: 1.4em;
  font-weight: bold;
}

.chmenu {
  background: black;
  color: red;
  font: bold 1.1em Arial,Helvetica,sans-serif;
  margin: 1ex auto;
  padding: 0.5ex;
}

.chmenu TD {
  padding: 0.2ex 1ex;
}

.chmenu A:link, .chmenu A:visited  {
  background: transparent;
  color: white;
  text-decoration: none;
}

.chmenu A:hover {
  background: transparent;
  color: #ff6600;
  text-decoration: underline;
}

.column {
  padding: 0.5ex 1ex;
  vertical-align: top;
}

.datebar {
  margin: auto;
  width: 14em;
}

.date {
  background: transparent;
  color: #008000;
}


--=-lQFFCVwI4y3Q74wS0NA2--