8. Technical RDF Information


As well as being available through a browsable UI, HASSET is available as RDF data via a number of endpoints.
HASSET is modelled primarily with SKOS but a small number of additional properties are used from other vocabularies e.g. Dublin Core (e.g. license) and XKOS.

Namespace and URIs

The base URI for all HASSET concepts is https://hasset.ukdataservice.ac.uk/
Note that the URL for the Skosmos platform on the Apache web server at the UK Data Service is https://vocabularies.ukdataservice.ac.uk .
We have a number of internal redirections configured to handle HASSET URI requests, so that they land at the correct location.
All identifiers for concepts are GUIDs (in the canonical format 8-4-4-4-12 for a total of 36 characters - 32 hexadecimal characters and 4 hyphens) and are unique and persistent.

The URI for any concept can be found on the detail page for the concept:

For example, the concept ABILITY above has a URI of https://hasset.ukdataservice.ac.uk/991de6b7-a4d2-483c-8721-4df9b218eb21


Concept scheme

The URI for the HASSET concept scheme is https://hasset.ukdataservice.ac.uk
All HASSET concepts are retrievable online as RDF data with a machine-actionable query; however, because of the size of the concept scheme (approximately 80,000 triples), we do not
make the whole thesaurus available as a direct RDF query. If you need a copy of the complete HASSET as linked data, it can be downloaded from https://vocabularies.ukdataservice.ac.uk/downloads/HASSET_20210819.zip
which contains RDF/XML, JSON-LD and Turtle representations of the thesaurus.

 


Methods to retrieve Concepts as RDF data

(1) Interactively in the Skosmos UI

RDF data for each concept can be retrieved by clicking on the relevant link in the Skosmos UI. RDF/XML, Turtle or JSON-LD formats are available.
For example, entering the URI for the concept GAMBLING (https://hasset.ukdataservice.ac.uk/ee6df6e1-bd41-4d92-aa5f-6b0b8a7c0d8e ) into a browser will redirect to the relevant HTML page.
RDF data for the concept can be retrieved by clicking on the relevant links in the detail pane - see below:

 


(2) Embedded JSON in the HTML page

Every HTML concept page in the Skosmos UI includes embedded RDF data as JSON-LD. For example, a standard HTML request for the URI for ZOOGEOGRAPHY
(https://hasset.ukdataservice.ac.uk/fe80038d-5c53-4db7-b7ec-bd018a69a8f9) will redirect to the HTML page https://vocabularies.ukdataservice.ac.uk/hasset/en/page/fe80038d-5c53-4db7-b7ec-bd018a69a8f9
The page source (right-click the page and “View Source” in Google Chrome for example) will contain a <script type="application/ld+json"> tag within which is a RDF JSON-LD representation of the concept:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 { "@context": { "skos": "http://www.w3.org/2004/02/skos/core#", "isothes": "http://purl.org/iso25964/skos-thes#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "owl": "http://www.w3.org/2002/07/owl#", "dct": "http://purl.org/dc/terms/", "dc11": "http://purl.org/dc/elements/1.1/", "uri": "@id", "type": "@type", "lang": "@language", "value": "@value", "graph": "@graph", "label": "rdfs:label", "prefLabel": "skos:prefLabel", "altLabel": "skos:altLabel", "hiddenLabel": "skos:hiddenLabel", "broader": "skos:broader", "narrower": "skos:narrower", "related": "skos:related", "inScheme": "skos:inScheme", "schema": "http://schema.org/", "wd": "http://www.wikidata.org/entity/", "wdt": "http://www.wikidata.org/prop/direct/", "hasset": "https://hasset.ukdataservice.ac.uk/" }, "graph": [ { "uri": "http://www.w3.org/ns/dcat#CatalogRecord", "label": { "lang": "en", "value": "Keyword search" } }, { "uri": "https://hasset.ukdataservice.ac.uk/", "type": "skos:ConceptScheme", "prefLabel": { "lang": "en", "value": "HASSET" } }, { "uri": "hasset:d6f824bf-fb0b-48f0-b4af-0a56362ee1eb", "type": "skos:Concept", "narrower": {"uri": "hasset:fe80038d-5c53-4db7-b7ec-bd018a69a8f9"}, "prefLabel": { "lang": "en", "value": "ZOOLOGY" } }, { "uri": "hasset:fe80038d-5c53-4db7-b7ec-bd018a69a8f9", "type": "skos:Concept", "altLabel": [ { "lang": "en", "value": "DISTRIBUTION OF INSECTS" }, { "lang": "en", "value": "DISTRIBUTION OF ANIMALS" }, { "lang": "en", "value": "DISTRIBUTION OF BIRDS" } ], "broader": {"uri": "hasset:d6f824bf-fb0b-48f0-b4af-0a56362ee1eb"}, "inScheme": {"uri": "https://hasset.ukdataservice.ac.uk/"}, "prefLabel": { "lang": "en", "value": "ZOOGEOGRAPHY" }, "http://www.w3.org/ns/dcat#CatalogRecord": { "lang": "en", "value": "<a href='https://beta.ukdataservice.ac.uk/datacatalogue/studies/?Search=Keyword:ZOOGEOGRAPHY'>Search for 'ZOOGEOGRAPHY' in UK Data Service Catalogue<\/a>" } } ] }

 


(3) HTTP Content Negotiation

RDF can be retrieved for any concept URI with an HTTP GET request specifying the appropriate Content type in the HTTP header.
We currently support the following Content types.

  1. application/rdf+xml

  2. application/ld+json

  3. text/turtle

Example using Postman API Client

Concept ASPIRATION has URI of https://hasset.ukdataservice.ac.uk/991de6b7-a4d2-483c-8721-4df9b218eb21
An HTTP GET request specifying ‘application/rdf+xml’ as the header will retrieve RDF data for the concept in RDF/XML format:

 


(4) RESTful API

Skosmos provides a read-only REST-style API and Linked Data access to the underlying vocabulary data.

The API comes with a Swagger description at https://vocabularies.ukdataservice.ac.uk/swagger/index.html

To query HASSET via the API, use https://vocabularies.ukdataservice.ac.uk/rest/v1/ as the baseURL.
Methods that require the ‘vocid' parameter should specify hasset in lower case and the 'lang’ parameter, if required, will always be en

 

Example:

1 2 3 curl -X 'GET' \ 'https://vocabularies.ukdataservice.ac.uk/rest/v1/hasset/?lang=en' \ -H 'accept: application/ld+json'

or

1 https://vocabularies.ukdataservice.ac.uk/rest/v1/hasset/?lang=en

 

will retrieve:

Response bodyownload

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 { "@context": { "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "skos": "http://www.w3.org/2004/02/skos/core#", "onki": "http://schema.onki.fi/onki#", "dct": "http://purl.org/dc/terms/", "uri": "@id", "type": "@type", "conceptschemes": "onki:hasConceptScheme", "id": "onki:vocabularyIdentifier", "defaultLanguage": "onki:defaultLanguage", "languages": "onki:language", "label": "rdfs:label", "prefLabel": "skos:prefLabel", "title": "dct:title", "@language": "en", "@base": "https://vocabularies.ukdataservice.ac.uk/rest/v1/hasset/" }, "uri": "", "id": "hasset", "marcSource": false, "title": "HASSET Thesaurus", "defaultLanguage": "en", "languages": [ "en" ], "conceptschemes": [ { "prefLabel": "HASSET", "uri": "https://hasset.ukdataservice.ac.uk/", "type": "skos:ConceptScheme" } ] }

Response headers

1 2 access-control-allow-origin: * content-length: 755 content-type: application/ld+json; charset=utf-8 date: Thu,19 Aug 2021 09:32:11 GMT server: Apache/2.4.6 (CentOS) PHP/7.4.19 vary: Accept x-powered-by: PHP/7.4.19