About this Guide

This guide is intended for people who want to find information about the SPARQL endpoint for the ORI data.
For information on ORI itself, the User Guide and the Technical Reference provide details

The guide explains how to query the SPARQL data, and what you can expect back.

The main sparql server is at http://dlib-sparql.edina.ac.uk/endpoint/, and the additional entry points are listed below.

If you have further questions about the service that are not answered by the guide please contact the EDINA help desk team, or send email direct to: edina@ed.ac.uk

About the Organisation and Repository Identification SPARQL server

ORI provides a suite of APIs for calls, which are aimed at the developer needing to add Discovery-like functionality to her application, however there are situations where the ability to make more flexible calls into the dataset is desirable

ORI also provides a rendition of the dataset as a Linked Data file.

An important characteristic of the ORI SPARQL server is that it queries the Linked Data rendition of the dataset, not the original dataset. Results will be different.

The data within the server

The ORI Linked Data contains a number of classes, each of which has an array of Properties.

This table lists the Properties for each class, and the name-spaces used. There is also full description of the ontology

oarj:Repository
oarj:identifier
foaf:homepage
dc:title
gn:alternateName
oarj:acronym
oarj:namepreferred
oarj:description
oarj:comment
oarj:oaiBaseUrl
oarj:swordEndPoint
oarj:softwareName
oarj:softwareVersion
lv:iso639P1Code
geo:lat
geo:long
gn:countryCode
oarj:acceptsContentType
oarj:isRepositoryType
sioc:has_administrator
oarj:hasOrganisation
rdfs:seeAlso
oarj:Organisation
oarj:identifier
foaf:homepage
gn:name
gn:alternateName
oarj:acronym
oarj:namepreferred
geo:lat
geo:long
place:city
gn:countryCode
oarj:hasNetwork
oarj:hasRepository
org:hasSubOrganisation
org:subOrganisationOf
oarj:Url
oarj:url
oarj:dateChecked
oarj:good
oarj:hasOrganisation
oarj:hasRepository
oarj:Network
oarj:identifier
dc:title
gn:alternateName
oarj:ipRange
oarj:hasOrgansation
oarj:Agent
v.role
v.n
v.email
v:tel
sioc:administrator_of
oarj:RepositoryType
dc:title
oarj:RepositoryContentType
dc:title
PREFIX
dc: <http://purl.org/dc/elements/1.1/#>
dct: <http://purl.org/dc/terms/#>
foaf: <http://xmlns.com/foaf/0.1/">
geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
gn: <http://www.geonames.org/ontology#>
lv: <http://www.lexvo.org/ontology#>
oarj: <http://ori.edina.ac.uk/reference/linked/1.0/>
oo: <http://purl.org/openorg/>
org: <http://www.w3.org/ns/org#>
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
rdfs: <http://www.w3.org/2000/01/rdf-schema#>
sioc: <http://rdfs.org/sioc/ns#>
v: <http://www.w3.org/2006/vcard/ns#>
place: <http://purl.org/ontology/places#>

Using the SPARQL server

There are four URLs provided by the SPARQL server:

URLs 2-4 all return unframed, unformatted error codes when queried incorrectly

Note: When sending SPARQL queries over http, the actual query statement needs to be URL-Encoded.

For example, if using cUrl to perform a query:

  curl --data-urlencode "query=PREFIX gn: <http://www.geonames.org/ontology#>
  PREFIX oarj: <http://ori.edina.ac.uk/reference/linked/1.0/>
  SELECT ?name 
  WHERE { 
    ?s gn:name ?name.
    ?s gn:countryCode ?country.
    OPTIONAL {?s oarj:hasRepository ?r}.
    FILTER (?country='gb' && !(bound(?r))).
  } LIMIT 10" http://dlib-sparql.edina.ac.uk/sparql/

By default, queries return XML.

If you want a different output format, add in the curl request the header option (-H) followed by one of these formats:
"Accept: application/json" for JSON
"Accept: application/sparql-result+json" for SPARQL+JSON
"Accept: text/plain" for simple text

Alternatively, sending a query to /endpoint/ is possible to obtain further output formats on condition that they are supported by the query type.

An example of this query is:

	curl --data-urlencode "query=PREFIX gn: <http://www.geonames.org/ontology#>
	PREFIX oarj: <http://ori.edina.ac.uk/reference/linked/1.0/>
	SELECT ?id ?name 
	WHERE { 

	 ?s oarj:identifier ?id .
	 ?s gn:name ?name .

	} LIMIT 10" --data-urlencode "output=php_ser" http://dlib-sparql.edina.ac.uk/endpoint/
To obtain different output formats is necessary to replace the "output" value with one of the following:
output valuereturned format
htmltab HTML Table
xml SPARQL XML
json JSON
plain Plain
php_ser Serialized PHP
turtle Turtle
rdfxml RDF/XML
infos Query Structure
tsv Tab Separated Values (TSV)
csv Comma Separated Values (CSV)
plain Plain
sqlite SQLite database

Examples of SPARQL queries

List of UK organizations without repository
  PREFIX gn: <http://www.geonames.org/ontology#>
  PREFIX oarj: <http://ori.edina.ac.uk/reference/linked/1.0/>
	SELECT ?name 
	WHERE { 
	  ?s gn:name ?name.
	  ?s gn:countryCode ?country.
	  OPTIONAL {?s oarj:hasRepository ?r}.
	  FILTER (?country='gb' && !(bound(?r))).
	}

Acknowledgement

ORI was developed by EDINA, with funding from JISC