Skip to content

Commit a8dc12d

Browse files
36 Coordinate self reference (#40)
* Set theme jekyll-theme-slate * Create index.md Initialise GH pages * Fix incorrect creation of var to var references * Add alias to test
1 parent a687d3e commit a8dc12d

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

binary-array-ld-cli/src/test/kotlin/net/bald/BinaryArrayConvertCliTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ class BinaryArrayConvertCliTest {
496496
statement(BALD.contains, createResource("http://test.binary-array-ld.net/example/")) {
497497
statement(RDF.type, BALD.Container)
498498
statement(BALD.contains, createResource("http://test.binary-array-ld.net/example/var0"), sortAnon = ::sortRefs) {
499+
statement(createProperty("${TestVocab.prefix}name"), createStringLiteral("var0"))
500+
statement(TestVocab.references, createResource("http://test.binary-array-ld.net/example/var1"))
501+
statement(TestVocab.references, createResource("http://test.binary-array-ld.net/example/var2"))
499502
statement(RDF.type, BALD.Array)
500503
statement(BALD.references) {
501504
statement(RDF.type, BALD.Reference)

binary-array-ld-netcdf/src/main/kotlin/net/bald/netcdf/NetCdfAttribute.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class NetCdfAttribute(
1212
private val attr: Attribute
1313
): net.bald.Attribute {
1414
private val name: String get() = attr.shortName
15-
private val prop: Property get() = parent.parseProperty(name)
15+
val prop: Property get() = parent.parseProperty(name)
1616

1717
override val uri: String get() = prop.uri
1818

binary-array-ld-netcdf/src/main/kotlin/net/bald/netcdf/NetCdfVar.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class NetCdfVar(
6969
private fun attributeRefs(): Sequence<NetCdfVar> {
7070
return v.attributes().let(::source)
7171
.attributes()
72+
.filter { attr -> attr.prop.let(parent.alias::isReferenceProperty) }
7273
.mapNotNull(NetCdfAttribute::rawValues)
7374
.flatten()
7475
.mapNotNull(parent::parseReferences)

binary-array-ld-netcdf/src/test/kotlin/net/bald/netcdf/NetCdfBinaryArrayTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,10 @@ class NetCdfBinaryArrayTest {
370370

371371
@Test
372372
fun vars_withReferenceAttributes_returnsReferences() {
373-
val ba = fromCdl("/netcdf/ref-attr.cdl", "http://test.binary-array-ld.net/ref-attr.nc")
373+
val alias = javaClass.getResourceAsStream("/turtle/var-alias.ttl").use { input ->
374+
ModelFactory.createDefaultModel().read(input, null, "ttl")
375+
}.let(ModelAliasDefinition::create)
376+
val ba = fromCdl("/netcdf/ref-attr.cdl", "http://test.binary-array-ld.net/ref-attr.nc", alias = alias)
374377
ContainerVerifier(ba.root).vars {
375378
variable("http://test.binary-array-ld.net/ref-attr.nc/var0") {
376379
dimensions(10, 90, 15)

binary-array-ld-test/src/main/resources/netcdf/ref-attr.cdl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ netcdf attributes {
66
d3 = 60 ;
77
variables:
88
int var0(d0, d1, d2) ;
9-
var0:bald__references = "var1 var2" ;
9+
var0:test__references = "var1 var2" ;
10+
var0:test__name = "var0" ;
1011
int var1(d1, d2, d3) ;
1112
var1:test__references = "var2";
1213
int var2(d2) ;

0 commit comments

Comments
 (0)