OGDL Path Specification

Revision 2014.1, Jan 2014

Introduction

This specification defines a path expression language that enables navigation through an OGDL graph. The basic structure of a path is a list of elements separated by dots, where an element can be either a string, an index or a selector. For example:

config.network.ip
text.paragraph{2}
limits.range[1]

Indexes ( [n] ) select the nth-1 subnode, while selectors ( {n} ) select the nth-1 subnode with the same name as the token written before the selector. An empty selector ( {} ) selects all subnodes with the specified node name. Path character encoding is expected to be Unicode.

To clarify, given the following OGDL text:

a
  b
    x
  b
    y
  1
    z

the effect of applying different paths to it is as follows:

Grammar

The following grammar rules or productions are written in a simplified EBNF format similar to the one used in the XML specification (see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation), except that single quotes inclose single characters.

[1] path ::= element ( '.' element )*
[2] basic_element ::= token | quoted | index | selector 
[3] element = basic_element (index|selector)?
 
[4] index ::= '[' number ']'
[5] selector ::= '{' number? '}'

[6] token := (unicode_letter | unicode_digit | '_')+
[7] quoted := '\''  string '\'' | '"' string '"'
[8] string := (unicode_letter | unicode_mark | unicode_number | 
               unicode_punctuation | unicode_symbol | unicode_separator_space )+
[9] number := (unicode_digit)+

Production 3 indicates that the dot that normally separates elements is optional before and index or selector.

Productions 7 and 8 state that any graphic character or inline space character can appear in a quoted string, but not line breaks.

Examples

Given the following OGDL text:

chapter
  title "Chapter 1"
  p "Some text"
  x "----------"
  p "More text"
  
blank_page  
  
chapter
  title "Chapter 2"

the table bellow shows the outcome of applying some paths to it.

Path                Outcome
----                ------------	

chapter.title       "Chapter 1"

chapter{0}.title    "Chapter 1"

chapter{1}.title    "Chapter 2"

chapter.p{}         "Some text"
                    "More text"
                    
chapter{}.title{}   "Chapter 1"
                    "Chapter 2"                    



A. Changes to this document

See the Change list