/ doc / views /
/doc/views/focal_events.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE para PUBLIC "-//OASIS//DTD DocBook XML 5.0//EN"
3 "http://www.oasis-open.org/docbook/xml/5.0/dtd/docbook.dtd" [
4 <!-- Use symbols for repeating text. -->
5 <!ENTITY % entities SYSTEM "../entities">
6 %entities;
7 <!ENTITY % constants SYSTEM "../constants">
8 %constants;
9 ]>
10 <!-- Copyright (C) 2013, 2018 The Meme Factory, Inc. http://www.meme.com
11 - Copyright (C) 2005, 2007, 2010 Karl O. Pinc <kop@meme.com> and others
12 - See document output for full copyright information. -->
13
14 <!-- Core documentation on the FOCAL_EVENTS view.
15
16 - This is indeed the query that makes the view, so don't break it!
17
18 - The "code" element must have a 'role="view"' attribute
19 - so that Gombe-MI code generation can get the code
20 - and actually make the view!
21 -->
22
23 <para xmlns="http://docbook.org/ns/docbook"
24 version="5.0">
25
26 <figure xml:id="focal_events-code">
27 <title>Query Defining the FOCAL_EVENTS View</title>
28 <literallayout>
29 <code role="view">SELECT events.eid AS eid
30 , events.intid AS intid
31 , focals.pid AS focalpid
32 , otherpart.pid AS otherpid
33 , events.behavior AS behavior
34 , events.position AS position
35 , events.uncertain AS uncertain
36 , followparts.role AS focalrole
37 , focals.participant AS focal
38 , focals.part AS focalpart
39 , CASE
40 WHEN events.baboon THEN
41 'gmi_nonfocal'
42 ELSE
43 followrole(intervals.followid, otherpart.participant)
44 END AS otherrole
45 , otherpart.participant AS other
46 , CASE
47 WHEN events.baboon THEN
48 CASE
49 WHEN focals.part = 'gmi_actor' THEN
50 'gmi_actee'
51 WHEN focals.part = 'gmi_actee' THEN
52 'gmi_actor'
53 ELSE
54 'gmi_participant'
55 END::parts_part
56 ELSE
57 otherpart.part
58 END AS otherpart
59 , events.baboon AS baboon
60 , events.comment AS comment
61 FROM events
62 JOIN intervals
63 ON (intervals.intid = events.intid)
64 JOIN followparts
65 ON (followparts.followid = intervals.followid)
66 JOIN chimpids AS fp_ids
67 ON (fp_ids.chimpid = followparts.chimpid)
68 JOIN parts AS focals
69 ON (focals.eid = events.eid)
70 JOIN chimpids AS focal_ids
71 ON (focal_ids.chimpid = focals.participant)
72 LEFT OUTER JOIN parts AS otherpart
73 ON (otherpart.eid = events.eid
74 AND focals.pid IS DISTINCT FROM otherpart.pid)
75 WHERE focal_ids.animid = fp_ids.animid</code><code>;</code></literallayout>
76 </figure>
77
78 <!-- Figure containing FOCAL_EVENTS view diagram. -->
79
80 <!-- Use mediaobject role attribute to select either xhtml (html)
81 or pdf (dblatex) file paths. -->
82
83 <figure xml:id="focal_events-erd">
84 <title>Entity Relationship Diagram of the FOCAL_EVENTS View</title>
85 <mediaobject>
86 <imageobject role="html">
87 <imagedata scalefit="1" width="6in"
88 fileref="/doc/diagrams/focal_events.png" format="PNG" />
89 </imageobject>
90 <imageobject role="dblatex">
91 <imagedata scalefit="1" width="6in"
92 fileref="/diagrams/focal_events.eps" format="EPS" />
93 </imageobject>
94
95 <textobject> <phrase>If we could we would display here the
96 diagram showing how the FOCAL_EVENTS view is constructed.</phrase>
97 </textobject>
98 </mediaobject>
99 </figure>
100 </para>
101 <!--
102 Local Variables:
103 mode: xml
104 End:
105 -->