The Web Graph Database

wiki:XpathTraversalTranslator

XpathTraversalTranslator

The XpathTraversalTranslator is one implementation of TraversalTranslator, i.e. it translates Strings into TraversalSpecifications and vice versa.

The XpathTraversalTranslator uses an XPath-like syntax to accomplish this goal. InfoGrid currently contains an incomplete implementation that will be extended as the need arises. Like any XPath, two pieces of information need to be specified:

  • the String containing the XPath expression
  • a dictionary that maps the namespace tags of the XPath expression into fully-qualified names.

XpathTraversalTranslator is no different. It thusrequires the use of at least two Strings.

  • prefix xpath: indicates the XPath-like expression
  • prefix xpath-dict: indicates the dictionary

Example:

xpath-dict:m=com.example.model.MyModel xpath:m:A_B_C-S/m:D_E_F-D

is the equivalent of the following Java code:

SequentialCompoundTraversalSpecification.create(
        com.example.model.MyModelSubjectArea.A_B_C.getSource(),
        com.example.model.MyModelSubjectArea.D_E_F.getDestination()
)

i.e. it means a two-step TraversalSpecification, the first of which is the traversal of the source RoleType of RelationshipType A_B_C in SubjectArea com.example.model.MyModel, and the second of which is the traversal of the destination RoleType of RelationshipType D_E_F in the same SubjectArea.

See also:

Last modified 5 years ago Last modified on 04/10/10 05:35:34