XDR handle library

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

This library offers facilities to enable users to setup preferences on the values an eventual XML document may take. XML documents are specified by XDR documents (eXternal Data Representation standard), in a way conceptually similar to that of objects and classes in object oriented programming. These facilities allow to take as input an XDR Schema defining the class of documents of interest, and establish a dialogue with the user via an HTML form that allows the user to setup preferences to select sub-classes of documents (those which satisfy the preferences). The preferences are the output of the process and may be in the form of XPath expressions, for example, as can be seen in the example attached in the "examples" directory.

Usage and interface

Documentation on exports

PREDICATE

Usage: xdr_tree(XDR_url,XDR_tree,XDR_id)

  • Description: Parses an XDR (External Data Representation Standard) located at an url XDR_url into a tree structured Prolog term XDR_tree. It also returns an identifier of the XDR_tree XDR_id corresponding to the sequence of nodes in the tree (this is intended to be a hook to use in CGI applications).
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDR_url is currently a term which is not a free variable.
    (term_typing:var/1)XDR_tree is a free variable.
    (term_typing:var/1)XDR_id is a free variable.
    (pillow_types:url_term/1)XDR_url specifies a URL.
    (xdr_types:xdr/1)XDR_tree specifies an XDR document.
    (basic_props:int/1)XDR_id is an integer.

PREDICATE

Usage: xdr_tree(XDR_tree)

  • Description: Checks the correctness of an XDR tree XDR_tree.
  • The following properties should hold at call time:
    (xdr_types:xdr/1)XDR_tree specifies an XDR document.

REGTYPE

Usage: xdr_node(XDR_node)

  • Description: XDR_node is a XDR tree node.

PREDICATE

Usage: xdr2html(XDRTree,HTMLOutput,UnfoldedTree,Dic)

  • Description: Receives an XDR tree XDRTree and produces the corresponding HTML code HTMLOutput, an equivalente unfolded plain tree UnfoldedTree and a control dictionary Dic to hold a reference the evenutal fom objects.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDRTree is currently a term which is not a free variable.
    (term_typing:var/1)HTMLOutput is a free variable.
    (term_typing:var/1)UnfoldedTree is a free variable.
    (term_typing:var/1)Dic is a free variable.
    (xdr_types:xdr/1)XDRTree specifies an XDR document.
    (pillow_types:html_term/1)HTMLOutput is a term representing HTML code.
    (xdr_types:xdr/1)UnfoldedTree specifies an XDR document.
    (pillow_types:form_dict/1)Dic is a dictionary of values of the attributes of a form. It is a list of form_assignment

PREDICATE

Usage: xdr2html(XDRTree,HTMLOutput)

  • Description: Receives an XDR tree XDRTree and produces the corresponding HTML code HTMLOutput. This html code is intended to be part of a form used as a means by which an eventual user can give value to an instance of the XDR, i.e. an XML element.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDRTree is currently a term which is not a free variable.
    (term_typing:var/1)HTMLOutput is a free variable.
    (xdr_types:xdr/1)XDRTree specifies an XDR document.
    (pillow_types:html_term/1)HTMLOutput is a term representing HTML code.

PREDICATE

Usage: unfold_tree(XDRTree,UFT)

  • Description: Obtains an unfolded XDR tree UFT from a standard XDR tree XDRTree, i.e. an XDR tree where all references to XDR elements have been substituted with the elements themselves. Especially useful for eventual generation of equivalent XPATH expressions, (see example).
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDRTree is currently a term which is not a free variable.
    (term_typing:var/1)UFT is a free variable.
    (xdr_types:xdr/1)XDRTree specifies an XDR document.
    (xdr_types:xdr/1)UFT specifies an XDR document.

PREDICATE

Usage: unfold_tree_dic(XDRTree,UFT,Dic)

  • Description: Obtains an unfolded XDR tree UFT and a form dictionary Dic from a standard XDR tree XDRTree. Especially useful for HTML form data exchange (see example).
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDRTree is currently a term which is not a free variable.
    (term_typing:var/1)UFT is a free variable.
    (term_typing:var/1)Dic is a free variable.
    (xdr_types:xdr/1)XDRTree specifies an XDR document.
    (xdr_types:xdr/1)UFT specifies an XDR document.
    (pillow_types:form_dict/1)Dic is a dictionary of values of the attributes of a form. It is a list of form_assignment

PREDICATE

Usage: xdr_xpath(XDRTree,XPath)

  • Description: Produces an XPATH expression XPath from an XDR tree XDRTree. If the given XDR tree has no definite value the xpath expression produced will be empty
  • The following properties should hold at call time:
    (term_typing:nonvar/1)XDRTree is currently a term which is not a free variable.
    (term_typing:var/1)XPath is a free variable.
    (xdr_types:xdr/1)XDRTree specifies an XDR document.
    (basic_props:atm/1)XPath is an atom.