Go to the first, previous, next, last section, table of contents.


XML query library

Author(s): José Manuel Gómez Pérez.

Version: 0.1 (2003/12/1, 13:24:9 CET)

This package provides a language suitable for querying XML documents from a Prolog program. Constraint programming expresions can be included in order to prune search as soon as possible, i.e. upon constraint unsatisfability, improving efficiency. Also, facilities are offerd to improve search speed by transforming XML documents into Prolog programs, hence reducing search to just running the program and taking advantage of Prolog's indexing capabilities.

Queries in an XML document have a recursive tree structructure that permits to detail the search on the XML element sought, its attributes, and its children. As a suffix, a constraint programming expression can be added. Queries return value for the free variables included (in case of success), and checks whether the XML document structure matches that depicted by the query itself.

The operators introduced are described below:

Some examples of this query language (more can be found in the examples directory):

product@val(product_name,"car")::(quantity(X), 
                                  'time-left'(Y), 
                                  negotiation::preference::price(Z)) 
       with X * Z .>. Y

nitf::head::docdata::'doc-id'@val('id-string',"020918050")::(Y), 
                     body::'body.head'::abstract::p(X)

Usage and interface (xml_path)

Documentation on exports (xml_path)

PREDICATE: xml_search/3:

Usage: xml_search(+Query, +Source, -Doc)

PREDICATE: xml_parse/3:

Usage: xml_parse(+Query, +Source, -Doc)

PREDICATE: xml_parse_match/3:

Usage: xml_parse_match(+Query, +Source, -Match)

PREDICATE: xml_search_match/3:

Usage: xml_search_match(+BasicQuery, +SourceDoc, -Match)

PREDICATE: xml_index_query/3:

Usage: xml_index_query(+Query, -Id, -Match)

PREDICATE: xml_index_to_file/2:

Usage: xml_index_to_file(SourceDoc, File)

PREDICATE: xml_index/1:

Usage: xml_index(SourceDoc)

PREDICATE: xml_query/3:

Usage: xml_query(+Query, +Doc, -Match)

Documentation on internals (xml_path)

REGTYPE: canonic_xml_term/1:

Usage: canonic_xml_term(XMLTerm)

REGTYPE: canonic_xml_item/1:

Usage: canonic_xml_item(XMLItem)

REGTYPE: tag_attrib/1:

Usage: tag_attrib(Att)

REGTYPE: canonic_xml_query/1:

Usage: canonic_xml_query(Query)

REGTYPE: canonic_xml_subquery/1:

Usage: canonic_xml_subquery(SQuery)


Go to the first, previous, next, last section, table of contents.