# URIʍ\i4j

L

L

ŏIXV
2006-04-14T01:01:00+09:00
̋LURIQ
http://www.7key.jp/rfc/2396/rfc2396_4.html#source
• RFC2396yUniform Resource Identifiers (URI): Generic Syntax -- August 1998z

## URIʍ\iaj

ŏIXV
2006-09-26T00:00:00+09:00
̋LURIQ
http://www.7key.jp/rfc/2396/rfc2396_4.html#translation

### 4. URI References

The term "URI-reference" is used here to denote the common usage of a
resource identifier.  A URI reference may be absolute or relative,
and may have additional information attached in the form of a
fragment identifier.  However, "the URI" that results from such a
reference includes only the absolute URI after the fragment
identifier (if any) is removed and after any relative URI is resolved
to its absolute form.  Although it is possible to limit the
discussion of URI syntax and semantics to that of the absolute
result, most usage of URI is within general URI references, and it is
impossible to obtain the URI from such a reference without also
parsing the fragment and resolving the relative form.

URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

ł́AURIQƂƂp\[Xʎq̋ʂgƒ`BURIQƂɂ͐ΎQƂƑΎQƂAǉ񂪃tOgʎq`ŕtĂꍇBAi΁jtOgʎq폜AXɑURIURI`ɉ߂AʂƂȂURI͐URIłBURI̍\ƈӖɂĂ̋c_URIɌ肷邱Ƃł邪AURȊ͈ʓIURIQƂ̒ŗp邽߁AtOgʎq̍\͂ƑΌ`̉ȂňʓIURIQƂURI𓾂邱Ƃ͕s\łB

The syntax for relative URI is a shortened form of that for absolute
URI, where some prefix of the URI is missing and certain path
components ("." and "..") have a special meaning when, and only when,
interpreting a relative path.  The relative URI syntax is defined in
Section 5.

URI̍\́AURIZkłB̍ېURȊOȗA߂ꂽpXR|[lgi"."".."j΃pX̉ߎɂ̂ݓʂȈӖBURI̍\ɂĂ5. URIQŒ`B

#### 4.1. Fragment Identifier

When a URI reference is used to perform a retrieval action on the
identified resource, the optional fragment identifier, separated from
the URI by a crosshatch ("#") character, consists of additional
reference information to be interpreted by the user agent after the
retrieval action has been successfully completed.  As such, it is not
part of a URI, but is often used in conjunction with a URI.

fragment      = *uric

URIQƂʂꂽ\[X̎擾sہAURI"#"ŋ؂邱ƂɂătOgʎqCӂŕt邱ƂłBtOgʎq́A\[X̎擾삪Ƀ[UG[WFg߂tIȎQƏłB̂߁AtOgʎqURIł͂ȂAURIƋɗp邱ƂȂȂB

The semantics of a fragment identifier is a property of the data
resulting from a retrieval action, regardless of the type of URI used
in the reference.  Therefore, the format and interpretation of
fragment identifiers is dependent on the media type [RFC2046] of the
retrieval result.  The character restrictions described in Section 2
for URI also apply to the fragment in a URI-reference.  Individual
media types may define additional restrictions or structure within
the fragment for specifying different types of "partial views" that
can be identified within that media type.

tOgʎq̈Ӗ́AQƂ̍ۂɗpꂽURǏ^Ɋւ炸A擾̌ʓꂽf[^̎łB̂߁AtOgʎq̌`Ɖ߂́Aꂽʂ̃fBA^Cv[RFC2046]ɈˑB2ɂĐGꂽURIɂ镶́AQƂURI̒̃tOgʎqɂKpBefBA^Cv́ÃfBA^CvŎʂłقȂ^"Q"ŵ߂ɁAtOgʎqɕtIȐ邢͍\`邱ƂłB

A fragment identifier is only meaningful when a URI reference is
intended for retrieval and the result of that retrieval is a document
for which the identified fragment is consistently defined.

URIQƂ擾ɍۂ̂ŁA擾̌ʓ镶łꂼ̕т`Ŏʂꍇ̂݁AtOgʎq͗LvȂ̂ƂȂB

#### 4.2. Same-document References

A URI reference that does not contain a URI is a reference to the
current document.  In other words, an empty URI reference within a
document is interpreted as a reference to the start of that document,
and a reference containing only a fragment identifier is a reference
to the identified fragment of that document.  Traversal of such a
reference should not result in an additional retrieval action.
However, if the URI reference occurs in a context that is always
intended to result in a new request, as in the case of HTML's FORM
element, then an empty URI reference represents the base URI of the
current document and should be replaced by that URI when transformed
into a request.

URI܂܂ȂURIQƂ́A݂̎̕QƂłB܂Ał̋URIQƂ邱Ƃ͂̐̕擪QƂ邱ƂƉ߂AtOgʎq݂̂܂ގQƂ́Aꕶ̒`ꂽQƂ邱ƂƉ߂B̂悤ȎQƂ̍ہAɎ擾Ă镶Ăю擾悤ȓsׂł͂ȂBAHTMLFORMvf̂悤ɁAURIQƂɐVȃNGXgs悤Î镶ŗpꂽꍇ́AURIQƂ͓ꕶ̊URI̎QƂ\ANGXg̍ۂɊURIւ̃NGXgƒu߂sׂłB

#### 4.3. Parsing a URI Reference

A URI reference is typically parsed according to the four main
components and fragment identifier in order to determine what
components are present and whether the reference is relative or
absolute.  The individual components are then parsed for their
subparts and, if not opaque, to verify their validity.

URIQƂ͒ʏAR|[lg邩ǂAQƂɊ֘A邩ǂAΎQƂǂ߂邽߂ɁA4̎ȃR|[lgƃtOgʎqɂĉ͂B̌AeR|[lg͕Ƃɉ߂AsłȂ΂̐mFB

Although the BNF defines what is allowed in each component, it is
ambiguous in terms of differentiating between an authority component
and a path component that begins with two slash characters.  The
greedy algorithm is used for disambiguation: the left-most matching
rule soaks up as much of the URI reference string as it is capable of
matching.  In other words, the authority component wins.

eR|[lgŔF߂`BNFŒ`Ă邪A@փR|[lg2̃XbVŎn܂pXR|[lgʂ_܂łB̂߁A}b`OKURIQƕ̍[̍Œ}b`ƂȂ悤ȁA茵ȃASYpB΁A@փR|[lgD悳ׂłB

Readers familiar with regular expressions should see Appendix B for a
concrete parsing example and test oracle.

K\ɖ邢̂ł΁A\̗͂̋ƎIȃASYɂċLqB. K\pURIQƂ̍\QƂ̂ƁB

L

Copyright (C) 2006  key@do.ai ŁF2006N0414 ŏIXVF2006N0926