# Re: Understanding some issues on the denotational semantics

```I guess what screws me up all the time is that the notation always reminds me of what I was trained namely that {...} is a set, and f:A->B is a function between sets. But these are not sets, these are types, and that is what makes it difficult for me. I guess this is the difference between the mathematician (that I was trained for) and a computer scientists (that you guys are...)

I will have to look at this again... tomorrow!

Cheers

Ivan

On Feb 18, 2011, at 18:04 , Eric Prud'hommeaux wrote:

> * Ivan Herman <ivan@w3.org> [2011-02-18 17:49+0100]
>>
>> On Feb 18, 2011, at 17:32 , Eric Prud'hommeaux wrote:
>>
>>> * Ivan Herman <ivan@w3.org> [2011-02-18 11:40+0100]
>>>> Alex,
>>>>
>>>>
>>>> On Feb 17, 2011, at 16:18 , Alexandre Bertails wrote:
>>>>
>>>> [snip]
>>>>>
>>>>> Sorry, I did not understand your comment this way as I think that the
>>>>>
>>>>>> But does that specification means that for every table t, primaryKey(t) will give me a set s=primaryKey(t) where size(s)<=1? Ie, that, for every table, the primaryKey is either empty or restricted to one single column? That is the discrepancy with section 2.2 that explicitly speaks about multi-column primary keys...
>>>>>
>>>>>> From you comment:
>>>>> s/the primaryKey is either empty or restricted to one single column/the primaryKey is either empty or restricted to one single CandidateKey/
>>>>>
>>>>
>>>> Sorry, right
>>>>
>>>>> So primaryKey's type tells you that primaryKey gives you either 0 or 1
>>>>> CandidateKey. The definition for CandidateKey is
>>>>> [[
>>>>> CandidateKey ::= List(ColumnName)
>>>>> ]]
>>>>>
>>>>> So you do have multi-columns for a Primary Key (if there is one).
>>>>>
>>>>> Am I getting it right? I may be not introducing this one the right way.
>>>>>
>>>>
>>>> I think I get it now but... why do I need this? Why not define
>>>>
>>>> primaryKey : Table → CandidateKey
>>>
>>> I think this would say there is exactly one primary key per table.
>>
>> Hm. Indeed, one primary key, though that primary key would consist, possibly, of several columns. Isn't this what we want? I am really confused:-(
>
> What we want is zero or one primary key with 1 or more columns, which I believe is captured by
>
>  candidateKeys : Table → {l:List(CandidateKey)  |  size(l) ≥ 1}
>  primaryKey    : Table → {s:Set(CandidateKey)  |  size(s) ≤ 1}
>
> (I added a size constraint on CandidateKey and note that a Set of 0 or 1 is the same as a List of 0 or 1.)
>
>> Ivan
>>
>>
>>>
>>>> or is a List necessarily non-empty, ie,
>>>>
>>>> CandidateKey ::= List(ColumnName)
>>>>
>>>> means that there _is_ at least one column (ie, the no primary Key alternative would not be covered?)
>>>
>>> I read this as saying there are 0 or more primary keys, and, including the specification "size(s) ≤ 1" gives us 0 or 1 primary keys, modelling an optional without inventing a new type.
>>>
>>>> Ivan
>>>>
>>>> ----
>>>> Ivan Herman, W3C Semantic Web Activity Lead
>>>> Home: http://www.w3.org/People/Ivan/
>>>> mobile: +31-641044153
>>>> PGP Key: http://www.ivan-herman.net/pgpkey.html
>>>> FOAF: http://www.ivan-herman.net/foaf.rdf
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> -ericP
>>
>>
>> ----
>> Ivan Herman, W3C Semantic Web Activity Lead
>> Home: http://www.w3.org/People/Ivan/
>> mobile: +31-641044153
>> PGP Key: http://www.ivan-herman.net/pgpkey.html
>> FOAF: http://www.ivan-herman.net/foaf.rdf
>>
>>
>>
>>
>>
>
>
>
> --
> -ericP

----
Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
mobile: +31-641044153
PGP Key: http://www.ivan-herman.net/pgpkey.html
FOAF: http://www.ivan-herman.net/foaf.rdf
```

Received on Friday, 18 February 2011 17:44:54 UTC