• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

1 library(yaml): Process YAML data
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog YAML library
        • library(yaml): Process YAML data
          • yaml_read/2
          • yaml_write/2
          • yaml_write/3
          • tagged/3
Availability::- use_module(library(yaml)).(can be autoloaded)
Source[det]yaml_read(+Input, -DOM)
Parse Input to a YAML DOM. The DOM representation uses the following mapping:

  • A YAML sequence is mapped to a Prolog List.
  • A YAML mapping is mapped to a Prolog dict.
  • Untagged scalars follow the implicit tag rules defined by YAML, providing numbers (int, float and special floats), null and the booleans true and false. Other untagged values are returned as a Prolog string. Tagged values are returned as tag(Tag, String) which is processed by yalm_tagged/3. This internal predicate calls the user hook yaml:tagged/3 with the same arguments and, if the hook fails, provides the following defaults:

    • !!binary converts the Base64 to a string of bytes.
    • !!str explicitly keeps a string
    • !!null translates "null" to null
    • !!bool translates to true and false
    • !!int translates to an integer
    • !!float translates to a float
    • Anything else is returned as tag(Tag, String)
Input is one of (1) a stream, (2) a term string(Data) or (3) a file name.
bug
YAML defines that floats do not require a digit after the decimal dot. We use the Prolog parser which does require the decimal dot to be followed by at least one digit. Because the YAML spec intends to match JSON which does require a digit, we ignore this incompatibility, expecting it will be addressed in the next YAML version.
ClioPatria (version V3.1.1-51-ga0b30a5)