Skip to content

Commit

Permalink
Update to ValueBase and ArrayValue to implement array functions
Browse files Browse the repository at this point in the history
`.asRDFNode()` and `asResource()`.

#39
  • Loading branch information
skwlilac committed Apr 1, 2021
1 parent 33d0217 commit 96bde66
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/main/java/com/epimorphics/dclib/values/ValueArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,25 @@ public Value map(Value value) {
});
}

@Override
public Value asRDFNode() {
return applyFunction(new MapValue() {
public Value map(Value value) {
@SuppressWarnings("rawtypes")
Value v = ((ValueBase) value).asRDFNode() ;
return v;
}
});
}

public Value asResource() {
return applyFunction(new MapValue() {
public Value map(Value value) {
return GlobalFunctions.asResource((Object) value);
}
});
}

@Override
public Value map(final String mapsource, final boolean matchRequired) {
return applyFunction(new MapValue() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/epimorphics/dclib/values/ValueBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public Value fetch(String...strings) {


/** Convert to a wrapped RDF node, treats strings as a URI and creates a resource node */
public ValueNode asRDFNode() {
public Value asRDFNode() {
return new ValueNode( NodeFactory.createURI( value.toString() ) );
}

Expand Down

0 comments on commit 96bde66

Please sign in to comment.