Sparql to extract all characters before an uppercase character

37 views
Skip to first unread message

Kasia Kryczka

unread,
Jan 22, 2024, 9:17:03 AM1/22/24
to TopBraid Suite Users
Hi there,

this might be a trivial sparql question.

I have name like : 
a-bb-cc-dd-TEST I would like to get a-bb-cc-dd
a-TEST result a
a-cc-dd-ONE result a-cc-dd
x-BLOB result d
etc.

how to extract all that is before the uppercase letter ?

Thanks,

Kasia

Matt Goldberg

unread,
Jan 22, 2024, 9:57:31 AM1/22/24
to topbrai...@googlegroups.com
If it's that simple, then the REPLACE function with a regex pattern would probably work, something like this-

SELECT ?original (REPLACE(?original, "-[A-Z].+", "") AS ?extracted)
 WHERE {
   VALUES ?original {
     "a-bb-cc-dd-TEST"
     "a-TEST"
     "a-cc-dd-ONE"
   }
 }


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/a81aca03-1159-4aa6-917b-5aff6934c16bn%40googlegroups.com.

Kasia Kryczka

unread,
Jan 22, 2024, 10:01:16 AM1/22/24
to TopBraid Suite Users
Hi Matt,

it worked like a charm:)

Thank you :)

Br,

Kasia

Reply all
Reply to author
Forward
0 new messages