Skip to content

Commit

Permalink
add additional IDLab function
Browse files Browse the repository at this point in the history
  • Loading branch information
pheyvaer committed Aug 28, 2018
1 parent 7a674e5 commit 7556522
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
4 changes: 2 additions & 2 deletions buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Aug 17 13:40:48 CEST 2018
buildNumber0=43
#Tue Aug 28 14:48:59 CEST 2018
buildNumber0=45
2 changes: 2 additions & 0 deletions src/main/java/be/ugent/rml/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import be.ugent.rml.*;
import be.ugent.rml.functions.FunctionLoader;
import be.ugent.rml.functions.lib.GrelProcessor;
import be.ugent.rml.functions.lib.IDLabFunctions;
import be.ugent.rml.records.RecordsFactory;
import be.ugent.rml.store.Quad;
import be.ugent.rml.store.QuadStore;
Expand Down Expand Up @@ -112,6 +113,7 @@ public static void main(String [] args) {
} else {
Map<String, Class> libraryMap = new HashMap<>();
libraryMap.put("GrelFunctions", GrelProcessor.class);
libraryMap.put("IDLabFunctions", IDLabFunctions.class);
FunctionLoader functionLoader = new FunctionLoader(null, null, libraryMap);
executor = new Executor(rmlStore, factory, functionLoader);
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/be/ugent/rml/functions/lib/IDLabFunctions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package be.ugent.rml.functions.lib;

import java.util.Arrays;
import java.util.List;

public class IDLabFunctions {

public static boolean stringContainsOtherString(String str, String otherStr, String delimiter) {
String[] split = str.split(delimiter);
List<String> list = Arrays.asList(split);

return list.contains(otherStr);
}
}
42 changes: 41 additions & 1 deletion src/main/resources/functions.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,44 @@ grel:stringOut a fno:Output ;
fno:name "output string" ;
rdfs:label "output string" ;
fno:type xsd:string ;
fno:predicate grel:stringOutput .
fno:predicate grel:stringOutput .

#######################
### IDLab Functions ###
#######################

idlab-fn:stringContainsOtherString a fno:Function ;
fno:name "stringContainsOtherString" ;
rdfs:label "stringContainsOtherString" ;
dcterms:description "Returns true if a string is found in a delimited string." ;
fno:expects ( idlab-fn:_str idlab-fn:_otherStr idlab-fn:_delimiter ) ;
fno:returns ( idlab-fn:_stringOut ) ;
lib:providedBy [
lib:localLibrary "IDLabFunctions.jar";
lib:class "IDLabFunctions";
lib:method "stringContainsOtherString"
].

idlab-fn:_str a fno:Parameter ;
fno:name "input string" ;
rdfs:label "input string" ;
fno:type xsd:string ;
fno:predicate idlab-fn:str .

idlab-fn:_otherStr a fno:Parameter ;
fno:name "other input string" ;
rdfs:label "other input string" ;
fno:type xsd:string ;
fno:predicate idlab-fn:otherStr .

idlab-fn:_delimiter a fno:Parameter ;
fno:name "delimiter" ;
rdfs:label "delimiter" ;
fno:type xsd:string ;
fno:predicate idlab-fn:delimiter .

idlab-fn:_stringOut a fno:Output ;
fno:name "output string" ;
rdfs:label "output string" ;
fno:type xsd:string ;
fno:predicate idlab-fn:stringOut .

0 comments on commit 7556522

Please sign in to comment.