diff --git a/go.mod b/go.mod index 0e269785..7bb7a195 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( require ( github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210803070921-b358b509191a // indirect - github.com/cloudprivacylabs/opencypher v1.0.0-beta-8 + github.com/cloudprivacylabs/opencypher v1.0.0-beta-9 ) require ( diff --git a/go.sum b/go.sum index d798f902..1535e5c9 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ github.com/cloudprivacylabs/lpg v1.0.10 h1:QF849RJGz4RyFvrLEutjXVNwaefnnLMtImMVe github.com/cloudprivacylabs/lpg v1.0.10/go.mod h1:3bLpI1OIk3h/ZVfGhq3sdULexmVbd7qANVhVSYbvCe8= github.com/cloudprivacylabs/opencypher v1.0.0-beta-8 h1:krJC4yBPSgX25P3bt8q6RWexhMsACwIrG6PguWsqV38= github.com/cloudprivacylabs/opencypher v1.0.0-beta-8/go.mod h1:3Ttn9wqZrtJxAFhmT16PUrS3O3cbJwWrI5cr08kh8nw= +github.com/cloudprivacylabs/opencypher v1.0.0-beta-9 h1:ziarbKpRQiZ58dE8GyyYPrkVC+ABo7sADTotPILpBV4= +github.com/cloudprivacylabs/opencypher v1.0.0-beta-9/go.mod h1:3Ttn9wqZrtJxAFhmT16PUrS3O3cbJwWrI5cr08kh8nw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= diff --git a/layers/cmd/ingest_csv_test.go b/layers/cmd/ingest_csv_test.go index 7110ddc6..1902f2fa 100644 --- a/layers/cmd/ingest_csv_test.go +++ b/layers/cmd/ingest_csv_test.go @@ -2,6 +2,7 @@ package cmd import ( "encoding/json" + "fmt" "os" "testing" @@ -10,6 +11,15 @@ import ( "github.com/cloudprivacylabs/lsa/pkg/ls" ) +type captureStep struct { + graphs []*lpg.Graph +} + +func (c *captureStep) Run(ctx *pipeline.PipelineContext) error { + c.graphs = append(c.graphs, ctx.Graph) + return nil +} + func TestCSVJoinIngest(t *testing.T) { cji := CSVJoinIngester{ BaseIngestParams: BaseIngestParams{ @@ -37,45 +47,49 @@ func TestCSVJoinIngest(t *testing.T) { }, } cji.ingester = make(map[string]*ls.Ingester) + capture := captureStep{} p := []pipeline.Step{ &cji, + &capture, } pctx := pipeline.NewContext(ls.DefaultContext(), p, nil, pipeline.InputsFromFiles([]string{"testdata/csvjoin.csv"})) - err := cji.Run(pctx) + err := pctx.Next() if err != nil { t.Error(err) } - m := ls.JSONMarshaler{} - f, err := os.Open("testdata/csvjoiningest-test.json") - if err != nil { - t.Error(err) - } - expectedGraph := lpg.NewGraph() - err = m.Decode(expectedGraph, json.NewDecoder(f)) - if err != nil { - t.Error(err) + if len(capture.graphs) == 0 { + t.Errorf("No graphs") } - eq := lpg.CheckIsomorphism(pctx.Graph, expectedGraph, func(n1, n2 *lpg.Node) bool { - // t.Logf("Cmp: %+v %+v\n", n1, n2) - if !n1.GetLabels().IsEqual(n2.GetLabels()) { - return false + for i := range capture.graphs { + m := ls.JSONMarshaler{} + f, err := os.Open(fmt.Sprintf("testdata/csvjoiningest-test-%d.json", i)) + if err != nil { + t.Error(err) + return } - if !ls.IsPropertiesEqual(ls.PropertiesAsMap(n1), ls.PropertiesAsMap(n2)) { - return false + expectedGraph := lpg.NewGraph() + err = m.Decode(expectedGraph, json.NewDecoder(f)) + if err != nil { + t.Error(err) } - return true - }, func(e1, e2 *lpg.Edge) bool { - return e1.GetLabel() == e2.GetLabel() && ls.IsPropertiesEqual(ls.PropertiesAsMap(e1), ls.PropertiesAsMap(e2)) - }) - - if !eq { - result, _ := m.Marshal(pctx.Graph) - expected, _ := m.Marshal(expectedGraph) - t.Errorf("Result is different from the expected: Result:\n%s\nExpected:\n%s", string(result), string(expected)) - } + eq := lpg.CheckIsomorphism(capture.graphs[i], expectedGraph, func(n1, n2 *lpg.Node) bool { + // t.Logf("Cmp: %+v %+v\n", n1, n2) + if !n1.GetLabels().IsEqual(n2.GetLabels()) { + return false + } + if !ls.IsPropertiesEqual(ls.PropertiesAsMap(n1), ls.PropertiesAsMap(n2)) { + return false + } + return true + }, func(e1, e2 *lpg.Edge) bool { + return e1.GetLabel() == e2.GetLabel() && ls.IsPropertiesEqual(ls.PropertiesAsMap(e1), ls.PropertiesAsMap(e2)) + }) - if err != nil { - t.Error(err) + if !eq { + result, _ := m.Marshal(capture.graphs[i]) + expected, _ := m.Marshal(expectedGraph) + t.Errorf("Result is different from the expected: Result:\n%s\nExpected:\n%s", string(result), string(expected)) + } } } @@ -105,71 +119,79 @@ func TestCSVJoinLinkedIngest(t *testing.T) { }, }, } + capture := captureStep{} cji.ingester = make(map[string]*ls.Ingester) p := []pipeline.Step{ &cji, + &capture, } pctx := pipeline.NewContext(ls.DefaultContext(), p, nil, pipeline.InputsFromFiles([]string{"testdata/csvjoin.csv"})) - err := cji.Run(pctx) + err := pctx.Next() if err != nil { t.Error(err) } - m := ls.JSONMarshaler{} - f, err := os.Open("testdata/csvjoiningest-linked-test.json") - expectedGraph := lpg.NewGraph() - err = m.Decode(expectedGraph, json.NewDecoder(f)) - if err != nil { - t.Error(err) + if len(capture.graphs) == 0 { + t.Errorf("No graphs") } - eq := lpg.CheckIsomorphism(pctx.Graph, expectedGraph, func(n1, n2 *lpg.Node) bool { - // t.Logf("Cmp: %+v %+v\n", n1, n2) - if !n1.GetLabels().IsEqual(n2.GetLabels()) { - return false + for i := range capture.graphs { + m := ls.JSONMarshaler{} + f, err := os.Open(fmt.Sprintf("testdata/csvjoiningest-linked-test-%d.json", i)) + if err != nil { + t.Error(err) + return } - s1, _ := ls.GetRawNodeValue(n1) - s2, _ := ls.GetRawNodeValue(n2) - if s1 != s2 { - return false + + expectedGraph := lpg.NewGraph() + err = m.Decode(expectedGraph, json.NewDecoder(f)) + if err != nil { + t.Error(err) } - // Expected properties must be a subset - propertiesOK := true - n2.ForEachProperty(func(k string, v interface{}) bool { - pv, ok := v.(*ls.PropertyValue) - if !ok { - return true - } - v2, ok := n1.GetProperty(k) - if !ok { - propertiesOK = false + eq := lpg.CheckIsomorphism(capture.graphs[i], expectedGraph, func(n1, n2 *lpg.Node) bool { + // t.Logf("Cmp: %+v %+v\n", n1, n2) + if !n1.GetLabels().IsEqual(n2.GetLabels()) { return false } - pv2, ok := v2.(*ls.PropertyValue) - if !ok { - propertiesOK = false + s1, _ := ls.GetRawNodeValue(n1) + s2, _ := ls.GetRawNodeValue(n2) + if s1 != s2 { return false } - if !pv2.IsEqual(pv) { - propertiesOK = false + // Expected properties must be a subset + propertiesOK := true + n2.ForEachProperty(func(k string, v interface{}) bool { + pv, ok := v.(*ls.PropertyValue) + if !ok { + return true + } + v2, ok := n1.GetProperty(k) + if !ok { + propertiesOK = false + return false + } + pv2, ok := v2.(*ls.PropertyValue) + if !ok { + propertiesOK = false + return false + } + if !pv2.IsEqual(pv) { + propertiesOK = false + return false + } + return true + }) + if !propertiesOK { return false } + t.Logf("True\n") return true + }, func(e1, e2 *lpg.Edge) bool { + return e1.GetLabel() == e2.GetLabel() && ls.IsPropertiesEqual(ls.PropertiesAsMap(e1), ls.PropertiesAsMap(e2)) }) - if !propertiesOK { - return false - } - t.Logf("True\n") - return true - }, func(e1, e2 *lpg.Edge) bool { - return e1.GetLabel() == e2.GetLabel() && ls.IsPropertiesEqual(ls.PropertiesAsMap(e1), ls.PropertiesAsMap(e2)) - }) - - if !eq { - result, _ := m.Marshal(pctx.Graph) - expected, _ := m.Marshal(expectedGraph) - t.Errorf("Result is different from the expected: Result:\n%s\nExpected:\n%s", string(result), string(expected)) - } - if err != nil { - t.Error(err) + if !eq { + result, _ := m.Marshal(capture.graphs[i]) + expected, _ := m.Marshal(expectedGraph) + t.Errorf("Result is different from the expected: Result:\n%s\nExpected:\n%s", string(result), string(expected)) + } } } diff --git a/layers/cmd/testdata/csvjoiningest-linked-test-0.json b/layers/cmd/testdata/csvjoiningest-linked-test-0.json new file mode 100644 index 00000000..855b9830 --- /dev/null +++ b/layers/cmd/testdata/csvjoiningest-linked-test-0.json @@ -0,0 +1,2 @@ +{"nodes":[{"n":5,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_1.D1","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"X"}},{"n":8,"labels":["Bar","https://lschema.org/Object","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":9,"label":"https://lschema.org/has"},{"to":10,"label":"https://lschema.org/has"},{"to":11,"label":"https://lschema.org/has"}]},{"n":10,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"K"}},{"n":15,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"S"}},{"n":3,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_1.C1","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"C"}},{"n":7,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_1.F1","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"Z"}},{"n":12,"labels":["Bar","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":13,"label":"https://lschema.org/has"},{"to":14,"label":"https://lschema.org/has"},{"to":15,"label":"https://lschema.org/has"}]},{"n":9,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"J"}},{"n":1,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_1.A1","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"A"}},{"n":2,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_1.B1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"B"}},{"n":4,"labels":["https://lschema.org/Object","Foo","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Foo/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":5,"label":"https://lschema.org/has"},{"to":6,"label":"https://lschema.org/has"},{"to":7,"label":"https://lschema.org/has"}]},{"n":6,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_1.E1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"Y"}},{"n":0,"labels":["Patient","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Patient/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":1,"label":"https://lschema.org/has"},{"to":2,"label":"https://lschema.org/has"},{"to":3,"label":"https://lschema.org/has"}]},{"n":11,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"L"}},{"n":13,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"Q"}},{"n":14,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"R"}}]} + diff --git a/layers/cmd/testdata/csvjoiningest-linked-test-1.json b/layers/cmd/testdata/csvjoiningest-linked-test-1.json new file mode 100644 index 00000000..60710f58 --- /dev/null +++ b/layers/cmd/testdata/csvjoiningest-linked-test-1.json @@ -0,0 +1,3 @@ + + +{"nodes":[{"n":0,"labels":["https://lschema.org/Object","Patient","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Patient/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":1,"label":"https://lschema.org/has"},{"to":2,"label":"https://lschema.org/has"},{"to":3,"label":"https://lschema.org/has"}]},{"n":3,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_3.C1","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"3"}},{"n":7,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_3.F1","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"6"}},{"n":2,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_3.B1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"2"}},{"n":4,"labels":["Foo","https://lschema.org/Object","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Foo/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":5,"label":"https://lschema.org/has"},{"to":6,"label":"https://lschema.org/has"},{"to":7,"label":"https://lschema.org/has"}]},{"n":5,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_3.D1","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"4"}},{"n":6,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_3.E1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"5"}},{"n":11,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"9"}},{"n":14,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"U"}},{"n":1,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_3.A1","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"1"}},{"n":9,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"7"}},{"n":10,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"8"}},{"n":12,"labels":["Bar","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":13,"label":"https://lschema.org/has"},{"to":14,"label":"https://lschema.org/has"},{"to":15,"label":"https://lschema.org/has"}]},{"n":13,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"T"}},{"n":15,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"V"}},{"n":8,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Bar"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":9,"label":"https://lschema.org/has"},{"to":10,"label":"https://lschema.org/has"},{"to":11,"label":"https://lschema.org/has"}]}]} diff --git a/layers/cmd/testdata/csvjoiningest-linked-test.json b/layers/cmd/testdata/csvjoiningest-linked-test.json deleted file mode 100644 index 0253961e..00000000 --- a/layers/cmd/testdata/csvjoiningest-linked-test.json +++ /dev/null @@ -1 +0,0 @@ -{"nodes":[{"n":4,"labels":["Foo","https://lschema.org/Object","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":5,"label":"https://lschema.org/has"},{"to":6,"label":"https://lschema.org/has"},{"to":7,"label":"https://lschema.org/has"}]},{"n":16,"labels":["https://lschema.org/Object","Patient","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":17,"label":"https://lschema.org/has"},{"to":18,"label":"https://lschema.org/has"},{"to":19,"label":"https://lschema.org/has"}]},{"n":14,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"R"}},{"n":17,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_3.0","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"1"}},{"n":30,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"U"}},{"n":6,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_1.1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"Y"}},{"n":18,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_3.1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"2"}},{"n":21,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_3.0","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"4"}},{"n":28,"labels":["Bar","https://lschema.org/Object","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":29,"label":"https://lschema.org/has"},{"to":30,"label":"https://lschema.org/has"},{"to":31,"label":"https://lschema.org/has"}]},{"n":1,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_1.0","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"A"}},{"n":8,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Bar"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":9,"label":"https://lschema.org/has"},{"to":10,"label":"https://lschema.org/has"},{"to":11,"label":"https://lschema.org/has"}]},{"n":9,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.0","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"J"}},{"n":15,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.2","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"S"}},{"n":7,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_1.2","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"Z"}},{"n":25,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.0","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"7"}},{"n":26,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"8"}},{"n":31,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.2","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"V"}},{"n":19,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_3.2","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"3"}},{"n":22,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_3.1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"5"}},{"n":23,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_3.2","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"6"}},{"n":24,"labels":["Bar","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":25,"label":"https://lschema.org/has"},{"to":26,"label":"https://lschema.org/has"},{"to":27,"label":"https://lschema.org/has"}]},{"n":0,"labels":["https://lschema.org/Object","Patient","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":1,"label":"https://lschema.org/has"},{"to":2,"label":"https://lschema.org/has"},{"to":3,"label":"https://lschema.org/has"}]},{"n":11,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.2","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"L"}},{"n":12,"labels":["Bar","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":13,"label":"https://lschema.org/has"},{"to":14,"label":"https://lschema.org/has"},{"to":15,"label":"https://lschema.org/has"}]},{"n":13,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.0","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"Q"}},{"n":29,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.0","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"T"}},{"n":2,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_1.1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"B"}},{"n":3,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_1.2","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"C"}},{"n":5,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_1.0","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"X"}},{"n":10,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"K"}},{"n":20,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Foo"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":21,"label":"https://lschema.org/has"},{"to":22,"label":"https://lschema.org/has"},{"to":23,"label":"https://lschema.org/has"}]},{"n":27,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.2","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"9"}}]} diff --git a/layers/cmd/testdata/csvjoiningest-test-0.json b/layers/cmd/testdata/csvjoiningest-test-0.json new file mode 100644 index 00000000..4734227e --- /dev/null +++ b/layers/cmd/testdata/csvjoiningest-test-0.json @@ -0,0 +1,2 @@ +{"nodes":[{"n":4,"labels":["Foo","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Foo/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":5,"label":"https://lschema.org/has"},{"to":6,"label":"https://lschema.org/has"},{"to":7,"label":"https://lschema.org/has"}]},{"n":14,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"R"}},{"n":12,"labels":["Bar","https://lschema.org/Object","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":13,"label":"https://lschema.org/has"},{"to":14,"label":"https://lschema.org/has"},{"to":15,"label":"https://lschema.org/has"}]},{"n":13,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"Q"}},{"n":15,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"S"}},{"n":10,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_1.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"K"}},{"n":11,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_1.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"L"}},{"n":5,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_1.D1","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"X"}},{"n":0,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Patient"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Patient/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":1,"label":"https://lschema.org/has"},{"to":2,"label":"https://lschema.org/has"},{"to":3,"label":"https://lschema.org/has"}]},{"n":1,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_1.A1","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"A"}},{"n":6,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_1.E1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"Y"}},{"n":7,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_1.F1","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"Z"}},{"n":8,"labels":["https://lschema.org/Object","https://lschema.org/DocumentNode","Bar"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_1","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":9,"label":"https://lschema.org/has"},{"to":10,"label":"https://lschema.org/has"},{"to":11,"label":"https://lschema.org/has"}]},{"n":9,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_1.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"J"}},{"n":2,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_1.B1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"B"}},{"n":3,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_1.C1","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"C"}}]} + diff --git a/layers/cmd/testdata/csvjoiningest-test-1.json b/layers/cmd/testdata/csvjoiningest-test-1.json new file mode 100644 index 00000000..74e71275 --- /dev/null +++ b/layers/cmd/testdata/csvjoiningest-test-1.json @@ -0,0 +1,2 @@ + {"nodes":[{"n":0,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Patient"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Patient/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Patient"},"edges":[{"to":1,"label":"https://lschema.org/has"},{"to":2,"label":"https://lschema.org/has"},{"to":3,"label":"https://lschema.org/has"}]},{"n":7,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"F1","https://lschema.org/nodeId":"row_3.F1","https://lschema.org/schemaNodeId":"http://example.org/Foo/F1","https://lschema.org/value":"6"}},{"n":8,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Bar"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":9,"label":"https://lschema.org/has"},{"to":10,"label":"https://lschema.org/has"},{"to":11,"label":"https://lschema.org/has"}]},{"n":15,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"V"}},{"n":1,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"A1","https://lschema.org/nodeId":"row_3.A1","https://lschema.org/schemaNodeId":"http://example.org/Patient/A1","https://lschema.org/value":"1"}},{"n":4,"labels":["Foo","https://lschema.org/DocumentNode","https://lschema.org/Object"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Foo/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Foo"},"edges":[{"to":5,"label":"https://lschema.org/has"},{"to":6,"label":"https://lschema.org/has"},{"to":7,"label":"https://lschema.org/has"}]},{"n":11,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"I1","https://lschema.org/nodeId":"row_3.I1","https://lschema.org/schemaNodeId":"http://example.org/Bar/I1","https://lschema.org/value":"9"}},{"n":12,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Object","Bar"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/entitySchema":"http://example.org/Bar/schema","https://lschema.org/nodeId":"row_3","https://lschema.org/schemaNodeId":"http://example.org/Bar"},"edges":[{"to":13,"label":"https://lschema.org/has"},{"to":14,"label":"https://lschema.org/has"},{"to":15,"label":"https://lschema.org/has"}]},{"n":14,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"U"}},{"n":2,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"B1","https://lschema.org/nodeId":"row_3.B1","https://lschema.org/schemaNodeId":"http://example.org/Patient/B1","https://lschema.org/value":"2"}},{"n":3,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"2","https://lschema.org/attributeName":"C1","https://lschema.org/nodeId":"row_3.C1","https://lschema.org/schemaNodeId":"http://example.org/Patient/C1","https://lschema.org/value":"3"}},{"n":5,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"D1","https://lschema.org/nodeId":"row_3.D1","https://lschema.org/schemaNodeId":"http://example.org/Foo/D1","https://lschema.org/value":"4"}},{"n":6,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"E1","https://lschema.org/nodeId":"row_3.E1","https://lschema.org/schemaNodeId":"http://example.org/Foo/E1","https://lschema.org/value":"5"}},{"n":9,"labels":["https://lschema.org/Value","https://lschema.org/DocumentNode"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"7"}},{"n":10,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"1","https://lschema.org/attributeName":"H1","https://lschema.org/nodeId":"row_3.H1","https://lschema.org/schemaNodeId":"http://example.org/Bar/H1","https://lschema.org/value":"8"}},{"n":13,"labels":["https://lschema.org/DocumentNode","https://lschema.org/Value"],"properties":{"https://lschema.org/attributeIndex":"0","https://lschema.org/attributeName":"G1","https://lschema.org/nodeId":"row_3.G1","https://lschema.org/schemaNodeId":"http://example.org/Bar/G1","https://lschema.org/value":"T"}}]} + diff --git a/layers/cmd/testdata/csvjoiningest-test.json b/layers/cmd/testdata/csvjoiningest-test-2.json similarity index 100% rename from layers/cmd/testdata/csvjoiningest-test.json rename to layers/cmd/testdata/csvjoiningest-test-2.json