Revision 2005.3, 8 March 2005 Copyright (c) 2003-2005 R. Veen This is an open standard. See the license.
This specification defines a path expression language that enables navigation thru an OGDL graph. The syntax is suitable for embedding into scripting languages.
A path expression applied to a graph allways returns a graph or null, except when types are used, in which case a scalar value of some type may be returned. The resulting graph can be a subgraph of the original graph, or it can be one produced during the evaluation of the path. For example, the [] operator creates a new temporary graph that holds intermediate results.
The basic structure of a path is a dot separated list of elements. Each element is an OGDL fragment written in expression form. An element can be as simple as a string, or as complex as a graph contained in parenthesis. Here are some examples:
(a b).c[1].d(e f,g) a.b.c a(c)
The syntax resembles that of path expressions used in object oriented languages such as Java, so that an OGDL path can be mapped to such an expression. But the syntax has a broader range, as elements composed only by argument lists are possible.
In the following graph:
A path is a concatenation of OGDL elements written in expression format and separated by dots. A path has an equivalent representation in OGDL. In fact, each element can be interpreted as a complete OGDL graph.
Note: Strickly speaking, this definition of a path isn't a path anymore, in the sense as it is defined in graph theory. This spec asummes the incongruency. In graph theory, a path is a tree with 2 nodes of vertex degree 1 and n-2 nodes with vertex degree 2 (Eric W. Weisstein, MathWorld, a Wolfram web resource: http://mathworld.wolfram.com)
[1] path ::= element ( '.' element )*
[2] element ::= (string (index|selector)?) | arglist | index | selector
[3] index ::= '[' ( number | '*' | '**')? ']'
where [n] selects the nth subnode,
[**] means any path,
[*] means any node
[4] selector ::= '{' number? '}'
[5] arglist ::= '(' (path ( ',' path )* )? ')'
path : libs
libs
foo.so
version 1.2
date 2002-05-05
bar.so
version 3.4
path : libs.'foo.so'
libs
foo.so
version 1.2
date 2002-05-05
bar.so
version 3.4
path : libs.'foo.so'.version
libs
foo.so
version 1.2
date 2002-05-05
bar.so
version 3.4
path : libs.[*].version
libs
foo.so
version 1.2
date 2002-05-05
bar.so
version 3.4
path : book.author{}.name{}
libs
book
title 'Introduction to XML'
author
name 'Peter Perez'
author
name 'Monica Windmind'
20030614 A path is a concatenation of OGDL expressions.
20031117 Renamed to Version 1.0, without modifications.
Later brought back to working draft.
20030902 Initial release