URI management documentation
https://drive.google.com/file/d/1iarHM7C2XeJWG5UJpon47-6mmqzhIMG7/view?usp=sharing
URI Management Documentation
Table of Contents
Context
URI Resolvability
URI Resolvability refers to the ability of a URI to be dereferenced or accessed, meaning that the URI points to a resource that can be retrieved or interacted with.
Key aspects of URI resolvability:
Accessibility: The resource identified by the URI can be accessed using standard protocols like HTTP or HTTPS.
Response: When the URI is accessed, it returns a valid response, such as an HTML page, JSON data, an image, etc.
Error Handling: If a URI does not resolve correctly, appropriate error messages (like 404 Not Found) are returned to inform the user or the system about the issue.
DNS Resolution: For web URLs, the domain name should be resolvable via DNS (Domain Name System) to an IP address that the client can then access.
Content Negotiation
Content Negotiation is a mechanism defined in HTTP that allows a server to serve different versions of a document (or resource) at the same URI, so that the best version can be chosen based on the client's capabilities and preferences. It is an important aspect of web communication, enabling the delivery of content that best suits the client's requirements.
Types of content negotiation:
Server-driven Negotiation: The server determines the best representation of the resource based on the information provided by the client in the request headers:
Accept: Specifies the media types the client can handle (e.g., text/html, application/json)
Accept-Language: Specifies the preferred languages (e.g., en-US, fr)
Accept-Encoding: Specifies the preferred content encodings (e.g., gzip, deflate)
Client-driven Negotiation: The client is responsible for making multiple requests to the server, specifying different preferences until it gets the desired version of the resource. This can be less efficient because it may require multiple round trips to the server.
Agent-driven Negotiation: Involves an intermediary (like a proxy) that performs the negotiation on behalf of the client and server.
Benefits of content negotiation:
Localization: Serving content in different languages based on the user's preference
Device-specific content: Providing different formats like mobile-optimized versions of web pages or different image resolutions for different devices
Format flexibility: Offering multiple data formats (e.g., HTML, JSON, XML) for different types of applications or users
AgroPortal Objective
The primary goal of our work at AgroPortal is to enhance the accessibility, interoperability, and usability of agricultural data. By implementing features such as multiple format accessibility, content negotiation, resolvability checks, and URI redirection, we aim to ensure that resources are easily accessible, correctly formatted to meet user needs, and reliably retrievable. This will facilitate better data integration, sharing, and utilization within the agricultural community, ultimately supporting more effective research and decision-making.
Problematic:
URI Resources are not resolvable
Resources contents are content negotiable (not available with multiple format)
Content Negotiation
To implement content negotiation in AgroPortal, we designed a system that dynamically serves the appropriate format of a resource based on the client's preferences.
On each request from the client requesting the content of the resource specifying the resource format in the Accept HTTP header we:
Retrieve the content of the resource from the triple store: this is done by retrieving from the triple store all the triples related to the resource by two SPARQL queries:
SELECT DISTINCT ?p ?v from <graph> where { <URI> ?p ?v}and
SELECT DISTINCT ?s ?p from <graph> where { ?s ?p <URI> }Serialize the retrieved content into the requested format: The content will be serialized into the appropriate format, but we support serialization for 4 formats:
JSONLD
RDF/XML
NTRIPLES
TURTLE
Return the serialized content
Implementation in AgroPortal
We have implemented this feature in AgroPortal with each resource. You can find the content of the resource under the "Raw Data" with multiple formats. You can also request the content with format using HTTP request with specifying the format in the Accept header.
URI Resolvability
What is Check Resolvability Tool
We developed a tool called "Check Resolvability" that allows you to test whether a given URL is resolvable to ensure the reliability and accessibility of URIs.
How it Works
Checking the resolvability of a URL is performed by sending a HEAD request to the URL and checking if the response status code is 200 (OK) and the returned content type is equal to one of:
application/json
application/rdf+xml
text/turtle
text/n3
text/html
We have:
A timeout set to 5 seconds, so if the URL is not resolvable within this timeout, the check will fail
A maximum number of redirects set to 10, so if the URL is not resolvable within this number of redirects, the check will fail
Implementation in AgroPortal
We have added resolvability icon beside each URI to check its resolvability and more details about it
You can access the check resolvability tool from https://agroportal.lirmm.fr/check_resolvability and just paste your URI in the search box
Generated AgroPortal URIs
URI Standardisation
Most URIs in AgroPortal are different from ontology to another in terms of scheme and every URI is hosted in different places. With this, we aim to standardize all resources URIs and making them in one scheme which is the following:
https://AgroPortal.lirmm.fr/ontologies/#{ACRONYM}/#{Resource_id}Implementation in AgroPortal
You can see and copy the generated URI from the interface of AgroPortal. We have added beside each URI of resource the generated one.
Redirection System
What is Redirection System
To support users who want to make their URIs resolvable and content negotiable, we created a URI redirection system that seamlessly integrates their URIs with AgroPortal's infrastructure by redirecting their URI to AgroPortal URIs.
This solution ensures that users can leverage AgroPortal's robust infrastructure to make their resources both resolvable and accessible in multiple formats, enhancing the overall usability and interoperability of agricultural data.
What is Redirection Rules
Redirection rules are configurations set on a web server to forward incoming requests from one URL to another. These rules help manage URL changes, maintain link consistency, and enhance user experience by ensuring that users are directed to the correct resource.
How it Works
This system is basically working on redirecting the URI of the user ontology to the URIs of AgroPortal by making some configuration in the web server.
For users who want to redirect their URI, we made it very simple:
Go to the summary page of the ontology you want to redirect its URIs
In the identifiers card, you will find the AgroPortal URI
When you click on the URL icon, a popup will open containing instructions and code to configure your server
Follow the instructions depending on your server if it's Apache or Nginx, and just copy/paste the code in the configuration files
After that, your URIs will be redirected