Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added utilities for URI slug generation #10

Closed
wants to merge 1 commit into from
Closed

added utilities for URI slug generation #10

wants to merge 1 commit into from

Conversation

FND
Copy link
Member

@FND FND commented Jun 24, 2013

this allows for converting arbitrary strings to URI slugs:

label = "hello world"
IqRdf.send(label, IqRdf::Skosxl.Label)
# results in invalid data: `:hello world a skosx:Label.`

label = "hello world"
IqRdf.send(IqRdf::Origin.new(label).to_s, IqRdf::Skosxl.Label)
# results in valid data: `:helloWorld a skosx:Label.`

adapted from iQvoc:
https://github.com/innoq/iqvoc/blob/0cfa829283da64dc4035b5a1c9ada255a1407bce/lib/iqvoc/origin.rb

arguably IqRdf should do this automatically - or at least validate URIs
accordingly?

however, perhaps this iQvoc Origin is overkill and URL-encoding
(i.e. :hello%20world) suffices?

this allows for converting arbitrary strings to URI slugs:

    label = "hello world"
    IqRdf.send(label, IqRdf::Skosxl.Label)
    # results in invalid data: `:hello world a skosx:Label.`

    label = "hello world"
    IqRdf.send(IqRdf::Origin.new(label).to_s, IqRdf::Skosxl.Label)
    # results in valid data: `:helloWorld a skosx:Label.`

adapted from iQvoc:
https://github.com/innoq/iqvoc/blob/0cfa829283da64dc4035b5a1c9ada255a1407bce/lib/iqvoc/origin.rb

arguably IqRdf should do this automatically - or at least validate URIs
accordingly?

however, perhaps this iQvoc `Origin` is overkill and URL-encoding
(i.e. `:hello%20world`) suffices?
@tillsc
Copy link
Member

tillsc commented Aug 6, 2013

I think automatically url encoding things would be enough.

@FND
Copy link
Member Author

FND commented Aug 6, 2013

I would prefer that as well, but when I was experimenting with this, it seemed like URL-encoding was not valid in QNames - at least Sesame's Turtle parser rejects such triples ("Expected an RDF value here, found '%'")

@tillsc
Copy link
Member

tillsc commented Aug 6, 2013

You're right. One more reason to do this automatically :-)

@tillsc
Copy link
Member

tillsc commented Aug 6, 2013

http://www.w3.org/TeamSubmission/turtle/#name :

name    ::= nameStartChar nameChar*
nameStartChar   ::= [A-Z] | "_" | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
nameChar    ::= nameStartChar | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]

@FND
Copy link
Member Author

FND commented Aug 6, 2013

two issues:

  • What's the right place to perform this conversion automatically?
  • Looking at the diff again, the whole thing looks far more complex than it should be.

@tillsc
Copy link
Member

tillsc commented Aug 6, 2013

@FND
Copy link
Member Author

FND commented Aug 6, 2013

¿Qué?

@mjansing mjansing closed this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants