Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/43 value array #45

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/com/epimorphics/dclib/values/ValueArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package com.epimorphics.dclib.values;

import com.epimorphics.dclib.framework.ConverterProcess;
import com.epimorphics.dclib.framework.NullResult;
import com.epimorphics.util.NameUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -333,7 +334,11 @@ public interface MapValue {
public ValueArray applyFunction(MapValue map) {
Value[] result = new Value[ value.length ];
for (int i = 0; i < value.length; i++) {
result[i] = map.map( value[i]);
try {
result[i] = map.map( value[i]);
} catch (NullResult n) {
result[i] = new ValueNull();
}
}
return new ValueArray(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ public void testBugs() throws IOException {

checkAgainstExpected("test/bugCases/accidental-lang.yaml", "test/bugCases/accidental-lang.csv", "test/bugCases/accidental-lang.ttl");
}


@Test
public void testArrayMap() throws IOException {
checkAgainstExpected("test/arrayMap/resource-media-type.yaml", "test/arrayMap/resource_media_types.csv", "test/arrayMap/expected.ttl");
}
@Test
public void testDateParseFailure() throws IOException {
// A failure to parse a date shouldn't break the whole template, or should it
Expand Down
26 changes: 26 additions & 0 deletions test/arrayMap/expected.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@prefix void: <http://rdfs.org/ns/void#> .
@prefix c: <http://vocab.epimorphics.com/agora/def/catalog/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix version: <http://purl.org/linked-data/version#> .
@prefix qb: <http://purl.org/linked-data/cube#> .
@prefix at: <http://environment.data.gov.uk/public-register/def/applicant-type/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix u: <http://vocab.epimorphics.com/agora/def/upper/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix api: <http://purl.org/linked-data/api/vocab#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dataset: <http://example.org/dataset/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .

dataset:0002 c:mediaType <http://vocab.epimorphics.com/agora/reference/media-type/text/plain> , <http://vocab.epimorphics.com/agora/reference/media-type/application/octet-stream> , <http://vocab.epimorphics.com/agora/reference/media-type/application/zip> .

dataset:0001 c:mediaType <http://vocab.epimorphics.com/agora/reference/media-type/application/octet-stream> , <http://vocab.epimorphics.com/agora/reference/media-type/application/zip> .

dataset:0003 c:mediaType <http://vocab.epimorphics.com/agora/reference/media-type/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet> .
Loading