• Topic
  • Discussion
  • VOS.VirtURIShortener(Last) -- Owiki? , 2018-04-13 12:09:15 Edit owiki 2018-04-13 12:09:15

    Shortening URIs with Virtuoso

    Long URLs are hard for humans to type or remember, and don't work very well with short message services like Twitter or identi.ca.

    CURIs are compressed URIs which redirect to the original long URL. They are easier to share, type, and use in general.

    The Virtuoso URI Shortener offers a way to do this in your own domain and data space, without reliance on external services such as bit.ly, is.gd, or tinyurl.com.

    How does it work?

    All full-length URIs are stored in a Virtuoso database table which keeps a unique ID number for each URI. This ID is converted to base32 encoding, which only uses uppercase letters and numbers from 2 to 7, for use in the CURI.

    Note: numbers 1 and 0 are not used in this encoding, eliminating the common visual confusion between uppercase o and number 0, and between uppercase i, lowercase L, and number 1.

    Configuration Options

    The prefix for loading images, CSS, etc., can be set through the Virtuoso INI file option, CURIUISkinPrefix.

    Package Installation and Accessibility

    1. Download the Virtuoso URI Shortener VAD package.
    2. Install the package through the Virtuoso Conductor from the System Admin -> Packages tab or using the isql command line program as shown below:

      SQL> DB.DBA.VAD_INSTALL('tmp/c_uri_dav.vad',0); VARCHAR VARCHAR _______________________________________________________________________________ 00000 No errors detected 00000 Installation of "OpenLink Virtuoso URI Shortener" is complete. 00000 Now making a final checkpoint. 00000 Final checkpoint is made. 00000 SUCCESS 6 Rows. -- 1766 msec.

    3. Go to Endpoint - http://<cname>/c
      • Note: you could also use the page:http://<cname>[:<port>]/c/create.vsp?uri=xx
    4. Paste in long URL.

    Example

    • Load your service, e.g., http://<cname>/c in your browser.



    • Enter a URI, e.g.,

      http://lod.openlinksw.com/sparql?default-graph-uri=&should-sponge=&query=SELECT+%3Fx%0D%0AWHERE%0D%0A++{%0D%0A++++%3Fx++foaf%3Aname++%22Alice%22++.%0D%0A++++FILTER%0D%0A++++++%28%0D%0A++++++++bif%3Aexists%0D%0A++++++++++%28+%28%0D%0A+++++++++++++SELECT+*%0D%0A+++++++++++++WHERE%0D%0A+++++++++++++++{%0D%0A+++++++++++++++++%3Fx++foaf%3Aknows++%3Fy++++++.%0D%0A+++++++++++++++++%3Fy++foaf%3Aname+++%22John%22%0D%0A+++++++++++++++}%0D%0A++++++++++%29+%29%0D%0A++++++%29%0D%0A++}&format=text%2Fhtml&debug=on&timeout=





    • Click Make CURI.
    • A new CURI will be created and displayed, e.g.,

      http://<cname>/c/7EFF