The following example queries can be viewed below:
- Use curl with these SPARQL-Queries
- Get all organisations, their URIs and their geographical coordinates
- Get the organisations located within a maximum distance to a specfic place
- Get the organisations located at a specific region which are holders of a specific resource
- Get the organisations located at a specific region which are holders of a resource with a specific ISBN
- Get an item of a specific manifestation which is held by a library at a a specific region
- Full text search of names of organisations
- Search for organizations by organization type
- Get postal data and the telephonenumber (not fax) from a specific library
- Get the holders of a manifestation
- show me all graphs
- federated search query
You can test these SPARQL queries at the webform at http://lobid.org/test/
Note: through "--data-urlencode" we need not to substitute i.e. a '+' with '%2B'.
Additionally, the distance itself is requested.
This query gets all organisations located within a circle of D = 100 km radius around a place at φ = 50.9341º in latitude and λ = 6.93549º in longitude ( a place in Cologne, Germany ).
The other numeric values in the query must be calculated from the geo-coordinates φ and λ of the observer (the "specific place"), the maximum desired distance D and a reference latitude φ 0 as follows:
φ 0 in this example was chosen to be φ 0 = 51.0º
cos(φ 0)·sin(φ 0)·π/180 = 0.00853595
cos(φ 0)·(cos(φ 0) - sin(φ 0)·π/180·(φ -2·φ0)) = 0.831939969105
(D / brgrad) 2 = 0.808779738472242
where brgrad is the mean distance between two latitude circles, brgrad = 111.1949 km.
The variable d2brgrad in the select clause is the square of the distance of the organisation to the observer, d, divided by the square of brgrad.
The calculation in this query is an approximate one. It is only good for locations which are near to the observer point where "near" means that their distance to the observer point is small as compared to the radius of the earth, d < D << R = 6371 km . The reference latitude φ 0 must be chosen to be near the observer point where "near" has the same meaning as above. Within Germany, the approximation is good to better than 0.1% in distance.
Near the poles of the earth, the approximation is not good. For the distance in longitude must be actually also small compared to cos(φ 0)·R , not only to R. At the equator, cos(φ 0) = 1 and it decreases towards the poles. At φ 0 = 60º and φ 0 = -60º, we have cos(φ 0) = ½. Beyond φ 0 = 85º and φ 0 = -85º the approximation should not be used.
The returned valued d2brgrad can be transformed as follows to the distance between the organisation and the observer :
d = SQRT( d2brgrad ) * brgrad .
SPARQL cannot compute the square root, so this last step must be done by some external program.
Search for libraries which are not more than 5 km away from a point in Cologne (50.9341º in latitude and 6.93549º in longitude) which have an item of the bibliographic resource http://lobid.org/resource/HT000543651.
Get the organisations located at a specific region which are holders of a resource with a specific ISBN
Search for libraries which are not more than 5 km away from a point in Cologne (50.9341º in latitude and 6.93549º in longitude) which have an item of a bibliographic resource with the ISBN "978-3-631-58937-3".
In the example we search for all organization which a classified as central university libraries (see the libtype vocab for information on the underlying classification).
Querying the lobid.org database using an ISBN. The lobid.org resource has a link to dbpedia.org, and thus the dbpedia.org is queried using this link (the example is this lobid-resource). The keyword "SERVICE" enables the federated search, specified by the SPARQL-Endpoints of these "services".