Search

SPath: an extensible query-language for Scala

By: Nicholas Nguyen

Abstract

Scala combines the functional and object-oriented paradigms and is good at supporting embedded domain-specific languages. Scala presents therefore an opportunity for designing a new kind of query-language that belongs to the family of XPath-like query-languages, for querying semi-structured data that is stored within internal memory. In the terminology of XPath, a relation between the nodes of a tree, is called an axis and their purpose is to provide a way of navigating between the nodes within a tree. An XPath query is then, approximately, a path of axis-steps, resembling a directory path in a file-system. XPath has 13 axes. However, it is natural to extend the notion of axis to any relation on tree-nodes, by allowing queries with user-defined axes. The effect of the approach that has been taken in this article is an alternative syntax and semantics for user-defined axes, compared with XPath 2.0. It also turns out that separating the query-language from specific types of trees, enables reuse with any tree data-structure that conforms to the composite design-pattern. SPath is an XPath-like query-language based on Linear Temporal Logic that has been implemented as a domain-specific language, embedded into Scala.

Keywords

Scala, SPath, domain-specific languages, linear temporal logic

Cite as:

Nicholas Nguyen, “SPath: an extensible query-language for Scala”, Journal of Object Technology, Volume 10, (2011), pp. 13:1-37, doi:10.5381/jot.2011.10.1.a13.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn