selection - SPARQL string RANGE -


i trying extract part of string using index numbers. when having

"oeiufhwoiefwnfopqwjfhqwoihfeb..." 

and need string 5:10 (fhwoie) found out not possible via regex returns boolean , not groups. however, did not manage find region selection on strings via positions. wondering if there any?

i found out partly possible via...

bind(replace(?sequence, '^.{100}', "") ?sequencestrip1) 

but not

bind(replace(?sequence, '^.{?start}', "") ?sequencestrip1) 

i think interested:

bind(replace(?sequence, "^.{"+str(?start)+"}", "") ?sequencestrip1) 

and of course remove area behind interested in

bind(replace(?region, ".{"+str(strlen(?region)-10)+"}$", "") ?upstream) 

in first sparql query language rdf, rather difficult, because there not many string manipulation functions. however, in question, you've used replace appeared in sparql 1.1 query language. because, in addition replace, sparql 1.1 includes more string manipulation functions. 1 of these, substr, need. instance, here's query in ?string bound string mentioned, , substr used extract substring you're looking , bind ?substring.

select * {    values ?string { "oeiufhwoiefwnfopqwjfhqwoihfeb..." }   bind( substr( ?string, 5, 6 ) ?substring ) } 

the results are:

-------------------------------------------------- | string                             | substring | ================================================== | "oeiufhwoiefwnfopqwjfhqwoihfeb..." | "fhwoie"  | -------------------------------------------------- 

note second argument substr starting position (where first index 1), , third length of substring, not final position. wanted substring, fhwoie, has 6 characters, third argument 6.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -