11import { DataFactory , Parser , Store } from "n3"
22import assert from "node:assert"
33import { describe , it } from "node:test"
4- import { Parent } from "./model/Parent .js"
4+ import { MyDataset } from "./model/MyDataset .js"
55import { Child } from "./model/Child.js"
66import { SomeModelClass } from "./model/SomeModelClass.js"
77
@@ -21,34 +21,33 @@ prefix : <https://example.org/>
2121] .
2222` ;
2323
24- const dataset = new Store ( ) ;
25- dataset . addQuads ( new Parser ( ) . parse ( rdf ) ) ;
26- const x = DataFactory . namedNode ( "x" )
27-
28- const p = new Parent ( x , dataset , DataFactory )
24+ const store = new Store ( )
25+ store . addQuads ( new Parser ( ) . parse ( rdf ) ) ;
26+ const dataset = new MyDataset ( store , DataFactory )
2927
28+ for ( const p of dataset . parents ) {
29+ assert . equal ( "o1" , p . hasString )
30+ assert . equal ( "name" , p . hasChild . hasName )
31+ for ( const c of p . hasChildSet ) {
32+ // TODO: assertions
33+ console . log ( "p.hasChildSet.hasName" , c . hasName ) ;
34+ }
3035
31- assert . equal ( "o1" , p . hasString )
32- assert . equal ( "name" , p . hasChild . hasName )
33- for ( const c of p . hasChildSet ) {
34- // TODO: assertions
35- console . log ( "p.hasChildSet.hasName" , c . hasName ) ;
36- }
37-
38- p . hasString = "x"
39- assert . equal ( "x" , p . hasString )
36+ p . hasString = "x"
37+ assert . equal ( "x" , p . hasString )
4038
41- const newNode = DataFactory . namedNode ( "example.com/s" )
42- const newChild = new Child ( newNode , dataset , DataFactory )
43- newChild . hasName = "new name"
44- p . hasChild = newChild
39+ const newNode = DataFactory . namedNode ( "example.com/s" )
40+ const newChild = new Child ( newNode , dataset , DataFactory )
41+ newChild . hasName = "new name"
42+ p . hasChild = newChild
4543
46- assert . equal ( "new name" , p . hasChild . hasName )
44+ assert . equal ( "new name" , p . hasChild . hasName )
4745
48- p . hasChildSet . add ( newChild )
49- for ( const c of p . hasChildSet ) {
50- // TODO: assertions
51- console . log ( "p.hasChildSet.hasName modified" , c . hasName ) ;
46+ p . hasChildSet . add ( newChild )
47+ for ( const c of p . hasChildSet ) {
48+ // TODO: assertions
49+ console . log ( "p.hasChildSet.hasName modified" , c . hasName ) ;
50+ }
5251 }
5352 } )
5453
0 commit comments