Embedded spaces

0 views
Skip to first unread message

andrew....@elucidbio.com

unread,
Apr 20, 2016, 11:31:36 AM4/20/16
to Stardog
Hello,
I successfully use subjects like <http://elucidbio.com/kb/CarotidArtery>. But so far I have not been able to use embedded spaces, i.e., <http://elucidbio.com/kb/Carotid Artery>.  Is there a quotation or escape character sequence to make this work?
Thank you,
Andy

Bill Roberts

unread,
Apr 20, 2016, 11:44:23 AM4/20/16
to sta...@clarkparsia.com
Hi Andrew

Resources in RDF must be represented by valid URIs and you are not allowed to have spaces in URIs.  If you try putting your second example into your browser address bar, you'll see that it encodes the space with %20, which is the standard way to encode spaces in URIs. 

But if you have the choice of how to design your URIs I'd recommend not having spaces in them, encoded or not.  If you are generating the URIs programmatically from strings, then you can choose what to do with spaces and other disallowed punctuation characters - either just remove them, or it's common to replace them with a hyphen ('-') for example.

All the gory details of what makes a valid URI can be found in https://www.ietf.org/rfc/rfc3986.txt though it's quite heavy reading.

Hope that helps

Bill



--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Andrew J. Buckler (Elucid Bioimaging)

unread,
Apr 20, 2016, 11:45:49 AM4/20/16
to sta...@clarkparsia.com

Excellent, this answers the question!

You received this message because you are subscribed to a topic in the Google Groups "Stardog" group.
To unsubscribe from this topic, visit https://groups.google.com/a/clarkparsia.com/d/topic/stardog/z7msccSqEP0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stardog+u...@clarkparsia.com.

Zachary Whitley

unread,
Apr 20, 2016, 12:01:17 PM4/20/16
to Stardog
You need to be quick on the mailing list today :)

Url's need to be percent encoded. The rules can be surprisingly complex but are fairly simple for simple url's [1]. The space should be encoded as %20

There was a really good blog post a while back on the subject. [2] It's worth skimming if for no other reason than to get an appreciation for how hard it can be to get right.

[1] https://en.wikipedia.org/wiki/Percent-encoding
[2] https://unspecified.wordpress.com/2008/05/24/uri-encoding/

Andrew J. Buckler (Elucid Bioimaging)

unread,
Apr 20, 2016, 1:03:05 PM4/20/16
to sta...@clarkparsia.com

Very helpful, thank you!

 

From: Zachary Whitley [mailto:zachary...@wavestrike.com]
Sent: Wednesday, April 20, 2016 12:01 PM
To: Stardog
Subject: Re: [stardog-users] Embedded spaces

 

 

 

On Wed, Apr 20, 2016 at 11:31 AM, <andrew....@elucidbio.com> wrote:

You received this message because you are subscribed to a topic in the Google Groups "Stardog" group.
To unsubscribe from this topic, visit https://groups.google.com/a/clarkparsia.com/d/topic/stardog/z7msccSqEP0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stardog+u...@clarkparsia.com.

Reply all
Reply to author
Forward
0 new messages