Documentation
¶
Index ¶
- Variables
- func Execute() error
- func LoadBundle(ctx *ls.Context, file []string) (ls.SchemaLoader, error)
- func LoadSchemaFromFileOrRepo(ctx *ls.Context, compiledSchema, repoDir, schemaName, typeName string, ...) (*ls.Layer, error)
- func LoadValuesetFiles(vs *Valuesets, files []string) error
- func OutputIngestedGraph(cmd *cobra.Command, outFormat string, target graph.Graph, wr io.Writer, ...) error
- func ReadLayers(input []byte, interner ls.Interner) ([]*ls.Layer, error)
- type Attribute
- type BaseIngestParams
- type Bundle
- type BundleSchemaRef
- type BundleVariant
- type CSVExport
- type CSVImportSpec
- type CSVIngester
- type ImportJSONSchemaRequest
- type JSONExport
- type JSONIngester
- type JSONSchemaReference
- type LS
- type Layer
- type OCStep
- type PipelineContext
- type ReadGraphStep
- type ReshapeStep
- type SliceByTermsSpec
- type SpreadsheetReference
- type Step
- type StepFunc
- type Valueset
- type ValuesetStep
- type ValuesetValue
- type Valuesets
- type WriteGraphStep
- type XMLIngester
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFileLoader = func(s string) (io.ReadCloser, error) { obj, err := cmdutil.ReadURL(s) if err != nil { return nil, err } return ioutil.NopCloser(bytes.NewReader(obj)), nil }
View Source
var ExportTarget = io.Writer(os.Stdout)
Functions ¶
func LoadBundle ¶
func LoadValuesetFiles ¶
func OutputIngestedGraph ¶
Types ¶
type Attribute ¶
type Attribute struct {
ID string `json:"@id"`
AttributeName string `json:"attributeName"`
Types string `json:"@type"`
}
Following structs are used to define a Layered Schema
type BaseIngestParams ¶
type BaseIngestParams struct {
Repo string `json:"repo" yaml:"repo"`
Schema string `json:"schema" yaml:"schema"`
Type string `json:"type" yaml:"type"`
Bundle []string `json:"bundle" yaml:"bundle"`
CompiledSchema string `json:"compiledSchema" yaml:"compiledSchema"`
EmbedSchemaNodes bool `json:"embedSchemaNodes" yaml:"embedSchemaNodes"`
OnlySchemaAttributes bool `json:"onlySchemaAttributes" yaml:"onlySchemaAttributes"`
}
func (BaseIngestParams) IsEmptySchema ¶
func (b BaseIngestParams) IsEmptySchema() bool
IsEmptySchema returns true if none of the schema properties are set
type Bundle ¶
type Bundle struct {
Base string `json:"base" yaml:"base"`
SchemaSpreadsheets []SpreadsheetReference `json:"schemaSpreadsheets" yaml:"schemaSpreadsheets"`
TypeNames map[string]*BundleVariant `json:"typeNames" yaml:"typeNames"`
}
Bundle defines type names for variants so references can be resolved
func ParseBundle ¶
ParseBundle parses a bundle from JSON
func (*Bundle) GetLayers ¶
func (bundle *Bundle) GetLayers(ctx *ls.Context, layers map[string]*ls.Layer, loader func(s string) (*ls.Layer, error), fileLoader func(string) (io.ReadCloser, error)) (map[string]*ls.Layer, error)
GetLayers returns the layers of the bundle keyed by variant type
func (Bundle) LoadSpreadsheets ¶
func (*Bundle) ResolveFilenames ¶
type BundleSchemaRef ¶
type BundleSchemaRef struct {
Schema string `json:"schema,omitempty" yaml:"schema,omitempty"`
LayerID string `json:"layerId,omitempty" yaml:"layerId,omitempty"`
JSONSchema *JSONSchemaReference `json:"jsonSchema" yaml:"jsonSchema"`
// contains filtered or unexported fields
}
func (BundleSchemaRef) GetLayerID ¶
func (ref BundleSchemaRef) GetLayerID() string
GetLayerID returns the layer id for the schema reference
func (*BundleSchemaRef) Merge ¶
func (b *BundleSchemaRef) Merge(ref BundleSchemaRef)
Merge resets b with ref if ref is nonempty
func (*BundleSchemaRef) ResolveFilenames ¶
func (ref *BundleSchemaRef) ResolveFilenames(dir string)
type BundleVariant ¶
type BundleVariant struct {
BundleSchemaRef
Overlays []BundleSchemaRef `json:"overlays" yaml:"overlays"`
}
BundleVariant combines a schema and overlays
func (*BundleVariant) Merge ¶
func (b *BundleVariant) Merge(variant BundleVariant)
Merge variant into b
func (*BundleVariant) ResolveFilenames ¶
func (b *BundleVariant) ResolveFilenames(dir string)
type CSVExport ¶
type CSVExport struct {
SpecFile string `json:"specFile" yaml:"specFile"`
lscsv.Writer
// contains filtered or unexported fields
}
func (*CSVExport) Run ¶
func (ecsv *CSVExport) Run(pipeline *PipelineContext) error
type CSVImportSpec ¶
type CSVImportSpec struct {
AttributeID string `json:"attributeId"`
LayerType string `json:"layerType"`
LayerID string `json:"layerId"`
RootID string `json:"rootId"`
ValueType string `json:"valueType"`
EntityIDRows []int `json:"entityIdRows"`
EntityID string `json:"entityId"`
Required string `json:"required"`
StartRow int `json:"startRow"`
NRows int `json:"nrows"`
Terms []dec.TermSpec `json:"terms"`
}
type CSVIngester ¶
type CSVIngester struct {
BaseIngestParams
StartRow int `json:"startRow" yaml:"startRow"`
EndRow int `json:"endRow" yaml:"endRow"`
HeaderRow int `json:"headerRow" yaml:"headerRow"`
ID string `json:"id" yaml:"id"`
IngestByRows bool `json:"ingestByRows" yaml:"ingestByRows"`
// contains filtered or unexported fields
}
func (CSVIngester) Help ¶
func (CSVIngester) Help()
func (*CSVIngester) Run ¶
func (ci *CSVIngester) Run(pipeline *PipelineContext) error
type ImportJSONSchemaRequest ¶
type ImportJSONSchemaRequest struct {
Entities []jsonsch.Entity `json:"entities"`
SchemaID string `json:"schemaId"`
Schema string `json:"schemaVariant"`
Layers []SliceByTermsSpec `json:"layers"`
}
func (*ImportJSONSchemaRequest) CompileAndImport ¶
func (req *ImportJSONSchemaRequest) CompileAndImport() (graph.Graph, []jsonsch.EntityLayer, error)
func (*ImportJSONSchemaRequest) Slice ¶
func (req *ImportJSONSchemaRequest) Slice(index int, item jsonsch.EntityLayer) ([]*ls.Layer, error)
type JSONExport ¶
type JSONExport struct{}
func (JSONExport) Help ¶
func (JSONExport) Help()
func (*JSONExport) Run ¶
func (*JSONExport) Run(pipeline *PipelineContext) error
type JSONIngester ¶
type JSONIngester struct {
BaseIngestParams
ID string
// contains filtered or unexported fields
}
func (JSONIngester) Help ¶
func (JSONIngester) Help()
func (*JSONIngester) Run ¶
func (ji *JSONIngester) Run(pipeline *PipelineContext) error
type JSONSchemaReference ¶
type JSONSchemaReference struct {
// Refer to a layer by ID. Layer can be imported as a spreadsheet
LayerID string `json:"layerId" yaml:"layerId" bson:"layerId"`
// This is the filename
Ref string `json:"ref" yaml:"ref" bson:"ref"`
Namespace string `json:"namespace" yaml:"namespace" bson:"namespace"`
}
type OCStep ¶
type OCStep struct {
Expr string
}
func (*OCStep) Run ¶
func (oc *OCStep) Run(pipeline *PipelineContext) error
type PipelineContext ¶
type PipelineContext struct {
*ls.Context
Graph graph.Graph
Roots []graph.Node
InputFiles []string
Properties map[string]interface{}
// contains filtered or unexported fields
}
func (*PipelineContext) Next ¶
func (ctx *PipelineContext) Next() error
type ReadGraphStep ¶
type ReadGraphStep struct {
Format string
}
func NewReadGraphStep ¶
func NewReadGraphStep(cmd *cobra.Command) ReadGraphStep
func (ReadGraphStep) Run ¶
func (rd ReadGraphStep) Run(pipeline *PipelineContext) error
type ReshapeStep ¶
type ReshapeStep struct {
BaseIngestParams
// contains filtered or unexported fields
}
func (ReshapeStep) Help ¶
func (ReshapeStep) Help()
func (*ReshapeStep) Run ¶
func (rs *ReshapeStep) Run(pipeline *PipelineContext) error
type SliceByTermsSpec ¶
type SpreadsheetReference ¶
type SpreadsheetReference struct {
File string `json:"file" yaml:"file"`
Spec *CSVImportSpec `json:"spec" yaml:"spec"`
Context []interface{} `json:"context" yaml:"context"`
}
type Step ¶
type Step interface {
Run(*PipelineContext) error
}
type StepFunc ¶
type StepFunc func(*PipelineContext) error
func (StepFunc) Run ¶
func (f StepFunc) Run(ctx *PipelineContext) error
type Valueset ¶
type Valueset struct {
ID string `json:"id" yaml:"id"`
Values []ValuesetValue `json:"values" yaml:"values"`
}
func (Valueset) Lookup ¶
func (vs Valueset) Lookup(req ls.ValuesetLookupRequest) (ls.ValuesetLookupResponse, error)
type ValuesetStep ¶
type ValuesetStep struct {
BaseIngestParams
ValuesetFiles []string `json:"valuesetFiles" yaml:"valuesetFiles"`
// contains filtered or unexported fields
}
func (ValuesetStep) Help ¶
func (ValuesetStep) Help()
func (*ValuesetStep) Run ¶
func (vs *ValuesetStep) Run(pipeline *PipelineContext) error
type ValuesetValue ¶
type ValuesetValue struct {
// Possible input values
Values []string `json:"values" yaml:"values"`
// Possible input value as key-value pairs
KeyValues map[string]string `json:"keyValues" yaml:"keyValues"`
CaseSensitive bool `json:"caseSensitive" yaml:"caseSensitive"`
// Result output value
Result string `json:"result" yaml:"result"`
// Result output values as key-value pairs
ResultValues map[string]string `json:"results" yaml:"results"`
}
func (ValuesetValue) IsDefault ¶
func (v ValuesetValue) IsDefault() bool
func (ValuesetValue) Match ¶
func (v ValuesetValue) Match(req ls.ValuesetLookupRequest) (*ls.ValuesetLookupResponse, error)
type Valuesets ¶
func (Valuesets) Lookup ¶
func (vsets Valuesets) Lookup(ctx *ls.Context, req ls.ValuesetLookupRequest) (ls.ValuesetLookupResponse, error)
Lookup can be used as the external lookup func of LookupProcessor
type WriteGraphStep ¶
func NewWriteGraphStep ¶
func NewWriteGraphStep(cmd *cobra.Command) WriteGraphStep
func (WriteGraphStep) Help ¶
func (WriteGraphStep) Help()
func (WriteGraphStep) Run ¶
func (wr WriteGraphStep) Run(pipeline *PipelineContext) error
type XMLIngester ¶
type XMLIngester struct {
BaseIngestParams
ID string
// contains filtered or unexported fields
}
func (XMLIngester) Help ¶
func (XMLIngester) Help()
func (*XMLIngester) Run ¶
func (xml *XMLIngester) Run(pipeline *PipelineContext) error
Source Files
¶
- applylayer.go
- compact.go
- compile.go
- compose.go
- dot.go
- expand.go
- export.go
- export_csv.go
- export_json.go
- flatten.go
- frame.go
- getschema.go
- getschema_csv.go
- getschema_json.go
- import.go
- import_csv.go
- import_json.go
- ingest.go
- ingest_csv.go
- ingest_json.go
- ingest_xml.go
- oc.go
- pipeline.go
- reshape.go
- root.go
- schema.go
- slice.go
- template.go
- validate.go
- validate_json.go
- valueset.go
Click to show internal directories.
Click to hide internal directories.