dataimport

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dataimport lowers the rows of a CSV, TSV, JSON or JSON Lines file to the edits that set the feature values they assign, one row per element, as `sysml -import` and the service's ImportData both apply them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lower

func Lower(idx *symbols.Index, resolver *resolve.Resolver, sem *semantics.Model, own func(doc string) bool, rows []ingest.Row) ([]Assignment, Summary, error)

Lower lowers rows to edits: a feature the element declares has its value set, one it inherits is redefined in the element's body with the value. own says whether a document is the model's own, so an element of another is refused.

func Read

func Read(name string, data []byte, opts Options) ([]ingest.Row, error)

Read reads the rows of data, a file named name, as opts say.

func ReadFile

func ReadFile(path, name, mapPath string, format string) ([]ingest.Row, error)

ReadFile reads the rows of the data file at path, named name in what goes wrong, with the mapping file at mapPath when one is named.

Types

type Assignment

type Assignment struct {
	// Op is the edit, on the document Doc at the declaration at offset At.
	Op  sedit.Operation
	Doc string
	At  int
	// Where is the row or cell of the data the assignment came from.
	Where string
	// Element is the qualified name of the element whose feature is set, Feature
	// the feature's name and Value the literal it is set to; Redefines is the
	// qualified name of the inherited feature redefined to set it, "" when the
	// element declares the feature itself. A redefinition made only to reach a
	// nested inherited feature sets no Value.
	Element   string
	Feature   string
	Value     string
	Redefines string
}

Assignment is one edit an import makes: the value it sets on a feature, or the redefinition it declares to set one, and where in the data it came from.

func (Assignment) Description

func (a Assignment) Description() string

Description spells the assignment as `sysml -import` reports it.

type Options

type Options struct {
	// Mapping is the JSON mapping, nil for the file's own header.
	Mapping []byte
	// Format is csv, tsv, json or jsonl; "" reads the mapping's, else the extension's.
	Format string
}

Options are how a data file is read: a mapping onto elements and features, and a format overriding the one its extension names.

type Summary

type Summary struct {
	Values   int
	Elements int
}

Summary counts what an import sets: the values, and the elements they are set on.

Jump to

Keyboard shortcuts

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