Re: [xdi] proposal for binary data literal node

From
Markus Sabadello <>
Date
2012-03-02T14:44:01+00:00
ID
Thread
Re: [xdi] proposal for binary data literal node
To me this sounds like an implementation detail rather than something that needs to be supported on the graph level.

If for optimization purposes a server needs to know the data type of a literal (binary, number, boolean, etc.), then it could either

1. figure out the data type based on the dictionary, or

2. require (as a policy) that clients add the literal together with the metadata that specifies the data type

Markus

On Fri, Mar 2, 2012 at 3:05 PM, Michael Schwartz <> wrote:

I think we need a way to differentiate binary literals if we want to support storage of binaries in the graph. And simply storing metadata is not sufficient because there is no guarantee that the metadata is created before the literal needs to be stored. Is there a solution?

thx,

Mike

---------------------------------------------------

Michael Schwartz

Gluu

Founder / CEO



+1 646-810-8761

On Thu, 1 Mar 2012, Drummond Reed wrote:

Mike, the question you raised actually highlights a number of the key

reasons for the literal context proposal. Let me explain.

First, per Markus' last point in his message, one primary purpose of

literal contexts is so an XDI processor always knows the type of the

literal node it is dealing with by the type of the literal context. To use

Mike's example, if "*logo" is defined as a literal context containing a

binary value (which has several semantic issues -- see below), then

@!1111*logo always identifies a single binary value.

Secondly, it's a misunderstanding of literal contexts that there could be

two literal arcs. The whole idea of a literal context is that it has a

single literal arc. If the literal context is defined as containing binary

data, then that literal arc points to binary data. If the literal context

is defined as containing a number, then the literal arc points to a number.

And so on.

These are all controlled by XDI dictionary definitions, which is why I

think the XDI Dictionary spec is moving up in priority.

Now, the semantic issues. First, @!1111*logo is semantically wrong because

uses a *name to identify a literal context defined in a dictionary, and *

is not the dictionary namespace. The dictionary namespace is + (with the

exceptions of a handful of special $words defined by the XDI TC).

So it should be @!1111+logo. The second semantic issue is that +logo should

not be a literal context because it is not a single defined datatype. +logo

should be a supertype that has defined subtypes. In other words, the

dictionary defintion should say +logo/$is$a/+image, and (among other

options) +$image/$a/$a$xsd$jpeg. So if the binary you wanted was a JPEG,

then the address would be:

  1. @!1111+logo$a$xsd$jpeg  <== canonical JPEG version of the logo

  (zero-or-one)

  2. @!1111+logo/$a$xsd$jpeg  <== (note the slash) relational arc pointing

  to all the JPEF versions of the logo (zero-or-more)

So it is the dictionary-defined  $jpeg, and not +logo (and definitely not

*logo) that is the XRI literal context storing the binary data. And because

the $dictionary will define $jpeg as a JPEG binary, any time an XDI

processor sees $jpeg as the literal context, it knows the value is a JPEG.

I'll put this on the agenda for tomorrow's call (even though Mike won't be

there).

=Drummond

On Thu, Mar 1, 2012 at 4:35 PM, Michael Schwartz <> wrote:

Markus,

Thanks for the quick response!

1. Yes, you could have both a ! and !! arc, why not?  It doesn't seem

inherently problematic to me.

2. yes, you're right I forgot the / for the literal arc :)

3. !! was just an idea... it could be something else.

4. Its useful to be able to differentiate binary data from other types of

  data because there persistence strategy varies greatly.

- Mike

 1. Could you have BOTH a binary and a non-binary literal in a context?

I.e.

have a ! arc and a !! arc.

If not, will the server throw an error if you already have one literal and

try to add the other one?

2. In your example, wouldn't the XRI actually be @!1111*logo/!! instead of

@!1111*logo!!  ?

3. Something is bothering me about the fact that !! is two subsegments. I

am worried it will result in ambiguity in one way or the other.

4. I don't understand why you can't load the metadata together with the

literal, to figure out whether it is binary or not.

Wasn't this the whole point of what Drummond called "literal contexts"?

Markus

On Thu, Mar 1, 2012 at 9:49 PM, Michael Schwartz <> wrote:

XDI TC:

I'm attaching a proposal to represent binary literal values as "!!"

So, for example, the XRI for a my company's logo might be :

 @!1111*logo!!

The fact that the image is a binary can't be represented in the metadata,

because it is not known which will be loaded first, the literal node, or

the metadata about the literal node.

This is a critical issue to optimize persistence of binary objects, which

need to be indexed differently.

I'd like to fast track this because we need to store binaries as part of

the oxPlus demo :)

Thoughts?

thx,

- Mike

------------------------------**------------------------------**

---------

To unsubscribe, e-mail: -**open.org<>

For additional commands, e-mail: 

------------------------------**------------------------------**---------

To unsubscribe, e-mail: -**open.org<>

For additional commands, e-mail: 

---------------------------------------------------------------------

To unsubscribe, e-mail: 

For additional commands, e-mail: