URI: Difference between revisions
moving nonCOLLADA definition into here |
a little editing |
||
(11 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
A ''' | A '''uniform resource identifier''' (URI) is a standard way of referencing elements, objects, files, and so on. | ||
The basic URI | ==About URIs== | ||
''scheme''://''authority''/'' | The basic [http://gbiv.com/protocols/uri/rfc/rfc3986.html#components URI syntax] is | ||
''scheme''://''authority''/''path''?''query''#''fragment'' | |||
URIs | Examples of URIs include | ||
file:///home/sthomas/models/cube.dae | |||
file:///C:/models/sphere.dae#myGeometry | |||
<nowiki>http://www.google.com/</nowiki> | |||
The '' | The following table shows the breakdown of each URI component in the previous examples. | ||
{|border=1 cellpadding=3 cellspacing=0 | |||
|- | |||
!URI!!Scheme!!Authority!!Path!!Query!!Fragment | |||
|- | |||
|file:///home/sthomas/models/cube.dae||file||-||/home/sthomas/models/cube.dae||-||- | |||
|- | |||
|file:///C:/models/sphere.dae#myGeometry||file||-||/C:/models/sphere.dae||-||myGeometry | |||
|- | |||
|<nowiki>http://www.google.com/</nowiki>||http||www.google.com||-||-||- | |||
|} | |||
==URI references== | |||
Many XML-based formats (including COLLADA) primarily use ''[http://gbiv.com/protocols/uri/rfc/rfc3986.html#usage URI references]'', which are a superset of URIs. A URI reference is either a URI or a ''[http://gbiv.com/protocols/uri/rfc/rfc3986.html#relative-ref relative URI reference]''. A relative URI reference (''relative reference'' for short) doesn't include the <code>scheme:</code> prefix. Before a relative reference can be used, it must be converted to a URI in a process called ''[http://gbiv.com/protocols/uri/rfc/rfc3986.html#reference-resolution reference resolution]''. The reference resolution algorithm combines the relative reference with a [http://gbiv.com/protocols/uri/rfc/rfc3986.html#base-uri base URI] to form the full URI that is then used by the application. | |||
The following are some examples of URI references. These examples are full URIs (because they include the <code>scheme:</code> prefix). Because these are full URIs, an application can use them directly without being resolved. | |||
file:///home/sthomas/models/cube.dae | |||
file:///C:/models/sphere.dae#myGeometry | |||
<nowiki>http://www.google.com/</nowiki> | |||
Here are more examples of URI references. Because these references don't include a <code>scheme:</code> prefix, they're relative references and must be resolved before an application can use them. | |||
/home/sthomas/models/cube.dae | |||
/C:/models/sphere.dae#myGeometry | |||
../../image.jpg | |||
#redMaterial | #redMaterial | ||
==Relative reference resolution== | |||
A relative reference is combined with a base URI to yield a full URI in a process called ''reference resolution''. The full algorithm is given [http://gbiv.com/protocols/uri/rfc/rfc3986.html#relative-transform here]. | |||
Assuming a base URI of | |||
file:///C:/A/B/C/D/doc.dae | |||
here are some examples of how relative references would be resolved: | |||
{| border=1 cellspacing=0 cellpadding=4 | |||
|- | |||
!Relative Reference||Resolved URI | |||
|- | |||
| | |||
./path/document.dae | |||
| | |||
file:///c:/A/B/C/D/path/document.dae | |||
|- | |||
| | |||
../../../path/document.dae#elementID | |||
| | |||
file:///A/path/document.dae#elementID | |||
|- | |||
| | |||
/c:/path/document.dae#Light01 | |||
| | |||
file:///c:/path/document.dae#Light01 | |||
|} | |||
In the last example, a leading "/" character is added to make it a relative reference. Otherwise, the string <code>c:/path/document.dae</code> would be interpreted as a URI with scheme ''c'', which probably isn't what the author intended. | |||
==See also== | ==See also== | ||
Line 16: | Line 71: | ||
==External links== | ==External links== | ||
* [http://en.wikipedia.org/wiki/Uniform_Resource_Identifier | * [http://gbiv.com/protocols/uri/rfc/rfc3986.html The URI spec] | ||
* [http://en.wikipedia.org/wiki/Uniform_Resource_Identifier URI article on Wikipedia] | |||
* [http://en.wikipedia.org/wiki/URI_scheme Discussion of URI file scheme] | * [http://en.wikipedia.org/wiki/URI_scheme Discussion of URI file scheme] | ||
[[Category:Terminology]] | [[Category:Terminology]] |
Latest revision as of 03:50, 28 May 2007
A uniform resource identifier (URI) is a standard way of referencing elements, objects, files, and so on.
About URIs
The basic URI syntax is
scheme://authority/path?query#fragment
Examples of URIs include
file:///home/sthomas/models/cube.dae file:///C:/models/sphere.dae#myGeometry http://www.google.com/
The following table shows the breakdown of each URI component in the previous examples.
URI | Scheme | Authority | Path | Query | Fragment |
---|---|---|---|---|---|
file:///home/sthomas/models/cube.dae | file | - | /home/sthomas/models/cube.dae | - | - |
file:///C:/models/sphere.dae#myGeometry | file | - | /C:/models/sphere.dae | - | myGeometry |
http://www.google.com/ | http | www.google.com | - | - | - |
URI references
Many XML-based formats (including COLLADA) primarily use URI references, which are a superset of URIs. A URI reference is either a URI or a relative URI reference. A relative URI reference (relative reference for short) doesn't include the scheme:
prefix. Before a relative reference can be used, it must be converted to a URI in a process called reference resolution. The reference resolution algorithm combines the relative reference with a base URI to form the full URI that is then used by the application.
The following are some examples of URI references. These examples are full URIs (because they include the scheme:
prefix). Because these are full URIs, an application can use them directly without being resolved.
file:///home/sthomas/models/cube.dae file:///C:/models/sphere.dae#myGeometry http://www.google.com/
Here are more examples of URI references. Because these references don't include a scheme:
prefix, they're relative references and must be resolved before an application can use them.
/home/sthomas/models/cube.dae /C:/models/sphere.dae#myGeometry ../../image.jpg #redMaterial
Relative reference resolution
A relative reference is combined with a base URI to yield a full URI in a process called reference resolution. The full algorithm is given here.
Assuming a base URI of
file:///C:/A/B/C/D/doc.dae
here are some examples of how relative references would be resolved:
Relative Reference | Resolved URI |
---|---|
./path/document.dae |
file:///c:/A/B/C/D/path/document.dae |
../../../path/document.dae#elementID |
file:///A/path/document.dae#elementID |
/c:/path/document.dae#Light01 |
file:///c:/path/document.dae#Light01 |
In the last example, a leading "/" character is added to make it a relative reference. Otherwise, the string c:/path/document.dae
would be interpreted as a URI with scheme c, which probably isn't what the author intended.