예제 #1
0
파일: expand.go 프로젝트: dennwc/json-gold
func main() {
	proc := ld.NewJsonLdProcessor()
	options := ld.NewJsonLdOptions("")

	// expanding remote document

	expanded, err := proc.Expand("http://json-ld.org/test-suite/tests/expand-0002-in.jsonld", options)
	if err != nil {
		log.Println("Error when expanding JSON-LD document:", err)
		return
	}

	ld.PrintDocument("JSON-LD expansion succeeded", expanded)

	// expanding in-memory document

	doc := make(map[string]interface{})
	doc["@context"] = "http://schema.org/"
	doc["@type"] = "Person"
	doc["name"] = "Jane Doe"
	doc["jobTitle"] = "Professor"
	doc["telephone"] = "(425) 123-4567"
	doc["url"] = "http://www.janedoe.com"

	expanded, err = proc.Expand(doc, options)
	if err != nil {
		panic(err)
	}

	ld.PrintDocument("JSON-LD expansion succeeded", expanded)
}
예제 #2
0
파일: expand.go 프로젝트: dkolbly/json-gold
func main() {
	proc := ld.NewJsonLdProcessor()
	options := ld.NewJsonLdOptions("")

	expanded, err := proc.Expand("http://json-ld.org/test-suite/tests/expand-0002-in.jsonld", options)
	if err != nil {
		log.Println("Error when expanding JSON-LD document:", err)
		return
	}

	ld.PrintDocument("JSON-LD expansion succeeded", expanded)
}
예제 #3
0
파일: jld.go 프로젝트: develrns/resilient
/*
PrintDocument is the same as ld.PrintDocument - it prints the internal JSON LD Document as formatted JSON LD.
It's here to eliminate the need to import the ld package.
*/
func PrintDocument(msg string, document interface{}) {
	ld.PrintDocument(msg, document)
}