Skip to content

Instantly share code, notes, and snippets.

@RichMorin
Created June 13, 2014 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichMorin/27dfb7404ee69c1a87e2 to your computer and use it in GitHub Desktop.
Save RichMorin/27dfb7404ee69c1a87e2 to your computer and use it in GitHub Desktop.
// yaml_fu.go - try out YAML library
//
// Written by Rich Morin, CFCL, 2014
package main
import ("fmt"; "log")
import "gopkg.in/yaml.v1"
type T map[string] map[string] [4]string
func main () {
yaml_text := `
Predicates:
# ns_name P PT I Expansion
owl_disjointWith: [ _, __, _, 'disjoint with' ]
owl_equivalentClass: [ _, __, _, 'equivalent class' ]
`
t := T{}
err := yaml.Unmarshal([]byte(yaml_text), &t)
fmt.Printf("yaml_text: '%s'\n", yaml_text)
fmt.Printf("--- t:\n%v\n\n", t )
d, err := yaml.Marshal(&t)
log.Fatalf("error: %v", err) //T
if err != nil { log.Fatalf("error: %v", err) }
fmt.Printf("--- t dump:\n%s\n\n", string(d))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment