# Saved by TopBraid on Mon Jun 23 21:07:10 PDT 2008 # baseURI: http://sparqlmotion.org/examples/UserDefinedFunction # imports: http://topbraid.org/sparqlmotionfunctions # imports: http://topbraid.org/sparqlmotionlib @prefix rdfs: . @prefix sm: . @prefix udf: . @prefix sml: . @prefix owl: . @prefix xsd: . @prefix smf: . @prefix rdf: . a owl:Ontology ; owl:imports , ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string . udf:ConstructResult a sml:BindBySelect ; rdfs:label "Construct result"^^xsd:string ; sml:selectQuery """SELECT ?result WHERE { LET (?result := smf:subString(?text, ?startIndex + 1, ?endIndex)) . }"""^^xsd:string . udf:GetEndIndex a smf:lastIndexOf ; rdfs:label "Get endIndex"^^xsd:string ; sm:next udf:ConstructResult ; sm:outputVariable "endIndex" ; smf:substr ")"^^xsd:string . udf:GetStartIndex a smf:indexOf ; rdfs:label "Get startIndex"^^xsd:string ; sm:next udf:GetEndIndex ; sm:outputVariable "startIndex" ; smf:substr "("^^xsd:string . udf:myFunction a owl:Class ; rdfs:comment "Assuming that the input string contains a text inside parantheses, this function extracts the text between opening and closing parantheses. For example, for the input string \"Hello (World)\" the function returns \"World\"." ; rdfs:label "myFunction"^^xsd:string ; rdfs:subClassOf smf:StringFunctionModule ; rdfs:subClassOf [ a owl:Restriction ; rdfs:comment "The name of the output variable. Default: result." ; sm:defaultValue "result" ; owl:cardinality "1"^^xsd:int ; owl:onProperty sm:outputVariable ] ; rdfs:subClassOf [ a owl:Restriction ; rdfs:comment "The input string." ; sm:argumentIndex "0"^^xsd:int ; owl:cardinality "1"^^xsd:int ; owl:onProperty smf:text ] ; sm:functionBody udf:GetStartIndex ; sm:outputType xsd:string .