template

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2020 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 0 Imported by: 0

Documentation

Overview

Package template defines the templates used for code generation in string format.

Index

Constants

This section is empty.

Variables

View Source
var AddClassMultiple = "\t\tif v, ok := in[i].(###propAllowedType###); ok {\n" +

	"\t\t\tres.###propName###[v.IRI()] = v\n" +

	"\t\tcontinue\n" +
	"\t\t}\n"

AddClassMultiple template

View Source
var AddToMap = "\tmod.m###parentName###[res.IRI()] = res\n"

AddToMap template

View Source
var ArrayMultiple = "[i]"

ArrayMultiple template

View Source
var ArraySingle = ""

ArraySingle template

View Source
var ClassAdd = "// add###className### adds ###className### to model\n" +
	"func (mod *Model) add###className###(res ###className###) {\n" +
	"###newAddToMaps###" +
	"\treturn\n" +
	"}\n\n"

ClassAdd template

View Source
var ClassGet = "// ###className### returns all resources with given prefix\n" +
	"func (mod *Model) ###className###(prefix string) (res []###className###) {\n" +
	"\tfor i := range mod.m###className### {\n" +
	"\t\tif strings.HasPrefix(i, prefix) {\n" +
	"\t\t\tres = append(res, mod.m###className###[i])\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassGet template

View Source
var ClassHeader = "package ###pkgName###\n\n" +
	"import (\n" +
	"###imports###" +
	")\n\n"

ClassHeader template

View Source
var ClassIRI = "// IRI is the resource iri\n" +
	"func (res *s###className###) IRI() (out string) {\n" +
	"\tout = res.iri\n" +
	"\treturn\n" +
	"}\n\n"

ClassIRI template

View Source
var ClassInheritance = "// is###parentName### indicates base class\n" +
	"func (res *s###className###) Is###parentName###() bool {\n" +
	"\treturn true\n" +
	"}\n\n"

ClassInheritance template

View Source
var ClassInit = "// InitFromNode initializes the resource from a graph node\n" +
	"func (res *s###className###) InitFromNode(node *rdf.Node) (err error) {\n" +
	"\tfor i := range node.Edge {\n" +
	"\t\tres.propsInit(node.Edge[i])\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassInit template

View Source
var ClassInterface = "// ###className### ###comment###\n" +
	"type ###className### interface {\n" +
	"###interfaceMethods###" +
	"###interfaceInheritance###" +
	"}\n\n"

ClassInterface template

View Source
var ClassInverseMultipleMultiple = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *s###className###) Set###propCapital###(in []###propBaseType###) (err error) {\n" +
	"\ttemp := res.###propName###\n" +
	"\tres.###propName### = make(map[string]###propType###)\n" +
	"\tfor i := range temp {\n" +
	"\t\ttemp[i].Del###propInverse###(res)\n" +
	"\t}\n" +
	"\terr = res.Add###propCapital###(in...)\n" +
	"\treturn\n" +
	"}\n\n" +
	"// Add###propCapital### adds ###comment###\n" +
	"func (res *s###className###) Add###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"###inverseAddMultipleMultipleAllowed###" +
	"\t\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###allowedTypes###\")\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n" +
	"// Del###propCapital### deletes ###comment###\n" +
	"func (res *s###className###) Del###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"###inverseDelMultipleMultipleAllowed###" +
	"\t\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###allowedTypes###\")\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassInverseMultipleMultiple template

View Source
var ClassInverseMultipleSingle = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *s###className###) Set###propCapital###(in []###propBaseType###) (err error) {\n" +
	"\ttemp := res.###propName###\n" +
	"\tres.###propName### = make(map[string]###propType###)\n" +
	"\tfor i := range temp {\n" +
	"\t\ttemp[i].Del###propInverse###(res)\n" +
	"\t}\n" +
	"\terr = res.Add###propCapital###(in...)\n" +
	"\treturn\n" +
	"}\n\n" +
	"// Add###propCapital### adds ###comment###\n" +
	"func (res *s###className###) Add###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"\t\tif _, ok := res.###propName###[in[i].IRI()]; !ok {\n" +
	"\t\t\tres.###propName###[in[i].IRI()] = in[i]\n" +
	"\t\t\tin[i].Add###propInverse###(res)\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n" +
	"// Del###propCapital### deletes ###comment###\n" +
	"func (res *s###className###) Del###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"\t\tif _, ok := res.###propName###[in[i].IRI()]; ok {\n" +
	"\t\t\tdelete(res.###propName###, in[i].IRI())\n" +
	"\t\t\tin[i].Del###propInverse###(res)\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassInverseMultipleSingle template

View Source
var ClassInverseSingleMultiple = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *s###className###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"\tif in != nil {\n" +
	"\t\tif res.###propName### != nil {\n" +
	"\t\t\tif res.###propName###.IRI() != in.IRI() {\n" +
	"\t\t\t\ttemp := res.###propName###\n" +
	"###inverseSetSingleMultipleOne###" +
	"\t\t\t}\n" +
	"\t\t} else {\n" +
	"###inverseSetSingleMultipleTwo###" +
	"\t\t}\n" +
	"\t} else {\n" +
	"\t\tif res.###propName### != nil {\n" +
	"\t\t\ttemp := res.###propName###\n" +
	"###inverseSetSingleMultipleThree###" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassInverseSingleMultiple template

View Source
var ClassInverseSingleSingle = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *s###className###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"\tif in != nil {\n" +
	"\t\tif res.###propName### != nil {\n" +
	"\t\t\tif res.###propName###.IRI() != in.IRI() {\n" +
	"\t\t\t\ttemp := res.###propName###\n" +
	"\t\t\t\tres.###propName### = in\n" +
	"\t\t\t\ttemp.Set###propInverse###(nil)\n" +
	"\t\t\t\tin.Set###propInverse###(res)\n" +
	"\t\t\t}\n" +
	"\t\t} else {\n" +
	"\t\t\tres.###propName### = in\n" +
	"\t\t\tin.Set###propInverse###(res)\n" +
	"\t\t}\n" +
	"\t} else {\n" +
	"\t\tif res.###propName### != nil {\n" +
	"\t\t\ttemp := res.###propName###\n" +
	"\t\t\tres.###propName### = in\n" +
	"\t\t\ttemp.Set###propInverse###(nil)\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassInverseSingleSingle template

View Source
var ClassMakeMaps = "// makeMaps creates initiliazes maps\n" +
	"func (res *s###className###) makeMaps() {\n" +
	"###newMakeMaps###" +
	"###newInitProps###" +
	"\treturn\n" +
	"}\n\n"

ClassMakeMaps template

View Source
var ClassNew = "// New###className### creates a new ###className###\n" +
	"func (mod *Model) New###className###(iri string) (ret ###className###, err error) {\n" +
	"\tif mod.Exist(iri) {\n" +
	"\t\terr = errors.New(\"Resource already exists\")\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tres := &s###className###{}\n" +
	"\tpc := propCommon{iri: iri, typ: \"###className###\", model: mod}\n" +
	"\tres.propCommon = pc\n" +
	"\tmod.add###className###(res)\n" +
	"\tres.makeMaps()\n" +
	"\tret = res\n" +
	"\treturn\n" +
	"}\n\n"

ClassNew template

View Source
var ClassRemove = "// RemoveObject deletes all its references in this object\n" +
	"func (res *s###className###) RemoveObject(obj owl.Thing, prop string) {\n" +
	"\tswitch prop {\n" +
	"###removeProps###" +
	"\tdefault:\n" +
	"###parentRemove###" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ClassRemove template

View Source
var ClassString = "// String prints the object into a string\n" +
	"func (res *s###className###) String() (ret string) {\n" +
	"\tret = res.iri + \" \" + \"###className###\\n\"\n" +
	"\tret += res.propsString()\n" +
	"\treturn\n" +
	"}\n\n"

ClassString template

View Source
var ClassStruct = "// s###className### ###comment###\n" +
	"type s###className### struct {\n" +
	"###structProperties###" +
	"}\n\n"

ClassStruct template

View Source
var ClassToGraph = "// ToGraph creates a new owl graph node and adds it to the graph\n" +
	"func (res *s###className###) ToGraph(g *rdf.Graph) {\n" +
	"\tnode := owl.AddObjectToGraph(g, \"###classIRI###\", res)\n" +
	"\tres.propsToGraph(node, g)\n" +
	"\treturn\n" +
	"}\n\n"

ClassToGraph template

View Source
var ClassToGraphNoProp = "// ToGraph creates a new owl graph node and adds it to the graph\n" +
	"func (res *s###className###) ToGraph(g *rdf.Graph) {\n" +
	"\towl.AddObjectToGraph(g, \"###classIRI###\", res)\n" +
	"\treturn\n" +
	"}\n\n"

ClassToGraphNoProp template

View Source
var CreateIndividual = "\tmod.New###individualType###(\"###individualIRI###\")\n"

CreateIndividual template

View Source
var DelClassMultiple = "\t\tif v, ok := in[i].(###propAllowedType###); ok {\n" +

	"\t\t\tdelete(res.###propName###, v.IRI())\n" +

	"\t\tcontinue\n" +
	"\t\t}\n"

DelClassMultiple template

View Source
var DeleteFromImport = "\terr = mod.model###importName###.DeleteObject(obj)\n"

DeleteFromImport template

View Source
var DeleteFromMap = "\tdelete(mod.m###className###, obj.IRI())\n"

DeleteFromMap template

View Source
var GraphPropBool = "###indent###\towl.AddBoolPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropBool template

View Source
var GraphPropClass = "###indent###\towl.AddClassPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropClass template

View Source
var GraphPropFloat = "###indent###\towl.AddFloatPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropFloat template

View Source
var GraphPropInt = "###indent###\towl.AddIntPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropInt template

View Source
var GraphPropInterface = "###indent###\towl.AddInterfacePropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropInterface template

View Source
var GraphPropSDate = "###indent###\towl.AddDatePropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSDate template

View Source
var GraphPropSDateTime = "###indent###\towl.AddDateTimePropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSDateTime template

View Source
var GraphPropSDateTimeStamp = "###indent###\towl.AddDateTimeStampPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSDateTimeStamp template

View Source
var GraphPropSDuration = "###indent###\towl.AddDurationPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSDuration template

View Source
var GraphPropSGDay = "###indent###\towl.AddGDayPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSGDay template

View Source
var GraphPropSGMonth = "###indent###\towl.AddGMonthPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSGMonth template

View Source
var GraphPropSGYear = "###indent###\towl.AddGYearPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSGYear template

View Source
var GraphPropSGYearMonth = "###indent###\towl.AddGYearMonthPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSGYearMonth template

View Source
var GraphPropSTime = "###indent###\towl.AddTimePropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropSTime template

View Source
var GraphPropString = "###indent###\towl.AddStringPropertyToGraph(g, \"###propIRI###\", node, res.###propName######array###)\n"

GraphPropString template

View Source
var Import = "\t\"###import###\"\n"

Import template

View Source
var ImportReplace = "\treplace[\"###importIRI###\"] = \"###importName###:\"\n"

ImportReplace template

View Source
var ImportShape = "\tshape[\"###importIRI###\"] = \"box\"\n"

ImportShape template

View Source
var ImportsHeader = "package ###pkgName###\n\n" +
	"import (\n" +
	"\t\"errors\"\n" +
	"###imports###" +
	")\n\n"

ImportsHeader template

View Source
var ImportsNewGetMethods = "// New###capImportName######className### creates a new ###importName### ###className###\n" +
	"func (mod *Model) New###capImportName######className###(iri string) (ret im###importName###.###className###, err error) {\n" +
	"\tif mod.Exist(iri) {\n" +
	"\t\terr = errors.New(\"Resource already exists\")\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tret, err = mod.model###importModelName###.New###importCapImportName######className###(iri)\n" +
	"\tif err != nil {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tmod.mThing[ret.IRI()] = ret\n" +
	"\treturn\n" +
	"}\n\n" +
	"// ###capImportName######className### returns all resources with given prefix\n" +
	"func (mod *Model) ###capImportName######className###(prefix string) (res []im###importName###.###className###) {\n" +
	"\tres = mod.model###importModelName###.###importCapImportName######className###(prefix)\n" +
	"\treturn\n" +
	"}\n\n"

ImportsNewGetMethods template

View Source
var IndentMultiple = "\t"

IndentMultiple template

View Source
var IndentSingle = ""

IndentSingle template

View Source
var Individual = "package ###pkgName###\n\n" +
	"// CreateIndividuals adds all individuals to a model\n" +
	"func (mod *Model) CreateIndividuals() {\n" +
	"###createIndividuals###" +
	"\treturn\n" +
	"}\n\n"

Individual template

View Source
var InitSwitchProp = "\tcase \"###propIRI###\":\n" +
	"###PropInit###"

InitSwitchProp template

View Source
var InterfaceInheritance = "\tIs###parentName###() bool // indicates base class\n"

InterfaceInheritance template

View Source
var InterfaceInterface = "\t###propName######multi######propBaseTypeNoImp###\n"

InterfaceInterface template

View Source
var InverseAddMultipleMultiple = "\t\tif v, ok := in[i].(###propAllowedType###); ok {\n" +
	"\t\t\tif _, ok := res.###propName###[v.IRI()]; !ok {\n" +
	"\t\t\t\tres.###propName###[v.IRI()] = v\n" +
	"\t\t\t\tv.Add###propInverse###(res)\n" +
	"\t\t\t}\n" +
	"\t\t\tcontinue\n" +
	"\t\t}\n"

InverseAddMultipleMultiple template

View Source
var InverseDelMultipleMultiple = "\t\tif v, ok := in[i].(###propAllowedType###); ok {\n" +
	"\t\t\tif _, ok := res.###propName###[v.IRI()]; !ok {\n" +
	"\t\t\t\tdelete(res.###propName###, v.IRI())\n" +
	"\t\t\t\tv.Del###propInverse###(res)\n" +
	"\t\t\t}\n" +
	"\t\t\tcontinue\n" +
	"\t\t}\n"

InverseDelMultipleMultiple template

View Source
var InverseSetSingleMultipleOne = "\t\t\t\tif _, ok := in.(###propAllowedType###); ok {\n" +
	"\t\t\t\t\tres.###propName### = in\n" +
	"\t\t\t\t\ttemp.Set###propInverse###(nil)\n" +
	"\t\t\t\t\tin.Set###propInverse###(res)\n" +
	"\t\t\t\t\treturn\n" +
	"\t\t\t\t}\n"

InverseSetSingleMultipleOne template

View Source
var InverseSetSingleMultipleThree = "\t\t\tif _, ok := in.(###propAllowedType###); ok {\n" +
	"\t\t\t\tres.###propName### = in\n" +
	"\t\t\t\ttemp.Set###propInverse###(nil)\n" +
	"\t\t\t\treturn\n" +
	"\t\t\t}\n"

InverseSetSingleMultipleThree template

View Source
var InverseSetSingleMultipleTwo = "\t\t\tif _, ok := in.(###propAllowedType###); ok {\n" +
	"\t\t\t\tres.###propName### = in\n" +
	"\t\t\t\tin.Set###propInverse###(res)\n" +
	"\t\t\t\treturn\n" +
	"\t\t\t}\n"

InverseSetSingleMultipleTwo template

View Source
var ModelDeleteObject = "// DeleteObject deletes an object from the model along with its references\n" +
	"func (mod *Model) DeleteObject(obj owl.Thing) (err error) {\n" +
	"\tif !mod.Exist(obj.IRI()) {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tg := mod.ToGraph()\n" +
	"\tn := g.Nodes[obj.IRI()]\n" +
	"\tfor i := range n.InverseEdge {\n" +
	"\t\tif subj, ok := mod.mThing[n.InverseEdge[i].Subject.Term.String()]; ok {\n" +
	"\t\t\tsubj.RemoveObject(obj, n.InverseEdge[i].Pred.String())\n" +
	"\t\t}\n" +
	"\t}\n" +
	"###deleteFromMaps###" +
	"\tdelete(mod.mThing, obj.IRI())\n" +
	"\treturn\n" +
	"}\n\n"

ModelDeleteObject template

View Source
var ModelExists = "// Exist checks for the existance of a resource by the given iri\n" +
	"func (mod *Model) Exist(iri string) (ret bool) {\n" +
	"\t_, ret = mod.mThing[iri]\n" +
	"\treturn\n" +
	"}\n\n"

ModelExists template

View Source
var ModelHeader = "package ###pkgName###\n\n" +
	"import (\n" +

	"\t\"git.rwth-aachen.de/acs/public/ontology/owl/owl2go/pkg/rdf\"\n" +
	"\t\"git.rwth-aachen.de/acs/public/ontology/owl/owl2go/pkg/owl\"\n" +
	"\t\"io\"\n" +
	")\n\n"

ModelHeader template

View Source
var ModelNew = "// NewModel creates a new model and initializes class maps\n" +
	"func NewModel() (mod *Model) {\n" +
	"\tmod = &Model{}\n" +
	"\tmod.mThing = make(map[string]owl.Thing)\n" +
	"###makeMaps###" +
	"\treturn\n" +
	"}\n\n"

ModelNew template

View Source
var ModelNewFromGraph = "// NewModelFromGraph creates a new model from a owl graph\n" +
	"func NewModelFromGraph(g rdf.Graph) (mod *Model, err error) {\n" +
	"\tmod = NewModel()\n" +
	"\tfor i := range g.Nodes {\n" +
	"\t\tfor j := range g.Nodes[i].Edge {\n" +
	"\t\t\tif g.Nodes[i].Edge[j].Pred.String() == \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\" {\n" +
	"\t\t\t\tswitch g.Nodes[i].Edge[j].Object.Term.String() {\n" +
	"###newObjects###" +
	"\t\t\t\tdefault:\n" +
	"\t\t\t\t}\n" +
	"\t\t\t}\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\tfor i := range g.Nodes {\n" +
	"\t\tif res, ok := mod.mThing[g.Nodes[i].Term.String()]; ok {\n" +
	"\t\t\tres.InitFromNode(g.Nodes[i])\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ModelNewFromGraph template

View Source
var ModelNewFromJSONLD = "// NewModelFromJSONLD creates a new model from a jsonld io reader\n" +
	"func NewModelFromJSONLD(input io.Reader) (mod *Model, err error) {\n" +
	"\ttriples, err := rdf.DecodeJSONLD(input)\n" +
	"\tif err != nil {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tg, err := rdf.NewGraph(triples)\n" +
	"\tif err != nil {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tmod, err = NewModelFromGraph(g)\n" +
	"\treturn\n" +
	"}\n\n"

ModelNewFromJSONLD template

View Source
var ModelNewFromTTL = "// NewModelFromTTL creates a new model from a ttl io reader\n" +
	"func NewModelFromTTL(input io.Reader) (mod *Model, err error) {\n" +
	"\ttriples, err := rdf.DecodeTTL(input)\n" +
	"\tif err != nil {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tg, err := rdf.NewGraph(triples)\n" +
	"\tif err != nil {\n" +
	"\t\treturn\n" +
	"\t}\n" +
	"\tmod, err = NewModelFromGraph(g)\n" +
	"\treturn\n" +
	"}\n\n"

ModelNewFromTTL template

View Source
var ModelString = "// String prints the model\n" +
	"func (mod *Model) String() (ret string) {\n" +
	"\tret = \"\"\n" +
	"\tfor i := range mod.mThing {\n" +
	"\t\tret += mod.mThing[i].String()\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ModelString template

View Source
var ModelStruct = "// Model holds all objects\n" +
	"type Model struct {\n" +
	"\tmThing map[string]owl.Thing\n" +
	"###objectMaps###" +
	"}\n\n"

ModelStruct template

View Source
var ModelToDot = "// ToDot writes a dot file from an existing model\n" +
	"func (mod* Model) ToDot(output io.Writer) (err error) {\n" +
	"\treplace := make(map[string]string)\n" +
	"\tshape := make(map[string]string)\n" +
	"###importReplace###" +
	"###importShape###" +
	"\treplace[\"http://www.wurvoc.org/vocabularies/om-1.8/\"] = \"om:\"\n" +
	"\treplace[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"] = \"rdf:\"\n" +
	"\treplace[\"http://www.w3.org/2000/01/rdf-schema#\"] = \"rdfs:\"\n" +
	"\tg := mod.ToGraph()\n" +
	"\tg.ToGraphvizDot(output, replace, shape)\n" +
	"\treturn\n" +
	"}\n\n"

ModelToDot template

View Source
var ModelToGraph = "// ToGraph extracts an owl graph from an existing model\n" +
	"func (mod* Model) ToGraph() (g *rdf.Graph) {\n" +
	"\tg = &rdf.Graph{}\n" +
	"\tg.Nodes = make(map[string]*rdf.Node)\n" +
	"\tfor i := range mod.mThing {\n" +
	"\t\tmod.mThing[i].ToGraph(g)\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

ModelToGraph template

View Source
var ModelToJSONLD = "// ToJSONLD writes a jsonld file from an existing model\n" +
	"func (mod* Model) ToJSONLD(output io.Writer) (err error) {\n" +
	"\tg := mod.ToGraph()\n" +
	"\tnewTriples := g.ToTriples()\n" +
	"\terr = rdf.EncodeJSONLD(newTriples, output)\n" +

	"\treturn\n" +
	"}\n\n"

ModelToJSONLD template

View Source
var ModelToTTL = "// ToTTL writes a ttl file from an existing model\n" +
	"func (mod* Model) ToTTL(output io.Writer) (err error) {\n" +
	"\tg := mod.ToGraph()\n" +
	"\tnewTriples := g.ToTriples()\n" +
	"\terr = rdf.EncodeTTL(newTriples, output)\n" +

	"\treturn\n" +
	"}\n\n"

ModelToTTL template

View Source
var MultiplicityMultiple = "Add"

MultiplicityMultiple template

View Source
var MultiplicitySingle = "Set"

MultiplicitySingle template

View Source
var NewImport = "\tmod.model###importName### = im###importName###.NewModel()\n"

NewImport template

View Source
var NewInitPropClassMultiple = "\tif v, ok := res.model.m###propType###[\"###value###\"]; ok {\n" +
	"\t\tres.Add###propCapital###(v)\n" +
	"\t}\n"

NewInitPropClassMultiple template

View Source
var NewInitPropClassSingle = "\tif v, ok := res.model.m###propType###[\"###value###\"]; ok {\n" +
	"\t\tres.Set###propCapital###(v)\n" +
	"\t}\n"

NewInitPropClassSingle template

View Source
var NewInitPropLiteralMultiple = "\tAdd###propCapital###(###value###)\n"

NewInitPropLiteralMultiple template

View Source
var NewInitPropLiteralSingle = "\tSet###propCapital###(###value###)\n"

NewInitPropLiteralSingle template

View Source
var NewMakeMap = "\tres.###propName### = make(map[string]###propType###)\n"

NewMakeMap template

View Source
var NewObject = "\t\t\t\tcase \"###classIRI###\":\n" +
	"\t\t\t\t\tmod.New###capImportName######className###(g.Nodes[i].Term.String())\n"

NewObject template

View Source
var NewObjectMap = "\tmod.m###className### = make(map[string]###className###)\n"

NewObjectMap template

View Source
var OSSHeader = "/*\n" +
	"This file is auto-generated by OWL2Go (https://git.rwth-aachen.de/acs/public/ontology/owl/owl2go).\n\n" +
	"Copyright 2020 Institute for Automation of Complex Power Systems,\n" +
	"E.ON Energy Research Center, RWTH Aachen University\n\n" +
	"This project is licensed under either of\n" +
	"- Apache License, Version 2.0\n" +
	"- MIT License\n" +
	"at your option.\n\n" +
	"Apache License, Version 2.0:\n\n" +
	"Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
	"you may not use this file except in compliance with the License.\n" +
	"You may obtain a copy of the License at\n\n" +
	"    http://www.apache.org/licenses/LICENSE-2.0\n\n" +
	"Unless required by applicable law or agreed to in writing, software\n" +
	"distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
	"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
	"See the License for the specific language governing permissions and\n" +
	"limitations under the License.\n\n" +
	"MIT License:\n\n" +
	"Permission is hereby granted, free of charge, to any person obtaining a copy\n" +
	"of this software and associated documentation files (the \"Software\"), to deal\n" +
	"in the Software without restriction, including without limitation the rights\n" +
	"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +
	"copies of the Software, and to permit persons to whom the Software is\n" +
	"furnished to do so, subject to the following conditions:\n\n" +
	"The above copyright notice and this permission notice shall be included in\n" +
	"all copies or substantial portions of the Software.\n\n" +
	"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" +
	"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +
	"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +
	"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +
	"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" +
	"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n" +
	"THE SOFTWARE.\n" +
	"*/\n\n"

OSSHeader template

View Source
var PropBool = "\t\tif obj, err := strconv.ParseBool(in); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropBool template

View Source
var PropClassBaseThing = "\t\tif obj, ok := res.model.mThing[pred.Object.Term.String()]; ok {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropClassBaseThing template

View Source
var PropClassDefault = "\t\tif obj, ok := res.model.m###propBaseType###[pred.Object.Term.String()]; ok {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropClassDefault template

View Source
var PropClassImport = "\t\tif temp := res.model.###capImportName######propBaseType###(pred.Object.Term.String()); len(temp) > 0 {\n" +
	"\t\t\tfor j := range temp {\n" +
	"\t\t\t\tif temp[j].IRI() == pred.Object.Term.String() {\n" +
	"\t\t\t\t\tres.###Multiplicity######propCapital###(temp[j])\n" +
	"\t\t\t\t}\n" +
	"\t\t\t}\n" +
	"\t\t}\n"

PropClassImport template

View Source
var PropDate = "\t\tif obj, err := time.Parse(\"2006-01-02Z07:00\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropDate template

View Source
var PropDateTime = "\t\tif obj, err := time.Parse(time.RFC3339, pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropDateTime template

View Source
var PropDateTimeStamp = "\t\tif obj, err := time.Parse(time.RFC3339, pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropDateTimeStamp template

View Source
var PropDuration = "\t\tif obj, err := owl.ParseXsdDuration(pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropDuration template

View Source
var PropFloat = "\t\tif obj, err := strconv.ParseFloat(pred.Object.Term.String(), 32); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(float64(obj))\n" +
	"\t\t}\n"

PropFloat template

View Source
var PropGDay = "\t\tif obj, err := time.Parse(\"---02\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropGDay template

View Source
var PropGMonth = "\t\tif obj, err := time.Parse(\"--01\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropGMonth template

View Source
var PropGYear = "\t\tif obj, err := time.Parse(\"2006\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropGYear template

View Source
var PropGYearMonth = "\t\tif obj, err := time.Parse(\"2006-01\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropGYearMonth template

View Source
var PropInitBool = "\tif obj, err := strconv.ParseBool(in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitBool template

View Source
var PropInitClassBaseThing = "\tif obj, ok := model.mThing[in]; ok {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitClassBaseThing template

View Source
var PropInitClassDefault = "\tif obj, ok := model.m###propBaseType###[in]; ok {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitClassDefault template

View Source
var PropInitClassImport = "\tif temp := model.###capImportName######propBaseType###(in); len(temp) > 0 {\n" +
	"\t\tfor j := range temp {\n" +
	"\t\t\tif temp[j].IRI() == in {\n" +
	"\t\t\t\tres.###Multiplicity######propCapital###(temp[j])\n" +
	"\t\t\t}\n" +
	"\t\t}\n" +
	"\t}\n"

PropInitClassImport template

View Source
var PropInitClassNonInverse = "\t\tres.###propLongName###.init(res.model, pred.Object.Term.String())\n"

PropInitClassNonInverse template

View Source
var PropInitDate = "\tif obj, err := time.Parse(\"2006-01-02Z07:00\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitDate template

View Source
var PropInitDateTime = "\tif obj, err := time.Parse(time.RFC3339, in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitDateTime template

View Source
var PropInitDateTimeStamp = "\tif obj, err := time.Parse(time.RFC3339, in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitDateTimeStamp template

View Source
var PropInitDuration = "\tif obj, err := owl.ParseXsdDuration(in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitDuration template

View Source
var PropInitFloat = "\tif obj, err := strconv.ParseFloat(in, 32); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(float64(obj))\n" +
	"\t}\n"

PropInitFloat template

View Source
var PropInitGDay = "\tif obj, err := time.Parse(\"---02\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitGDay template

View Source
var PropInitGMonth = "\tif obj, err := time.Parse(\"--01\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitGMonth template

View Source
var PropInitGYear = "\tif obj, err := time.Parse(\"2006\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitGYear template

View Source
var PropInitGYearMonth = "\tif obj, err := time.Parse(\"2006-01\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitGYearMonth template

View Source
var PropInitInt = "\tif obj, err := strconv.Atoi(in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitInt template

View Source
var PropInitInterface = "\tres.###Multiplicity######propCapital###(in)\n"

PropInitInterface template

View Source
var PropInitLiteralNonInverse = "\t\tres.###propLongName###.init(pred.Object.Term.String())\n"

PropInitLiteralNonInverse template

View Source
var PropInitString = "\tres.###Multiplicity######propCapital###(in)\n"

PropInitString template

View Source
var PropInitTime = "\tif obj, err := time.Parse(\"15:04:05Z07:00\", in); err == nil {\n" +
	"\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t}\n"

PropInitTime template

View Source
var PropInt = "\t\tif obj, err := strconv.Atoi(); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropInt template

View Source
var PropString = "\t\tres.###Multiplicity######propCapital###()\n"

PropString template

View Source
var PropTime = "\t\tif obj, err := time.Parse(\"15:04:05Z07:00\", pred.Object.Term.String()); err == nil {\n" +
	"\t\t\tres.###Multiplicity######propCapital###(obj)\n" +
	"\t\t}\n"

PropTime template

View Source
var PropertyAddClassMultiple = "// Add###propCapital### adds ###comment###\n" +
	"func (res *###propLongName###) Add###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"###addClassMultiple###" +
	"\t\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###propAllowedTypes###\")\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyAddClassMultiple template

View Source
var PropertyAddClassSingle = "// Add###propCapital### adds ###comment###\n" +
	"func (res *###propLongName###) Add###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +

	"\t\tres.###propName###[in[i].IRI()] = in[i]\n" +

	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyAddClassSingle template

View Source
var PropertyAddLiteral = "// Add###propCapital### adds ###comment###\n" +
	"func (res *###propLongName###) Add###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tres.###propName### = append(res.###propName###, in...)\n" +
	"\treturn\n" +
	"}\n\n"

PropertyAddLiteral template

View Source
var PropertyDelClassMultiple = "// Del###propCapital### deletes ###comment###\n" +
	"func (res *###propLongName###) Del###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"###delClassMultiple###" +
	"\t\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###propAllowedTypes###\")\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyDelClassMultiple template

View Source
var PropertyDelClassSingle = "// Del###propCapital### deletes ###comment###\n" +
	"func (res *###propLongName###) Del###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +

	"\t\tdelete(res.###propName###, in[i].IRI())\n" +

	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyDelClassSingle template

View Source
var PropertyDelLiteral = "// Del###propCapital### deletes ###comment###\n" +
	"func (res *###propLongName###) Del###propCapital###(in ...###propBaseType###) (err error) {\n" +
	"\tfor i := range in {\n" +
	"\t\tfor j := range res.###propName### {\n" +
	"\t\t\tif in[i] == res.###propName###[j] {\n" +
	"\t\t\t\tres.###propName### = append(res.###propName###[:j], res.###propName###[j:]...)\n" +
	"\t\t\t\tbreak\n" +
	"\t\t\t}\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyDelLiteral template

View Source
var PropertyGetMultipleClass = "// ###propCapital### ###comment###\n" +
	"func (res *###propLongName###) ###propCapital###() (out []###propBaseType###) {\n" +
	"\tout = make([]###propBaseType###, len(res.###propName###))\n" +
	"\tindex := 0\n" +
	"\tfor i := range res.###propName### {\n" +
	"\t\tout[index] = res.###propName###[i]\n" +
	"\t\tindex++\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyGetMultipleClass template

View Source
var PropertyGetMultipleLiteral = "// ###propCapital### ###comment###\n" +
	"func (res *###propLongName###) ###propCapital###() (out []###propBaseType###) {\n" +
	"\tout = res.###propName###\n" +
	"\treturn\n" +
	"}\n\n"

PropertyGetMultipleLiteral template

View Source
var PropertyGetSingle = "// ###propCapital### ###comment###\n" +
	"func (res *###propLongName###) ###propCapital###() (out ###propBaseType###) {\n" +
	"\tout = res.###propName###\n" +
	"\treturn\n" +
	"}\n\n"

PropertyGetSingle template

View Source
var PropertyGraphMultiple = "// toGraph adds all predicates corresponding to the property to an owl graph\n" +
	"func (res *###propLongName###) toGraph(node *rdf.Node, g *rdf.Graph) {\n" +
	"\tfor i := range res.###propName### {\n" +
	"###graphProp###" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyGraphMultiple template

View Source
var PropertyGraphSingle = "// toGraph adds all predicates corresponding to the property to an owl graph\n" +
	"func (res *###propLongName###) toGraph(node *rdf.Node, g *rdf.Graph) {\n" +
	"###graphProp###" +
	"\treturn\n" +
	"}\n\n"

PropertyGraphSingle template

View Source
var PropertyHeader = "package ###pkgName###\n\n" +
	"###propImports###"

PropertyHeader template

View Source
var PropertyIRI = "// IRI is the resource iri\n" +
	"func (res *propCommon) IRI() (out string) {\n" +
	"\tout = res.iri\n" +
	"\treturn\n" +
	"}\n\n"

PropertyIRI template

View Source
var PropertyInitClass = "// init initializes the property\n" +
	"func (res *###propLongName###) init(model *Model, in string) {\n" +
	"###PropInit###" +
	"\treturn\n" +
	"}\n\n"

PropertyInitClass template

View Source
var PropertyInitLiteral = "// init initializes the property\n" +
	"func (res *###propLongName###) init(in string) {\n" +
	"###PropInit###" +
	"\treturn\n" +
	"}\n\n"

PropertyInitLiteral template

View Source
var PropertyInterfaceMultiple = "// ###propName###Multiple###propBaseTypeNoImp### is interface for property ###propCapital### with multiple type ###propBaseType###\n" +
	"type ###propName###Multiple###propBaseTypeNoImp### interface {\n" +
	"\t###propCapital###() []###propBaseType### // ###comment###\n" +
	"\tSet###propCapital###([]###propBaseType###) error // set ###comment###\n" +
	"\tAdd###propCapital###(...###propBaseType###) error // add ###comment###\n" +
	"\tDel###propCapital###(...###propBaseType###) error // delete ###comment###\n" +
	"}\n\n"

PropertyInterfaceMultiple template

View Source
var PropertyInterfaceSingle = "// ###propName###Single###propBaseTypeNoImp### is interface for property ###propCapital### with single type ###propBaseType###\n" +
	"type ###propName###Single###propBaseTypeNoImp### interface {\n" +
	"\t###propCapital###() ###propBaseType### // ###comment###\n" +
	"\tSet###propCapital###(###propBaseType###) error // set ###comment###\n" +
	"}\n\n"

PropertyInterfaceSingle template

View Source
var PropertyMultipleRemove = "// removeObject removes object from property\n" +
	"func (res *###propLongName###) removeObject(obj owl.Thing) {\n" +
	"\tif v, ok := obj.(###propBaseType###); ok {\n" +
	"\t\tres.Del###propCapital###(v)\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertyMultipleRemove template

View Source
var PropertySetMultipleClass = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in []###propBaseType###) (err error) {\n" +
	"\tres.###propName### = make(map[string]###propType###)\n" +
	"\terr = res.Add###propCapital###(in...)\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetMultipleClass template

View Source
var PropertySetMultipleLiteral = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in []###propBaseType###) (err error) {\n" +
	"\tres.###propName### = in\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetMultipleLiteral template

View Source
var PropertySetSingleClassMultiple = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"###setSingleClassMultiple###" +
	"\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###propAllowedTypes###\")\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetSingleClassMultiple template

View Source
var PropertySetSingleClassSingle = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"\tres.###propName### = in\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetSingleClassSingle template

View Source
var PropertySetSingleLiteral = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"\tres.###propName### = in\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetSingleLiteral template

View Source
var PropertySetSingleLiteralMultiple = "// Set###propCapital### is setter of ###comment###\n" +
	"func (res *###propLongName###) Set###propCapital###(in ###propBaseType###) (err error) {\n" +
	"###setSingleLiteralMultiple###" +
	"\terr = errors.New(\"Wrong ###propType### type. Allowed types are ###propAllowedTypes###\")\n" +
	"\treturn\n" +
	"}\n\n"

PropertySetSingleLiteralMultiple template

View Source
var PropertySingleRemove = "// removeObject removes object from property\n" +
	"func (res *###propLongName###) removeObject(obj owl.Thing) {\n" +
	"\tif v, ok := obj.(###propBaseType###); ok {\n" +
	"\t\tif res.###propName###.IRI() == v.IRI() {\n" +
	"\t\t\tres.Set###propCapital###(nil)\n" +
	"\t\t}\n" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropertySingleRemove template

View Source
var PropertyStringMultiple = "// String prints the object into a string\n" +
	"func (res *###propLongName###) String() (ret string) {\n" +
	"\tret += \"\\t###propName###: [\"\n" +
	"\tfor i := range res.###propName### {\n" +
	"###stringProp###" +
	"\t}\n" +
	"\tret += \"]\\n\"\n" +
	"\treturn\n" +
	"}\n\n"

PropertyStringMultiple template

View Source
var PropertyStringSingle = "// String prints the object into a string\n" +
	"func (res *###propLongName###) String() (ret string) {\n" +
	"\tret += \"\\t###propName###: [\"\n" +
	"###stringProp###" +
	"\tret += \"]\\n\"\n" +
	"\treturn\n" +
	"}\n\n"

PropertyStringSingle template

View Source
var PropertyStructCommon = "type propCommon struct {\n" +
	"\tiri string // resource iri\n" +
	"\ttyp string // type of resource\n" +
	"\tmodel *Model // pointer to model\n" +
	"}\n\n"

PropertyStructCommon template

View Source
var PropertyStructMultipleClass = "// ###propLongName### is ###comment###\n" +
	"type ###propLongName### struct {\n" +
	"\t###propName### map[string]###propType###\n" +
	"}\n\n"

PropertyStructMultipleClass template

View Source
var PropertyStructMultipleLiteral = "// ###propLongName### is ###comment###\n" +
	"type ###propLongName### struct {\n" +
	"\t###propName### []###propType###\n" +
	"}\n\n"

PropertyStructMultipleLiteral template

View Source
var PropertyStructSingle = "// ###propLongName### is ###comment###\n" +
	"type ###propLongName### struct {\n" +
	"\t###propName### ###propType###\n" +
	"}\n\n"

PropertyStructSingle template

View Source
var PropsInit = "// propsInit initializes the property from a graph node\n" +
	"func (res *s###className###) propsInit(pred *rdf.Edge) (err error) {\n" +
	"\tswitch pred.Pred.String() {\n" +
	"###initSwitchProps###" +
	"\tdefault:\n" +
	"###parentPropInit###" +
	"\t}\n" +
	"\treturn\n" +
	"}\n\n"

PropsInit template

View Source
var PropsString = "// propsString prints the object into a string\n" +
	"func (res *s###className###) propsString() (ret string) {\n" +
	"\tret = \"\"\n" +
	"###stringProps###" +
	"\treturn\n" +
	"}\n\n"

PropsString template

View Source
var PropsToGraph = "// propsToGraph adds all properties to the graph\n" +
	"func (res *s###className###) propsToGraph(node *rdf.Node, g *rdf.Graph) {\n" +
	"###toGraphProps###" +
	"\treturn\n" +
	"}\n\n"

PropsToGraph template

View Source
var RemoveNonInverse = "\tcase \"###propIRI###\":\n" +
	"\t\tres.###propLongName.removeObject(obj)\n"

RemoveNonInverse template

View Source
var RemovePropMultiple = "\tcase \"###propIRI###\":\n" +
	"\t\tif v, ok := obj.(###propBaseType###); ok {\n" +
	"\t\t\tres.Del###propCapital###(v)\n" +
	"\t\t}\n"

RemovePropMultiple template

View Source
var RemovePropSingle = "\tcase \"###propIRI###\":\n" +
	"\t\tif v, ok := obj.(###propBaseType###); ok {\n" +
	"\t\t\tif res.###propName###.IRI() == v.IRI() {\n" +
	"\t\t\t\tres.Set###propCapital###(nil)\n" +
	"\t\t\t}\n" +
	"\t\t}\n"

RemovePropSingle template

View Source
var SetSingleClassMultiple = "\tif v, ok := in.(###propAllowedType###); ok {\n" +
	"\t\tres.###propName### = v\n" +
	"\t\treturn\n" +
	"\t}\n"

SetSingleClassMultiple template

View Source
var SetSingleLiteralMultiple = "\tif v, ok := in.(###propAllowedType###); ok {\n" +
	"\t\tres.###propName### = v\n" +
	"\t\treturn\n" +
	"\t}\n"

SetSingleLiteralMultiple template

View Source
var StringProp = "\tret += res.###propLongName###.String()\n"

StringProp template

View Source
var StringPropBool = "###indent###\tret += fmt.Sprintf(\"%v\", res.###propName######array###) + \", \"\n"

StringPropBool template

View Source
var StringPropClassMultiple = "\t\tret += res.###propName###[i].IRI() + \", \"\n"

StringPropClassMultiple template

View Source
var StringPropClassSingle = "\tif res.###propName### != nil {\n" +
	"\t\tret += res.###propName###.IRI() + \", \"\n" +
	"\t}\n"

StringPropClassSingle template

View Source
var StringPropFloat = "###indent###\tret += fmt.Sprintf(\"%f\", res.###propName######array###) + \", \"\n"

StringPropFloat template

View Source
var StringPropInt = "###indent###\tret += fmt.Sprintf(\"%d\", res.###propName######array###) + \", \"\n"

StringPropInt template

View Source
var StringPropInterface = "###indent###\tret += fmt.Sprintf(\"%v\", res.###propName######array###) + \", \"\n"

StringPropInterface template

View Source
var StringPropString = "###indent###\tret += res.###propName######array### + \", \"\n"

StringPropString template

View Source
var StringPropTime = "###indent###\tret += res.###propName######array###.String() + \", \"\n"

StringPropTime template

View Source
var StructImport = "\tmodel###importName### *im###importName###.Model\n"

StructImport template

View Source
var StructMap = "\tm###className### map[string]###className###\n"

StructMap template

View Source
var StructProperty = "\t###propLongName###\n"

StructProperty template

View Source
var ToGraphProp = "\tres.###propLongName###.toGraph(node, g)\n"

ToGraphProp template

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL