Re: [External] The Joy of NULLs (not)

Hi all,

QINL is simply the name we gave to a common phenomenon in dependent type theories, which is that you can usefully represent sets as dependent types, instead of as terms.  That has both positive and negative implications.  It's possible that Dotty's (upcoming Scala's) type system may support QINL, and similarly for Dependent Haskell.  Once you represent sets as dependent types, you can e.g. manipulate them using Coq tactics: https://www.wisnesky.net/dbpl15.pdf ("Using Dependent Types and Tactics to Enable Semantic Optimization of Language-Integrated Queries") and https://homes.cs.washington.edu/~chushumo/files/cosette_pldi17.pdf ("Homotopy Type Theory SQL: Proving Query Rewrites with Univalent SQL Semantics").  Although both QINL and LINQ are most naturally described using category theory, conceptually they are about how collections are represented in type theory.  

In our work on the categorical query language CQL (http://categoricaldata.net), our notion of schema includes equationally-defined constraints, sufficient to encode arbitrary behavior as functional programs (e.g., there is a CQL schema for SK combinatory logic).  This is enabled by CQL's underlying categorical semantics and can be implemented in QINL style, although there's no need to do so.

Henry alluded to the status of blank nodes in RDF, a question answered using the language of category theory in the Ph.D. thesis of Braatz : https://pdfs.semanticscholar.org/b8c8/5a3e7a04020259ec9a58c7e5563033f52844..pdf , presumably in a way equivalent to their intended set-theoretic semantics.  That thesis also contains a variety of constructions on RDF graphs such as "pushouts" that may or may not be known or useful to the RDF community, but whose analogs in other data models are known to be useful for data integration.  So I wanted to take this opportunity to ask around to see if anyone was interested in further investigating categorical constructions for RDF.

Ryan

> On Aug 29, 2019, at 6:37 AM, Henry Story <henry.story@bblfish.net> wrote:
> 
> 
> 
>> On 26 Aug 2019, at 16:26, Steffen Staab <staab@uni-koblenz.de> wrote:
>> 
>> Dear Henry,
>> 
>> the pointers below seem to be really useful to us.
>> The work on CQL and QINL seems to be very related to our papers
>> 
>> ISWC2019: https://arxiv.org/abs/1907.00855
>> Programming 2019: https://arxiv.org/abs/1902.00545
>> 
>> where we use ontology concepts as well as queries as types in 
>> programming languages.
> 
> That last one is a very interesting article linking Scala
> and SPARQL. I completely agree with the described 
> limitations of banana-rdf. 
> 
> This problem of how RDF and Scala fit together has been
> something that has bugged me for a while. Because of the
> strong presence of Functional Programmers in the Scala
> community I have been lead to look at Category Theory
> to look for an answer.  
> 
> Your work is also very enlightening. I feel we are at the
> cusp of an interesting answer here.
> 
>> 
>> QINL seems to go one step in this direction
>> taking schemata (not so different from ontology concepts / ER Entities) 
>> and extending them with behavior.
>> 
>> Still, I do not quite understand where the two approaches should meet.
>> Any idea?
> 
> That is a very good question. I do get the feeling that by answering
> this question we can make some very good progress. Perhaps
> Ryan Wisnesky, can point to an answer here. I will try, but
> it may take me some time to integrate both sides :-)
> 
> Ryan pointed me to an article from 2001 ”A Model Theory for Generic
> Schema Management” [1] that is actually an application of Institution Theory (IT)
> to Schema management with some very simple Java examples, that make
> IT accessible. The advantage of looking towards IT - the logic of the structure
> of all logics [2] - is that it can help one integrate many different points of views.
> The advantage of moving up the abstraction layer, is that some questions
> that within a domain seem arbitrary - eg the status of blank nodes in 
> RDF - can be answered at the higher level by showing how it ties in
> to many other areas of mathematics and engineering in a structured
> way - eg. blank nodes appear as NULLs in a coherent formalization of 
> database theory. In mathematics one can ground a problem by 
> moving up the abstraction layers, it seems.
> 
> Henry 
> 
> [1] http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.481.7519&rep=rep1&type=pdf
> [2] https://www.iep.utm.edu/insti-th/
> [3] a page with many links to Categorical Query Language
>    https://www.categoricaldata.net/papers 
> 
> PS. Sorry for taking so long to answer. 1. It is taking time to integrate
> all these papers, and 2. I keep having to do Scala programming tests for
> job interviews to prove I can code! 
> If anyone has a need for a Scala dev who understands RDF and
> some CT, please let me know :-)
> 
>> 
>> Cheers
>> Steffen
>> 
>> 
>>> Am 25.08.2019 um 07:19 schrieb Henry Story <henry.story@bblfish.net>:
>>> 
>>> Continuing this thread that started with the funny story on the NULL 
>>> vanity licence plate reported here:
>>>   https://mashable.com/article/dmv-vanity-license-plate-def-con-backfire/
>>> 
>>> I just came across work by Ryan Wisnesky on Algebraic Databases, where
>>> the authors formalizes DBs in terms of Category Theory, in order to build provably 
>>> correct ways to transform data.  
>>> 
>>> In that formalization, for which they have software tools, they give an clear 
>>> explanation of NULLs in SQL databases that make each 
>>> NULL different.  In the talk linked to below Ryan Wisnesky actually gives them  
>>> different  subscripts. 
>>> 
>>> In that way nulls  in DBs are very different from nulls in 
>>> Java - which can be compared for equality  and for which there exists only one 
>>> instance -  and very similar to blank nodes on the semantic web.
>>> 
>>> See the presentation ”Algebraic Databases” on his web site
>>>     https://www.wisnesky.net/
>>> Or other content I found on this work
>>>     https://twitter.com/bblfish/status/1165195822625153024
>>> 
>>> Henry Story
>>> 
>>> 
>>>> On 13 Aug 2019, at 15:53, Daniel Hernandez <daniel@degu.cl> wrote:
>>>> 
>>>> SQL nulls are similar in some aspects to Codd nulls. A difference is that SQL nulls do no provide guaranty that the value exists. Blank nodes, on the other hand, are similar to marked nulls. We study the application to SPARQL of SQL techniques to approximate certain answers in: "Certain Answers for SPARQL with Blank Nodes." However, we founded a unique dataset using blank nodes as unknown values (Wikidata). I am curious if you know another.
>>>> 
>>>> On Tue, Aug 13, 2019 at 3:53 AM, Franconi Enrico <franconi@inf.unibz.it> wrote:
>>>>> The situation is slightly more complex than that. 
>>>>> NULL values in standard SQL are exactly defined as letting any equality involving a NULL value fail.
>>>>> Note that the string 'NULL' represents a NULL value, namely if you type the string NULL into a cell of type STRING then it is understood to be a NULL value. 
>>>>> This is where the implementors failed: a NULL value is never equal to itself.
>>>>> This can be understood with the following standard SQL example (try it!).
>>>>> 
>>>>> With the database:
>>>>> 
>>>>> TABLE: col1 | col2
>>>>>       -----+-----
>>>>>         a  |  b
>>>>>         b  | NULL
>>>>> 
>>>>> the query (meant to be the identity query, namely returning the input table itself):
>>>>> 
>>>>> SELECT * FROM TABLE 
>>>>> WHERE TABLE.col1 = TABLE.col1 AND TABLE.col2 = TABLE.col2 ;
>>>>> 
>>>>> gives the result:
>>>>> 
>>>>> col1 | col2
>>>>> -----+-----
>>>>>  a  |  b
>>>>> 
>>>>> In SQL, the query above returns the table TABLE if and only if the table TABLE does not have any NULL value, otherwise it returns just the tuples not containing a NULL value, i.e., in this case only the first tuple <a,b>. Informally this is due to the fact that a SQL NULL value is never equal (or not equal) to anything, including itself. This is because a SQL NULL value represents the absence of a value.
>>>>> 
>>>>> Note that this is where SQL NULL values are radically different from RDF bnodes. Indeed a bnode is EQUAL to itself but different from any other bnode. This is because a RDF bnode represents the existence of an unknown value.
>>>>> 
>>>>> --e.
>>>>> 
>>>>>> Il giorno 12 ago 2019, alle ore 16:41, Diogo FC Patrao <djogopatrao@gmail.com> ha scritto:
>>>>>> 
>>>>>> 
>>>>>> Vanity license plates in USA are strings, right? Then this problem would only happen if NULL='NULL', which is not.
>>>>>> 
>>>>>> It could be that the private company stored 'NULL' instead of NULL to the unassigned tickets, but that's really bad coding/design (and easy to fix, I guess).
>>>>>> 
>>>>>> Or maybe the DAO wrongly translate NULL to 'NULL' at some point.
>>>>>> 
>>>>>> Cheers
>>>>>> 
>>>>>> dfcp
>>>>>> 
>>>>>> --
>>>>>> diogo patrão
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Mon, Aug 12, 2019 at 11:11 AM Young,Jeff (OR) <jyoung@oclc.org> wrote:
>>>>>> Here’s an example showing blank nodes being used to declare the place of birth is unknown in Wikidata:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> https://w.wiki/6$y
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> In the UI, it is rendered like this:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> <image001.png>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Jeff
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> From: Daniel Hernandez <daniel@degu.cl>
>>>>>> Date: Monday, August 12, 2019 at 9:42 AM
>>>>>> To: "semantic-web@w3.org" <semantic-web@w3.org>
>>>>>> Subject: [External] Re: The Joy of NULLs (not)
>>>>>> Resent-From: <semantic-web@w3.org>
>>>>>> Resent-Date: Monday, August 12, 2019 at 9:37 AM
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> As Enrico pointed, blank nodes can be used to represent unknown values.
>>>>>> An example of this use is Wikidata. I don't know another example.
>>>>>> 
>>>>>> --
>>>>>> Daniel
>>>>>> 
>>>>>> On Mon, 12 Aug 2019 07:36:41 +0000
>>>>>> Franconi Enrico <franconi@inf.unibz.it> wrote:
>>>>>> 
>>>>>>> Mike, this could easily happen in an RDF world if you register a
>>>>>>> vanity licence plate with anything starting with "_". Indeed, bnodes
>>>>>>> would be the right way to represent unknown but existing plates. --e.
>>>>>>> 
>>>>>>> Il giorno 11 ago 2019, alle ore 23:10, Michael F Uschold
>>>>>>> <uschold@gmail.com<mailto:uschold@gmail.com>> ha scritto:
>>>>>>> 
>>>>>>>> This is hilarious. It could never happen in an RDF world! No value,
>>>>>>>> no triple.
>>>>>>>> 
>>>>>>>> He tried to prank the DMV. Then his vanity license plate backfired
>>>>>>>> big time.
>>>>>>>> https://mashable.com/article/dmv-vanity-license-plate-def-con-backfire/<http://flip.it/NIk7FD>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>> 
>> 
> 

Received on Friday, 30 August 2019 16:27:09 UTC