我正在尝试在 RML 映射器中使用 FnO 函数(我喜欢在这里string_split
做类似的事情)。这是我的文件夹的样子:
我正在执行java -jar "rmlmapper.jar" -m mapping-cuisines.ttl -o output-cuisines.ttl -s turtle
但是,当我尝试实现 a 时,<#FunctionMap>
我收到以下错误消息:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at be.ugent.rml.functions.DynamicMultipleRecordsFunctionExecutor.execute(DynamicMultipleRecordsFunctionExecutor.java:66)
at be.ugent.rml.functions.AbstractSingleRecordFunctionExecutor.execute(AbstractSingleRecordFunctionExecutor.java:17)
at be.ugent.rml.termgenerator.LiteralGenerator.generate(LiteralGenerator.java:42)
at be.ugent.rml.Executor.generatePredicateObjectGraphs(Executor.java:157)
at be.ugent.rml.Executor.executeWithFunction(Executor.java:115)
at be.ugent.rml.Executor.execute(Executor.java:76)
at be.ugent.rml.cli.Main.main(Main.java:206)
对我来说没有任何意义。根据 git repo,这些函数是从我执行 rmlmapper 的地方动态加载的。
数据集:https ://mega.nz/file/LsJAQRaR#84lfASPXVA08zm0RbuRfNvR7tx-vklS82D1KBGhhdA8
我的代码:
@base <http://example.org/data> .
@prefix ex: <http://example.org/ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix fnml: <http://semweb.mmlab.be/ns/fnml#> .
@prefix fno: <https://w3id.org/function/ontology#> .
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .
<#LogicalSource>
a rml:LogicalSource;
rml:source "dataworld-restaurants-cuisines.csv";
rml:referenceFormulation ql:CSV.
<#MyTriplesMap>
a rr:TriplesMap;
rml:logicalSource <#LogicalSource>;
rr:subjectMap [
rr:template "http://example.org/{id}";
];
rr:predicateObjectMap [
rr:predicate ex:aProperty;
rr:objectMap <#FunctionMap>;
].
<#FunctionMap>
fnml:functionValue [
rml:logicalSource <#LogicalSource> ;
rr:predicateObjectMap [
rr:predicate fno:executes ;
rr:objectMap [ rr:constant grel:toUpperCase ]
] ;
rr:predicateObjectMap [
rr:predicate grel:valueParameter ;
rr:objectMap [
rml:reference "spicy"
]
]
] .
我的functions.ttl:
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix fno: <https://w3id.org/function/ontology#> .
@prefix fnoi: <https://w3id.org/function/vocabulary/implementation#> .
@prefix fnom: <https://w3id.org/function/vocabulary/mapping#> .
@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .
@prefix grelm: <http://fno.io/grel/rmlmapping#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
grel:toUpperCase a fno:Function ;
fno:name "to Uppercase" ;
rdfs:label "to Uppercase" ;
dcterms:description "Returns the input with all letters in upper case." ;
fno:expects ( grel:valueParam ) ;
fno:returns ( grel:stringOut ) .
grelm:javaString
a fnoi:JavaClass ;
doap:download-page "GrelFunctions.jar" ;
fnoi:class-name "io.fno.grel.StringFunctions" .
grelm:uppercaseMapping
a fnoi:Mapping ;
fno:function grel:toUpperCase ;
fno:implementation grelm:javaString ;
fno:methodMapping [ a fnom:StringMethodMapping ;
fnom:method-name "toUppercase" ] .