Changes between Version 11 and Version 12 of Taskforces/FCS/FCS-Specification-Draft


Ignore:
Timestamp:
10/22/15 09:44:07 (9 years ago)
Author:
Oliver Schonefeld
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Taskforces/FCS/FCS-Specification-Draft

    v11 v12  
    262262
    263263==== FCS-QL
    264 About available layers
     264TODO: About FCS-QL
    265265
    266266=== Result Format
     267The Search Engine will produce a result set containing several hits as the outcome of processing a query. The Endpoint `MUST` serialize these hits in the CLARIN-FCS result format. Endpoints are `REQUIRED` to adhere to the principle, that ''one'' hit `MUST` be serialized as ''one'' CLARIN-FCS result record and `MUST NOT` combine several hits in one CLARIN-FCS result record. E.g., if a query matches five different sentences within one text (= the resource), the Endpoint must serialize them as five SRU records each with one Hit each referencing the same containing Resource (see section [#searchRetrieve Operation ''searchRetrieve'']).
     268
     269CLARIN-FCS uses a customized format for returning results. ''Resource'' and ''Resource Fragments'' serve as containers for hit results, which are presented in one or more ''Data View''. The following section describes the Resource format and Data View format and section [#searchRetrieve Operation ''searchRetrieve''] will describe, how hits are embedded within SRU responses.
     270
    267271==== Resource and !ResourceFragment
     272To encode search results, CLARIN-FCS supports two building blocks:
     273 Resources::
     274   A ''Resource'' is a ''searchable'' and ''addressable'' entity at the Endpoint, such as a text corpus or a multi-modal corpus. A resource `SHOULD` be a self-contained unit, i.e. not a single sentence in a text corpus or a time interval in an audio transcription, but rather a complete document from a text corpus or a complete audio transcription.
     275 Resource Fragments::
     276   A ''Resource Fragment'' is a smaller unit in a ''Resource'', i.e. a sentence in a text corpus or a time interval in an audio transcription.
     277
     278A Resource `SHOULD` be the most precise unit of data that is directly addressable as a "whole". A Resource `SHOULD` contain a Resource Fragment, if the hit consists of just a part of the Resource unit (for example if the hit is a sentence within a large text). A Resource Fragment `SHOULD` be addressable within a resource, i.e. it has an offset or a resource-internal identifier. Using Resource Fragments is `OPTIONAL`, but Endpoints are encouraged to use them. If the Endpoint encodes a hit with a Resource Fragment, the actual hit `SHOULD` be encoded as a Data View that within the Resource Fragment.
     279
     280Endpoints `SHOULD` always provide a link to the resource itself, i.e. each Resource or Resource Fragment `SHOULD` be identified by a persistent identifier or providing a URI, that is unique for Endpoint. Even if direct linking is not possible, i.e. due to licensing issues, the Endpoints `SHOULD` provide a URI to link to a web-page describing the corpus or collection, including instruction on how to obtain it. Endpoints `SHOULD` provide links that are as specific as possible (and logical), i.e. if a sentence within a resource cannot be addressed directly, the Resource Fragment `SHOULD NOT` contain a persistent identifier or a URI.
     281
     282If the Endpoint can provide both, a persistent identifier as well as a URI, for either Resource or Resource Fragment, they `SHOULD` provide both. When working with results, Clients `SHOULD` prefer persistent identifiers over regular URIs.
     283
     284Resource and Resource Fragment are serialized in XML and Endpoints `MUST` generate responses that are valid according to the XML schema "[source:FederatedSearch/schema/Resource.xsd Resource.xsd]" ([source:FederatedSearch/schema/Resource.xsd?format=txt download]). A Resource is encoded in the form of a `<fcs:Resource>` element, a ''Resource Fragment'' in the form of a `<fcs:ResourceFragment>` element. The content of a Data View is wrapped in a `<fcs:DataView>` element. `<fcs:Resource>` is the top-level element and `MAY` contain zero or more `<fcs:DataView>` elements and `MAY` contain zero or more `<fcs:ResourceFragment>` elements. A `<fcs:ResourceFragment>` element `MUST` contain one or more `<fcs:DataView>` elements.
     285
     286The elements `<fcs:Resource>`, `<fcs:ResourceFragment>` and `<fcs:DataView>` `MAY` carry a `@pid` and/or a `@ref` attribute, which allows linking to the original data represented by the Resource, Resource Fragment, or Data View. A `@pid` attribute `MUST` contain a valid persistent identifier, a `@ref` `MUST` contain valid URI, i.e. a "plain" URI without the additional semantics of being a persistent reference. If the Endpoint cannot provide a `@pid` attribute for a `<fcs:Resource>`, they `SHOULD` provide a `@ref` attribute. Endpoint `SHOULD` add either a `@pid` or `@ref` attribute to either the `<fcs:Resource>` or the `<fcs:ResourceFragment>` element, if possible to both elements. Endpoints are `RECOMMENDED` to give `@pid` attributes, if they can provide them.
     287
     288Endpoints `MUST` use the identifier `http://clarin.eu/fcs/resource` for the ''responseItemType'' (= content for the `<sru:recordSchema>` element) in SRU responses.
     289
     290Endpoints `MAY` serialize hits as multiple Data Views, however they `MUST` provide the Generic Hits (HITS) Data View either encoded as a Resource Fragment (if applicable), or otherwise within the Resource (if there is no reasonable Resource Fragment). Other Data Views `SHOULD` be put in a place that is logical for their content (as is to be determined by the Endpoint), e.g. a metadata Data View would most likely be put directly below Resource and a Data View representing some annotation layers directly around the hit is more likely to belong within a Resource Fragment.
     291
     292[=#REF_Example_1]Example 1:
     293{{{#!xml
     294<fcs:Resource xmlns:fcs="http://clarin.eu/fcs/resource" pid="http://hdl.handle.net/4711/00-15">
     295  <fcs:DataView type="application/x-clarin-fcs-hits+xml">
     296      <!-- data view payload omitted -->
     297  </fcs:DataView>
     298</fcs:Resource>
     299}}}
     300[#REF_Example_1 Example 1] shows a simple hit, which is encoded in one Data View of type ''Generic Hits'' embedded within a Resource. The type of the Data View is identified by the MIME type `application/x-clarin-fcs-hits+xml`. The Resource is referenceable by the persistent identifier `http://hdl.handle.net/4711/08-15`.
     301
     302[=#REF_Example_2]Example 2:
     303{{{#!xml
     304<fcs:Resource xmlns:fcs="http://clarin.eu/fcs/resource" pid="http://hdl.handle.net/4711/08-15">
     305  <fcs:ResourceFragment>
     306    <fcs:DataView type="application/x-clarin-fcs-hits+xml">
     307      <!-- data view payload omitted -->
     308    </fcs:DataView>
     309  </fcs:ResourceFragment>
     310</fcs:Resource>
     311}}}
     312[#REF_Example_2 Example 2] shows a hit encoded as a Resource Fragment embedded within a Resource. The actual hit is again encoded as one Data View of type ''Generic Hits''. The hit is not directly referenceable, but the Resource, in which hit occurred, is referenceable by the persistent identifier `http://hdl.handle.net/4711/08-15`. In contrast to [#REF_Example_1 Example 1], the Endpoint decided to provide a "semantically richer" encoding and embedded the hit using a Resource Fragment within the Resource to indicate that the hit is a part of a larger resource, e.g. a sentence in a text document.
     313
     314[=#REF_Example_3]Example 3:
     315{{{#!xml
     316<fcs:Resource xmlns:fcs="http://clarin.eu/fcs/resource"
     317              pid="http://hdl.handle.net/4711/08-15" ref="http://repos.example.org/file/text_08_15.html">
     318  <fcs:DataView type="application/x-cmdi+xml"
     319                pid="http://hdl.handle.net/4711/08-15-1" ref="http://repos.example.org/file/08_15_1.cmdi">
     320      <!-- data view payload omitted -->
     321  </fcs:DataView>
     322  <fcs:ResourceFragment pid="http://hdl.handle.net/4711/08-15-2" ref="http://repos.example.org/file/text_08_15.html#sentence2">
     323    <fcs:DataView type="application/x-clarin-fcs-hits+xml">
     324      <!-- data view payload omitted -->
     325    </fcs:DataView>
     326  </fcs:ResourceFragment>
     327</fcs:Resource>
     328}}}
     329The most complex [#REF_Example_3 Example 3] is similar to [#REF_Example_2 Example 2], i.e. it shows a hit is encoded as one ''Generic Hits'' Data View in a Resource Fragment, which is embedded in a Resource. In contrast to Example 2, another Data View of type ''CMDI'' is embedded directly within the Resource. The Endpoint can use this type of Data View to directly provide CMDI metadata about the Resource to Clients.
     330All entities of the Hit can be referenced by a persistent identifier and a URI. The complete Resource is referenceable by either the persistent identifier `http://hdl.handle.net/4711/08-15` or the URI `http://repos.example.org/file/text_08_15.html` and the CMDI metadata record in the CMDI Data View is referenceable either by the persistent identifier `http://hdl.handle.net/4711/08-15-1` or the URI `http://repos.example.org/file/08_15_1.cmdi`. The actual hit in the Resource Fragment is also directly referenceable by either the persistent identifier `http://hdl.handle.net/4711/00-15-2` or the URI `http://repos.example.org/file/text_08_15.html#sentence2`.   
     331
    268332==== Data View
     333A ''Data View'' serves as a container for encoding the actual search results (the data fragments relevant to search) within CLARIN-FCS. Data Views are designed to allow for different representations of results, i.e. they are deliberately kept open to allow further extensions with more supported Data View formats. This specification only defines a ''most basic'' Data View for representing search results, called ''Generic Hits'' (see below). More Data Views are defined in the supplementary specification [#REF_FCS_DataViews CLARIN-FCS-DataViews].
     334
     335The content of a Data View is called ''Payload''. Each Payload is typed and the type of the Payload is recorded in the `@type` attribute of the `<fcs:DataView>` element. The Payload type is identified by a MIME type ([#REF_RFC_6838 RFC6838], [#REF_RFC_3023 RFC3023]). If no existing MIME type can be used, implementers `SHOULD` define a proper private mime type.
     336
     337The Payload of a Data View can either be deposited ''inline'' or by ''reference''. In the case of ''inline'', it `MUST` be serialized as an XML fragment below the `<fcs:DataView>` element. This is the preferred method for payloads that can easily be serialized in XML. Deposition by ''reference'' is meant for content that cannot easily be deposited inline, i.e. binary content (like images). In this case, the Data View `MUST` include a `@ref` or `@pid` attribute that links location for Clients to download the payload. This location `SHOULD` be ''openly accessible'', i.e. data can be downloaded freely without any need to perform a login.
     338
     339Data Views are classified into a ''send-by-default'' and a ''need-to-request'' delivery policy. In case of the ''send-by-default'' delivery policy, the Endpoint `MUST` send the Data View automatically, i.e. Endpoints `MUST` unconditionally include the Data View when they serialize a response to a search request. In the case of ''need-to-request'', the Client must explicitly request the Endpoint to include this Data View in the response. This enables the Endpoint to not generate and serialize Data Views that are "expensive" in terms of computational power or bandwidth for every response. To request such a Data View, a Client `MUST` submit a comma separated list of Data View identifiers (see section [#endpointDescription Endpoint Description]) in the `x-fcs-dataviews` extra request parameter with the ''searchRetrieve'' request. If a Client requests a Data View that is not valid for the search context, the Endpoint `MUST` generate a non-fatal diagnostic `http://clarin.eu/fcs/diagnostic/4` ("Requested Data View not valid for this resource"). The details field of the diagnostic `MUST` contain the MIME type of the Data View that was not valid. If more than one requested Data View is invalid, the Endpoint `MUST` generate a ''separate'' non-fatal diagnostic `http://clarin.eu/fcs/diagnostic/4` for each of the requested Data Views.
     340
     341The description of every Data View contains a recommendation as to how the Endpoint should handle the payload delivery, i.e. if a Data View is by default considered ''send-by-default'' or ''need-to-request''. Endpoint `MAY` choose to implement different policy. The relevant information which policy is implemented by an Endpoint for a specific Data View is part of the ''Endpoint Description'' (see section [#endpointDescription Endpoint Description]). For each Data View, a ''Recommended Short Identifier'' is defined, that Endpoint `SHOULD` use for an identifier of the Data View in the list of supported Data Views in the ''Endpoint Description''
     342
     343The ''Generic Hits'' Data View is mandatory, thus all Endpoints `MUST` implement this it and provide search results represented in the ''Generic Hits'' Data View. Endpoints `MUST` implement the ''Generic Hits'' Data View with the ''send-by-default'' delivery policy.
     344
     345'''NOTE''': The examples in the following sections ''show only'' the payload with the enclosing `<fcs:DataView>` element of a Data View. Of course, the Data View must be embedded either in a `<fcs:Resource>` or a `<fcs:ResourceFragment>` element. The `@pid` and `@ref` attributes have been omitted for all ''inline'' payload types.
     346
    269347===== Generic Hits (HITS)
     348||=Description                  =|| The representation of the hit ||
     349||=MIME type                    =|| `application/x-clarin-fcs-hits+xml` ||
     350||=Payload Disposition          =|| ''inline'' ||
     351||=Payload Delivery             =|| ''send-by-default'' (`REQUIRED`) ||
     352||=Recommended Short Identifier =|| `hits` (`RECOMMENDED`) ||
     353The ''Generic Hits'' Data View serves as the ''most basic'' agreement in CLARIN-FCS for serialization of search results and `MUST` be implemented by all Endpoints. In many cases, this Data View can only serve as an (lossy) approximation, because resources at Endpoints are very heterogeneous. For instance, the Generic Hits Data View is probably not the best representation for a hit result in a corpus of spoken language, but an architecture like CLARIN-FCS requires one common representation to be implemented by all Endpoints, therefore this Data View was defined. The Generic Hits Data View supports multiple markers for supplying highlighting for an individual hit, e.g. if a query contains a (boolean) conjunction, the Endpoint can use multiple markers to provide individual highlights for the matching terms. An Endpoint `MUST NOT` use this Data View to aggregate several hits within one resource. Each hit `SHOULD` be presented within the context of a complete sentence. If that is not possible due to the nature of the type of the resource, the Endpoint `MUST` provide an equivalent reasonable unit of context (e.g. within a phrase of an orthographic transcription of an utterance). The `<hits:Hit>` element within the `<hits:Result>` element is not enforced by the XML schema, but Endpoints are `RECOMMENDED` to use it. The XML fragment of the Generic Hits payload `MUST` be valid according to the XML schema "[source:FederatedSearch/schema/DataView-Hits.xsd DataView-Hits.xsd]" ([source:FederatedSearch/schema/DataView-Hits.xsd?format=txt download]).
     354 * Example (single hit marker):
     355{{{#!xml
     356<!-- potential @pid and @ref attributes omitted -->
     357<fcs:DataView type="application/x-clarin-fcs-hits+xml">
     358  <hits:Result xmlns:hits="http://clarin.eu/fcs/dataview/hits">
     359    The quick brown <hits:Hit>fox</hits:Hit> jumps over the lazy dog.
     360  </hits:Result>
     361</fcs:DataView>
     362}}}
     363 * Example (multiple hit markers):
     364{{{#!xml
     365<!-- potential @pid and @ref attributes omitted -->
     366<fcs:DataView type="application/x-clarin-fcs-hits+xml">
     367  <hits:Result xmlns:hits="http://clarin.eu/fcs/dataview/hits">
     368    The quick brown <hits:Hit>fox</hits:Hit> jumps over the lazy <hits:Hit>dog</hits:Hit>.
     369  </hits:Result>
     370</fcs:DataView>
     371}}}
     372
    270373===== Advanced (ADV)
    271 {{{
    272 #!div style="border: 1px solid #000000; font-size: 75%"
    273 New section.
    274 }}}
     374||=Description                  =|| The representation of the hit for Advanced Search ||
     375||=MIME type                    =|| `application/x-clarin-fcs-adv+xml` ||
     376||=Payload Disposition          =|| ''inline'' ||
     377||=Payload Delivery             =|| ''send-by-default'' (`REQUIRED`) ||
     378||=Recommended Short Identifier =|| `adv` (`RECOMMENDED`) ||
     379
     380{{{
     381#!div style="border: 1px solid #000000; font-size: 75%"
     382TODO: describe!
     383}}}
     384
    275385=== "Versioning and Extensions"
    276386==== "Backwards compatibility statements"
     
    281391}}}
    282392==== Endpoint Custom Extensions
    283 {{{
    284 #!div style="border: 1px solid #000000; font-size: 75%"
    285 Talk about extensions in general; this section needs to stay in normative part due to the namespace stuff
    286 }}}
     393Endpoints can add custom extensions, i.e. custom data, to the Result Format. This extension mechanism can for example be used to provide hints for an (XSLT/XQuery) application that works directly on CLARIN-FCS, e.g. to allow it to generate back and forward links to navigate in a result set.
     394
     395An Endpoint `MAY` add arbitrary XML fragments to the extension hooks provided in the `<fcs:Resource>` element (see the XML schema for "Resource.xsd"). The XML fragment for the extension `MUST` use a custom XML namespace name for the extension. Endpoints `MUST NOT` use XML namespace names that start with the prefixes `http://clarin.eu`, `http://www.clarin.eu/`, `https://clarin.eu` or `https://www.clarin.eu/`.
     396
     397A Client `MUST` ignore any custom extensions it does not understand and skip over these XML fragments when parsing the Endpoint's response.
     398
     399The non-normative appendix contains an [#extensionExample example], how an extension could be implemented.
     400
    287401= CLARIN-FCS to SRU/CQL binding
    288402== SRU/CQL
     
    308422}}}
    309423= Normative Appendix
     424{{{
     425#!div style="border: 1px solid #000000; font-size: 75%"
     426TODO: check and proof-read all sub-sections.
     427}}}
    310428== List of extra request parameters
    311 {{{
    312 #!div style="border: 1px solid #000000; font-size: 75%"
    313 Revisit and update as required; don't forget to add the new request parameter ("allow rewriting" => allow endpoint to trade precision in favor of recall).
    314 }}}
     429The following extra request parameters are used in CLARIN-FCS. The column ''SRU operations'' lists the SRU operation, for which this extra request parameter is to be used. Clients `MUST NOT` use the parameter for an operation that is not listed in this column. However, if a Client sends an invalid parameter, an Endpoint `SHOULD` issue a fatal diagnostic "Unsupported Parameter" (`info:srw/diagnostic/1/8`) and stop processing the request. Alternatively, an Endpoint `MAY` silently ignore the invalid parameter.
     430||=Parameter Name   =||=SRU operations =||=Allowed values =||=Description =||
     431|| `x-fcs-endpoint-description` || explain || `true`; all other values are reserved and `MUST` not be used by Clients || If the parameter is given (with the value `true`), the Endpoint `MUST` include an Endpoint Description in the `<sru:extraResponseData>` element of the ''explain'' response. ||
     432|| `x-fcs-context` || searchRetrieve || A comma-separated list of persistent identifiers || The Endpoint `MUST` restrict the search to the resources identified by the persistent identifiers. ||
     433|| `x-fcs-dataviews` || searchRetrieve || A comma-separated list of Data View identifiers || The Endpoint `SHOULD` include the additional ''need-to-request'' type Data Views in the response. ||
     434|| `x-fcs-rewrites-allowed` || searchRetrieve || `true`; all other values are reserved and `MUST` not be used by Clients. \\ Clients `MUST` only use this parameter when performing an Advanced Search request. || If the parameter is given (with the value `true`), the Endpoint `MAY` rewrite the query to a simpler query to allow for more recall. ||
     435
    315436== List of diagnostics
    316437{{{
    317438#!div style="border: 1px solid #000000; font-size: 75%"
    318 Revisit and update as required; don't forget to add the 4 new diagnostics.
    319 }}}
     439TODO: keep column if diagnostic is fatal or non-fatal?
     440}}}
     441Apart from the SRU diagnostics defined in [#REF_SRU_12 OASIS-SRU-12, Appendix C] and [#REF_LOC_DIAG LOC-DIAG], the following diagnostics are used in CLARIN-FCS.  The column "Details Format" specifies what `SHOULD` be returned in the details field. If this column is blank, the format is "undefined" and the Endpoint `MAY` return whatever it feels appropriate, including nothing. The column "Impact" specifies, if the endpoint should continue ("non-fatal") or should stop ("fatal") processing.
     442||=Identifier URI                     =||=Description                                                          =||=Details Format =||=Impact =||=Note =||
     443|| `http://clarin.eu/fcs/diagnostic/1` || Persistent identifier passed by the Client for restricting the search is invalid. || The offending persistent identifier. || non-fatal || If more than one invalid persistent identifiers were submitted by the Client, the Endpoint `MUST` generate a separate diagnostic for each invalid persistent identifier. ||
     444|| `http://clarin.eu/fcs/diagnostic/2` || Resource set too large. Query context automatically adjusted. || The persistent identifier of the resource to which the query context was adjusted. || non-fatal || If an Endpoint limited the query context to more than one resource, it `MUST` generate a separate diagnostic for each resource to which the query context was adjusted. ||
     445|| `http://clarin.eu/fcs/diagnostic/3` || Resource set too large. Cannot perform Query. || || fatal || ||
     446|| `http://clarin.eu/fcs/diagnostic/4` || Requested Data View not valid for this resource. || The Data View MIME type. || non-fatal || If more than one invalid Data View was requested, the Endpoint `MUST` generate a separate diagnostic for each invalid Data View. ||
     447|| `http://clarin.eu/fcs/diagnostic/10` || General query syntax error.  || Detailed error message why the query could not be parsed. || fatal || Endpoints `MUST` use this diagnostic only if the Client performed an Advanced Search request. ||
     448|| `http://clarin.eu/fcs/diagnostic/11` || Query too complex. Cannot perform Query. || Details why could not be performed, e.g. unsupported layer or unsupported combination of operators. || fatal || Endpoints `MUST` use this diagnostic only if the Client performed an Advanced Search request. ||
     449|| `http://clarin.eu/fcs/diagnostic/12` || Query was rewritten. || Details how the query was rewritten. || non-fatal || Endpoints `MUST` use this diagnostic only if the Client performed an Advanced Search request with the `x-fcs-rewrites-allowed` request parameter. ||
     450|| `http://clarin.eu/fcs/diagnostic/14` || General processing hint. || Details, e.g. "No matches, because layer 'XY' is not available in your selection of resources" || non-fatal || Endpoints `MUST` use this diagnostic only if the Client performed an Advanced Search. ||
     451
    320452= Non-normative Appendix
     453{{{
     454#!div style="border: 1px solid #000000; font-size: 75%"
     455TODO: check and proof-read all sub-sections.
     456}}}
    321457== Syntax variant for Handle system Persistent Identifier URIs
     458Persistent Identifiers from the Handle system are defined in two syntax variants: a regular URI format for the Handle protocol, i.e. with a `hdl:` prefix, or ''actionable'' URIs with a `http://hdl.handle.net/` prefix. Generally, CLARIN software should support both syntax variants, therefore the CLARIN-FCS Interface Specification does not endorse a specific syntax variant. However, Endpoints are recommended to use the ''actionable'' syntax variant.
     459
    322460== Referring to an Endpoint from a CMDI record
    323 == Endpoint custom extensions
     461Centers are encouraged to provide links to their CLARIN-FCS Endpoints in the metadata records for their resources. Other services, like the VLO, can use this information for automatically configuring an Aggregator for searching resources at the Endpoint.
     462   
     463To refer to an Endpoint, a `<cmdi:ResourceProxy>` element with child-element `<cmdi:ResourceType>` set to the value `SearchService` and a `@mimetype` attribute with a value of `application/sru+xml` need to be added to the CMDI record. The content of the `<cmdi:ResourceRef>` element must contain a URI that points to the Endpoint web service.
     464
     465Example:
     466{{{#!xml
     467<cmdi:CMD xmlns:cmdi="http://www.clarin.eu/cmd/" CMDVersion="1.1">
     468  <cmdi:Header>
     469    <!-- ... -->
     470    <cmdi:MdSelfLink>http://hdl.handle.net/4711/0815</cmdi:MdSelfLink>
     471    <!-- ... -->
     472  </cmdi:Header>
     473  <cmdi:Resources>
     474    <cmdi:ResourceProxyList>
     475      <!-- ... -->
     476      <cmdi:ResourceProxy id="r4711">
     477        <cmdi:ResourceType mimetype="application/sru+xml">SearchService</cmdi:ResourceType>
     478        <cmdi:ResourceRef>http://repos.example.org/fcs-endpoint</cmdi:ResourceRef>
     479      </cmdi:ResourceProxy>
     480      <!-- ... -->
     481    </cmdi:ResourceProxyList>
     482  </cmdi:Resources>
     483  <!-- ... -->
     484</cmdi:CMD>
     485}}}
     486
     487== Endpoint custom extensions #extensionExample
     488The CLARIN-FCS protocol specification allows Endpoints to add custom data to their responses, e.g. to provide hints to an (XSLT/XQuery) application that works directly on CLARIN-FCS. It could use the custom data to generate back and forward links for a GUI to navigate in a result set.
     489
     490The following example illustrates how extensions can be embedded into the Result Format:
     491{{{#!xml
     492<fcs:Resource xmlns:fcs="http://clarin.eu/fcs/resource" pid="http://hdl.handle.net/4711/0815">
     493    <fcs:DataView type="application/x-clarin-fcs-hits+xml">
     494      <hits:Result xmlns:hits="http://clarin.eu/fcs/dataview/hits">
     495        The quick brown <hits:Hit>fox</hits:Hit> jumps over the lazy <hits:Hit>dog</hits:Hit>.
     496      </hits:Result>
     497    </fcs:DataView>
     498   
     499    <!--
     500        NOTE: this is purely fictional and only serves to demonstrate how
     501              to add custom extensions to the result representation
     502              within CLARIN-FCS.
     503    -->
     504
     505    <!--
     506        Example 1: a hypothetical Endpoint extension for navigation in a result
     507        set: it basically provides a set of hrefs, that a GUI can convert into
     508        navigation buttions.   
     509    -->
     510    <nav:navigation xmlns:nav="http://repos.example.org/navigation">
     511        <nav:curr href="http://repos.example.org/resultset/4711/4611" />
     512        <nav:prev href="http://repos.example.org/resultset/4711/4610" />
     513        <nav:next href="http://repos.example.org/resultset/4711/4612" />
     514    </nav:navigation>
     515
     516    <!--
     517       Example 2: a hypothetical Endpoint extension for directly referencing parent
     518       resources: it basically provides a link to the parent resource, that can be
     519       exploited by a GUI (e.g. build on XSLT/XQuery).
     520    -->
     521    <parent:Parent xmlns:parent="http://repos.example.org/parent"
     522                   ref="http://repos.example.org/path/to/parent/1235.cmdi" />
     523</fcs:Resource>
     524}}}
     525
    324526== Endpoint highlight hints for repositories
    325 {{{
    326 #!div style="border: 1px solid #000000; font-size: 75%"
    327 All sections to be updated as required / maybe check if something should be deleted.
    328 }}}
     527An Aggregator can use the `@ref` attributes of the `<fcs:Resource>`, `<fcs:ResourceFragment>` or `<fcs:DataView>` elements to provide a link for the user to directly jump to the resource at a Repository. To support hit highlighting, an Endpoint can augment the URI in the `@ref` attribute with query parameters to implement hit highlighting in the Repository.
     528
     529In the following example, the URI `http://repos.example.org/resource.cgi/<pid>` is a CGI script that displays a given resource at the Repository in HTML format and uses the `highlight` query parameter to add highlights to the resource. Of course, it's up to the Endpoint and the Repository, if and how they implement such a feature.
     530{{{#!xml
     531<fcs:Resource xmlns:fcs="http://clarin.eu/fcs/resource" pid="http://hdl.handle.net/4711/0815">
     532  <fcs:DataView type="application/x-clarin-fcs-hits+xml" ref="http://repos.example.org/resource.cgi/4711/0815?highlight=fox">
     533    <hits:Result xmlns:hits="http://clarin.eu/fcs/dataview/hits">
     534      The quick brown <hits:Hit>fox</hits:Hit> jumps over the lazy dog.
     535    </hits:Result>
     536  </fcs:DataView>
     537</fcs:Resource>
     538}}}