IMPORTANT: THIS PROPOSAL HAS BEEN SUPERCEDED BY THE GLOBAL SUBSEGMENT PROPOSAL AT XriCd02/GlobalSubsegments. Under that proposal, there would be no normalization of existing explicit cross-reference syntax.

THE FOLLOWING CONTENT IS FOR REFERENCE ONLY.

Introduction

This is a proposal to simplify XRI syntax as well as make it more human-friendly by specifying that XRI-normal form not require parentheses to delimit cross-references consisting of single-segment XRIs (which, in XRI Syntax 2.1, all begin with a GCS character).

See also the XriCd02/XriAbnf2dot1 page for the proposed XRI 2.1 ABNF.

Examples:

#1)     =example*(+blog)        <== cross-reference currently requires enclosing parens and star
#2)     =example+blog           <== compact cross-reference does not require enclosing parens or star

#1)     =example/(+blog)        <== cross-reference currently requires enclosing parens
#2)     =example/+blog          <== compact cross-reference does not require enclosing parens

#1)     =example*(+blog)*(+home)        <== multiple standard cross-references
#2)     =example+blog+home              <== multiple compact cross-references

#1)     =example*(+blog*maya)           <== multiple subsegment cross-reference
#2)     =example+blog*maya              <== multiple subsegment compact cross-reference

Proposed Normalization Rules

Under this proposal, compact syntax would become XRI-normal form. (See XriCd02/FormsAndTransformations for more about normalization and XRI-normal form.) In each example above, for instance, #1 would be a valid native XRI according to the XRI Syntax 2.1 ABNF, but only #2 would be in XRI-normal form.

1. Simple Rule

The simple rule would be to remove the enclosing parens for all cross-references EXCEPT those that either:

  1. are not absolute XRIs
  2. span multiple XRI segments, or
  3. span multiple cross-references.

2. Formal Algorithm

The formal algorithm for normalizing cross-references in XRI-normal form is given by the following steps (note that this algorithm is applied AFTER normalization of the trailing forward slash on an empty path segment.)

  1. Parse the XRI from left to right to find the first explicit cross-reference (i.e., enclosed in parentheses).
  2. If this explicit cross-reference contains a nested explicit cross-reference, find the innermost explicit cross-reference.
  3. If this explicit cross-reference value begins with "xri://", remove it.
  4. Apply the following three tests:
    1. Does the cross reference begin with any character EXCEPT a GCS character (=, @, !, +, \$)?

    2. After the first character, does the cross reference contain another GCS character (NOT percent encoded)?
    3. The cross-reference does contain any of the following three characters (NOT percent-encoded):
      1. / (i.e., multiple segments)

      2. ? (i.e., query string)

      3. # (i.e., fragment)

  5. If the answer to any of these three tests is "Yes", the cross-reference cannot be further normalized; skip the next step.
  6. If the answer to all three test is "No", normalize the cross-reference as follows:
    1. Remove the enclosing parentheses.
    2. If the parentheses are preceeded by a star, remove that star. (Note that if there are multiple preceeding stars, remove only the last one).
  7. Repeat for the next containing cross-reference, if any, until reaching the outermost cross-reference.
  8. Repeat for the next sequential cross-reference, if any, until reaching the end of the XRI.

Examples

#

Native XRI

XRI-Normal Form

Comment

1

=example.name*(+tag1)*(+tag2)

=example.name+tag1+tag2

Each of the cross-references is a single-segment XRI

2

@example.name/(+tag1)/(+tag2)

@example.name/+tag1/+tag2

Ditto

3

@!number/(+!number)/!(+tag2)

@!number/+!number/!+tag2

The cross-reference is a single-segment XRI

4

@example.name(*local)

no change

The cross-reference is not an absolute XRI, so it is not removed

5

@example.name*(+tag)*(=example.name)

@example.name+tag=example.name

Both cross-references are single-segment XRIs

6

=example.name*(+tag)*(@example.name)

=example.name+tag@example.name

Both cross-references are single-segment XRIs

7

=example!(+foo)

=example!+foo

The cross-reference is a single-segment XRI

8

=example/(+blog*personal)

=example/+blog*personal

The cross-reference is a single-segment XRI

9

=example/(+blog/personal)

no change

The cross-reference is a not single-segment XRI (it has a slash)

10

=example/(+blog?type=personal)

no change

The cross-reference is a not single-segment XRI ( it has a query)

11

=example/(+blog#personal)

no change

The cross-reference is a not single-segment XRI ( it has a fragment)

12

=example/(+blog*(+personal))

=example/(+blog+personal)

The innermost cross-reference can be removed because it is a single-segment XRI, but the outermost cross-reference cannot be removed because it spans multiple cross-references

13

=example/(+blog*(+personal/1999))

no change

The innermost cross-reference is not a single-segment XRI, and the outermost cross-reference spans multiple cross-references

Discussion on 2007-02-01 Telecon

1. Need for Rule #4b

The following problem was discussed prior to the addition of rule #4b above.

This would mean you cannot extract (+tag1*(+tag2)) as a unit. This is not right, because:

This was solved by adding Rule #4b.

2. Question about Star Syntax and Cross-Reference Syntax

Question: Should =example.name*(tag1)*(tag2) become =example.name(tag1)(tag2) ?

Answer: Yes, if we treat cross-reference syntax (parentheses) as delegation characters. This is the proposed approach in the proposed XRI 2.1 ABNF -- see XriCd02/XriAbnf2dot1.

3. Question about Nested Cross-References

Question: If +tag1*(+tag2) becomes +tag1+tag2, then why doesn't =example*(+tag1*(+tag2)) become =example*+tag1+tag2 instead of =example*(+tag1+tag2)?

Answer: Rule #4b says you can't compact a cross-reference that contains a cross-reference, as that supplies the necessary cross-reference grouping syntax and prevents ambiguity.

XriCd02/CompactSyntax (last edited 2009-08-12 18:07:17 by localhost)