Let me get back to you in a couple of days (post- Knowledge Graph
Conference) with a more detailed reply, but I think we are more or less on
the same page w.r.t. "pointers". With respect to sequences, in terms of
type theory you can think of them as recursive types which make use of the
disjoint union I have been pushing for. You can also think of them as a
union of tuple types. E.g. the type of a list of strings is

    () + (String) + (String, String) + (String, String, String) etc.

You need that + operator to unify tuple types and sequences in this way.

I think of your Pointer<T> as a reference to an entity. It does not contain
the entity it refers to, but it contains the primary key of that entity. If
you assume that primary keys are unique for a given type of entity (another
way of saying that there is only one relation for each entity type), then
the primary key uniquely resolves to a tuple. Otherwise, Pointer is similar
to any other value. Say we use Value<T> for data-typed values. Using your
Pair<A, B>, the type of an "age" property would look like:

    Pair<Pointer<Entity>, Value<Integer>>

Here, I have invented an Entity class to indicate that the pointer resolves
to a vertex (an entity without a tuple, or rather with a 0-tuple -- the
unit element).

Josh




On Mon, May 6, 2019 at 9:38 PM Marko Rodriguez <okramma...@gmail.com> wrote:

> Hey Josh,
>
> > I am feeling the tuples... as long as they can be typed, e.g.
> >
> >     <V> myTuple.get(Integer) -- int-indexed tuples
> >     <V> myTuple.get(String) -- string-indexed tuples
> > In most programming languages, "tuples" are not lists, though they are
> typed by a list of element types. E.g. in Haskell you might have a tuple
> with the type
> >     (Double, Double, Bool)
>
>
> Yes, we have Pair<A,B>, Triple<A,B,C>, Quadruple<A,B,C,D>, etc. However
> for base Tuple<A> of unknown length, the best I can do in Java is <A>. :|
> You can see my stubs in the gist:
>         https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8 <
> https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8> (LINES
> #21-42)
>
> > If this is in line with your proposal, then we agree that tuples should
> be the atomic unit of data in TP4.
>
> Yep. Vertices, Edges, Rows, Documents, etc. are all just tuples. However,
> I suspect that we will disagree on some of my tweaks. Thus, I’d really like
> to get your feedback on:
>
>         1. pointers (tuple entries referencing tuples).
>         2. sequences (multi-value tuple entries).
>         3. # hidden map keys :|
>                 - sorta ghetto.
>
> Also, I’m still not happy with db().has().has().as(‘x’).db().where()… its
> an intense syntax and its hard to strategize.
>
> I really want to nail down this “universal model” (tuple structure and
> tuple-oriented instructions) as then I can get back on the codebase and
> start to flush this stuff out with confidence.
>
> See ya,
> Marko.
>
> http://rredux.com <http://rredux.com/>
>
>
> >
> > Josh
> >
> >
> > On Mon, May 6, 2019 at 5:34 PM Marko Rodriguez <okramma...@gmail.com
> <mailto:okramma...@gmail.com>> wrote:
> > Hi,
> >
> > I spent this afternoon playing with n-tuples, pointers, data model
> interfaces, and bytecode instructions.
> >
> >         https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8 <
> https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8> <
> https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8 <
> https://gist.github.com/okram/25d50724da89452853a3f4fa894bcbe8>>
> >
> > *** Kuppitz: They are tuples :). A Map<K,V> extends Tuple<Pair<K,V>>.
> Tada!
> >
> > What I like about this is that it combines the best of both worlds
> (Josh+Marko).
> >         * just flat tuples of arbitrary length.
> >                 * pattern matching for arbitrary joins. (k1=k2 AND k3=k4
> …)
> >                 * pointers chasing for direct links. (edges, foreign
> keys, document _id references, URI resolutions, …)
> >         * sequences are a special type of tuple used for multi-valued
> entries.
> >         * has()/values()/etc. work on all tuple types! (maps, lists,
> tuples, vertices, edges, rows, statements, documents, etc.)
> >
> > Thoughts?,
> > Marko.
> >
> > http://rredux.com <http://rredux.com/> <http://rredux.com/ <
> http://rredux.com/>>
> >
> >
>
>

Reply via email to