Composition operator: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Linas
 
en>Mark viking
Added wl
Line 1: Line 1:
Greetings! I am Marvella and I really feel comfortable when individuals use the complete title. South Dakota is where I've always been living. One of the issues she enjoys most is to study comics and she'll be beginning something else alongside with it. Hiring is my occupation.<br><br>Feel free to visit my website - [http://nemoonehfilm.ir/index.php?do=/profile-6876/info/ over the counter std test]
{{About|relational algebra|other uses of the term "projection"|Projection (disambiguation)}}
{{Expert-subject|Mathematics|date=February 2009}}
In [[relational algebra]], a '''projection''' is a [[unary operation]] written as <math>\Pi_{a_1, ...,a_n}( R )</math> where <math>a_1,...,a_n</math> is a set of attribute names. The result of such projection is defined as the [[Set (mathematics)|set]] obtained when the components of the [[tuple]] <math>R</math> are restricted to the set <math>\{a_1,...,a_n\}</math> – it ''discards'' (or ''excludes'') the other attributes.<ref>http://www.cs.rochester.edu/~nelson/courses/csc_173/relations/algebra.html</ref>
 
In practical terms, it can be roughly thought of as picking a sub-set of all available columns. For example, if the attributes are (name, age), then projection of the relation {(Alice, 5), (Bob, 8)} onto attribute list (age) yields {5,8} – we have discarded the names, and only know what ages are present.
 
 
In addition, projection can be used to modify an attribute's value: if relation R has attributes a, b, and c, and b is a number, then
<math>\Pi_{a,\ b * 0.5,\  c}( R )</math>
will return a relation nearly the same as R, but with all values for 'b' shrunk by half. <ref>http://www.csee.umbc.edu/~pmundur/courses/CMSC661-02/rel-alg.pdf ''See Problem 3.8.B on page 3''</ref>
 
 
==Related concepts==
The closely related concept in [[set theory]] (see: [[projection (set theory)]]) differs from that of [[relational algebra]] in that, in set theory, one projects onto ordered components, not onto attributes. For instance, projecting <math>(3,7)</math> onto the second component yields 7.
 
Projection is relational algebra's counterpart of [[existential quantification]] in [[first-order logic|predicate logic]]. The attributes ''not'' included correspond to existentially quantified variables in the predicate whose [[extension (predicate logic)|extension]] the operand relation represents. The example below illustrates this point.
 
Because of the correspondence with existential quantification, some authorities prefer to define projection in terms of the excluded attributes. In a computer language it is of course possible to provide notations for both, and that was done in [[ISBL]] and several languages that have taken their cue from ISBL.
 
A nearly identical concept occurs in the category of [[monoid]]s, called a [[string projection]], which consists of removing all of the letters in the [[string (computer science)|string]] that do not belong to a given [[alphabet]].
 
==Example==
For an example, consider the relations depicted in the following two tables which are the relation <math>Person</math> and its projection on (some say "over") the attributes <math>Age</math> and <math>Weight</math>:
 
{| border="0" cellpadding="0" cellspacing="20" align="center"
|-
! <math>Person</math>
! <math>\Pi_{Age,Weight}(Person)</math>
|- style="vertical-align: top"
|
{| align="center" border="0" cellpadding="10" cellspacing="0" style="border-collapse: collapse; border: 1px solid black"
|- style="background-color: silver; text-align: left"
! style="border: 1px solid black" width="34%" | Name
! style="border: 1px solid black" width="33%" | Age
! style="border: 1px solid black" width="33%" | Weight
|-
| style="border: 1px solid black" | Harry
| style="border: 1px solid black" | 34
| style="border: 1px solid black" | 180
|-
| style="border: 1px solid black" | Sally
| style="border: 1px solid black" | 28
| style="border: 1px solid black" | 164
|-
| style="border: 1px solid black" | George
| style="border: 1px solid black" | 29
| style="border: 1px solid black" | 170
|-
| style="border: 1px solid black" | Helena
| style="border: 1px solid black" | 54
| style="border: 1px solid black" | 154
|-
| style="border: 1px solid black" | Peter
| style="border: 1px solid black" | 34
| style="border: 1px solid black" | 180
|}
|
{| align="center" border="0" cellpadding="10" cellspacing="0" style="border-collapse: collapse; border: 1px solid black"
|- style="background-color: silver; text-align: left"
! style="border: 1px solid black" width="50%" | Age
! style="border: 1px solid black" width="50%" | Weight
|-
| style="border: 1px solid black" | 34
| style="border: 1px solid black" | 180
|-
| style="border: 1px solid black" | 28
| style="border: 1px solid black" | 164
|-
| style="border: 1px solid black" | 29
| style="border: 1px solid black" | 170
|-
| style="border: 1px solid black" | 54
| style="border: 1px solid black" | 154
|-
|}
|}
 
Suppose the predicate of Person is "''Name'' is ''age'' years old and weighs ''weight''." Then the given projection represents the predicate, "There exists ''Name'' such that ''Name'' is ''age'' years old and weighs ''weight''."
 
Note that Harry and Peter have the same age and weight, but since the result is a relation, and therefore a set, this combination only appears once in the result.
 
More formally the semantics of projection are defined as follows:
 
: <math>\Pi_{a_1, ...,a_n}( R ) = \{  \ t[a_1,...,a_n] : \ t \in R \ \}</math>
 
where <math>t[a_1,...,a_n]</math> is the [[restriction (mathematics)|restriction]] of the tuple <math>t</math> to the set <math>\{a_1,...,a_n\}</math> so that
 
: <math>t[a_1,...,a_n] = \{ \ ( a', v ) \ | \ ( a', v ) \in t, \ a' \in a_1,...,a_n \ \}</math>
 
The result of a projection <math>\Pi_{a_1, ...,a_n}( R )</math> is defined only if <math>\{a_1,...,a_n\}</math> is a [[subset]] of the [[:wikt:heading|header]] of <math>R</math>.
 
It is interesting to note that projection over no attributes at all is possible, yielding a relation of degree zero. In this case the cardinality of the result is zero if the operand is empty, otherwise one. The two relations of degree zero are the only ones that cannot be depicted as tables.
 
==See also==
* [[Projection (set theory)]]
* [[Extended projection]]
 
==References==
{{reflist}}
 
{{DEFAULTSORT:Projection (Relational Algebra)}}
[[Category:Relational algebra]]
 
[[ru:Алгебра Кодда#Проекция]]

Revision as of 05:10, 11 January 2014

29 yr old Orthopaedic Surgeon Grippo from Saint-Paul, spends time with interests including model railways, top property developers in singapore developers in singapore and dolls. Finished a cruise ship experience that included passing by Runic Stones and Church. Template:Expert-subject In relational algebra, a projection is a unary operation written as Πa1,...,an(R) where a1,...,an is a set of attribute names. The result of such projection is defined as the set obtained when the components of the tuple R are restricted to the set {a1,...,an} – it discards (or excludes) the other attributes.[1]

In practical terms, it can be roughly thought of as picking a sub-set of all available columns. For example, if the attributes are (name, age), then projection of the relation {(Alice, 5), (Bob, 8)} onto attribute list (age) yields {5,8} – we have discarded the names, and only know what ages are present.


In addition, projection can be used to modify an attribute's value: if relation R has attributes a, b, and c, and b is a number, then Πa,b*0.5,c(R) will return a relation nearly the same as R, but with all values for 'b' shrunk by half. [2]


Related concepts

The closely related concept in set theory (see: projection (set theory)) differs from that of relational algebra in that, in set theory, one projects onto ordered components, not onto attributes. For instance, projecting (3,7) onto the second component yields 7.

Projection is relational algebra's counterpart of existential quantification in predicate logic. The attributes not included correspond to existentially quantified variables in the predicate whose extension the operand relation represents. The example below illustrates this point.

Because of the correspondence with existential quantification, some authorities prefer to define projection in terms of the excluded attributes. In a computer language it is of course possible to provide notations for both, and that was done in ISBL and several languages that have taken their cue from ISBL.

A nearly identical concept occurs in the category of monoids, called a string projection, which consists of removing all of the letters in the string that do not belong to a given alphabet.

Example

For an example, consider the relations depicted in the following two tables which are the relation Person and its projection on (some say "over") the attributes Age and Weight:

Person ΠAge,Weight(Person)
Name Age Weight
Harry 34 180
Sally 28 164
George 29 170
Helena 54 154
Peter 34 180
Age Weight
34 180
28 164
29 170
54 154

Suppose the predicate of Person is "Name is age years old and weighs weight." Then the given projection represents the predicate, "There exists Name such that Name is age years old and weighs weight."

Note that Harry and Peter have the same age and weight, but since the result is a relation, and therefore a set, this combination only appears once in the result.

More formally the semantics of projection are defined as follows:

Πa1,...,an(R)={t[a1,...,an]:tR}

where t[a1,...,an] is the restriction of the tuple t to the set {a1,...,an} so that

t[a1,...,an]={(a,v)|(a,v)t,aa1,...,an}

The result of a projection Πa1,...,an(R) is defined only if {a1,...,an} is a subset of the header of R.

It is interesting to note that projection over no attributes at all is possible, yielding a relation of degree zero. In this case the cardinality of the result is zero if the operand is empty, otherwise one. The two relations of degree zero are the only ones that cannot be depicted as tables.

See also

References

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

ru:Алгебра Кодда#Проекция