|
| 1 | +# Linked Classical |
| 2 | + |
| 3 | +This repository contains the infrastructure developed for a linked data application in the context of classical music, Linked Classical. The application uses [a dataset from DBTune Classical](http://dbtune.org/classical/) as the base knowledge base, and allows for its expansion through SPARQL federation. This work was developed in the context of my master's dissertation, entitled "Federation Solutions for Linked Data Applications", and in the context of the [EPISA project](https://episa.inesctec.pt/). The main goals are the evaluation of federation solutions, interaction with linked data, and the development of a template for linked data applications. |
| 4 | + |
| 5 | +## Architecture |
| 6 | + |
| 7 | +The application is composed by three main components: an [Apache Jena Fuseki](https://jena.apache.org/documentation/fuseki2/index.html) triplestore, a [Java Spring Boot](https://spring.io/projects/spring-boot) REST API and a [Laravel](https://laravel.com/) frontend. These components and its interactions are represented by the following architecture diagram: |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Class Diagram |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +## Physical Model Diagram |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +## Labels Architecture |
| 21 | + |
| 22 | +To provide a human-readable version of a resource's name, new triples were created, with the following structure: |
| 23 | + |
| 24 | +```<resource-uri> rdfs:label <label>``` |
| 25 | + |
| 26 | +The `label` field was defined according to the type of the resource: |
| 27 | +- For composers, the label was derived from their names (`foaf:name`) |
| 28 | +- For musical works, the label was derived from their titles (`dc:title`) |
| 29 | +- For births and deaths, the label was derived from their dates (`ns5:date`) |
| 30 | + |
| 31 | +## URIs Architecture |
| 32 | + |
| 33 | +Even though all the resources in the knowledge base were already identified by URIs, defined by DBTune, there was a necessity to define new ones. The Linked Classical URIs were added to the dataset by creating new triples, with the following structure: |
| 34 | + |
| 35 | +``` <linked-classical-URI> owl:sameAs <dbtune-URI> ``` |
| 36 | + |
| 37 | +Note that the `owl:sameAs` property states that the subject and the object are the same resource. In this way, the Linked Classical URIs are associated with the respective resources. |
| 38 | + |
| 39 | +The Linked Classical URIs follow the following structure: |
| 40 | + |
| 41 | +``` http://example.org/linkedclassical/resource/<uuid> ``` |
| 42 | + |
| 43 | +Note that `uuid` is a generated universal unique identifier. To avoid an unnecessary parsing of the generated URIs, these generated identifiers were linked to the respective resource by creating triples with the following form: |
| 44 | + |
| 45 | +``` <resource-uri> rdf:id <uuid> ``` |
| 46 | + |
| 47 | +These universal unique identifiers are used by the routes of the frontend application: |
| 48 | +- [https://example.org/linkedclassicalclient/resource/<uuid>](https://example.org/linkedclassicalclient/resource/<uuid>) |
| 49 | +- [https://example.org/linkedclassicalclient/composer/<uuid>](https://example.org/linkedclassicalclient/composer/<uuid>) |
| 50 | +- [https://example.org/linkedclassicalclient/musicalWork/<uuid>](https://example.org/linkedclassicalclient/musicalWork/<uuid>) |
| 51 | + |
| 52 | + |
| 53 | +## SPARQL Federation |
| 54 | + |
| 55 | +### Composer's Geographical Insights |
| 56 | + |
| 57 | +To take advantage of the existence of URIs pointing to external knowledge bases on our dataset, we use federation techniques to retrieve additional information about a resource, particularty for composers. As an example, the location of a composer, present in our dataset as a geonames URI, is shown to the user as follows: |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +The following SPARQL query was used to retrieve the necessary information: |
| 62 | + |
| 63 | +```SPARQL |
| 64 | +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
| 65 | +PREFIX foaf: <http://xmlns.com/foaf/0.1/> |
| 66 | +PREFIX gn: <http://www.geonames.org/ontology#> |
| 67 | +PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> |
| 68 | +
|
| 69 | +SELECT ?location ?latitude ?longitude ?locationName ?locationPopulation |
| 70 | +WHERE { |
| 71 | + ?composer rdf:id "0bde8c6b-6695-47b8-933b-01aa4c53cc74" . |
| 72 | + ?composer foaf:based_near ?location . |
| 73 | + SERVICE <http://linkedgeodata.org/sparql> { |
| 74 | + ?location wgs84_pos:lat ?latitude ; |
| 75 | + wgs84_pos:long ?longitude ; |
| 76 | + gn:name ?locationName . |
| 77 | + OPTIONAL { ?location gn:population ?locationPopulation . } |
| 78 | + } |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +Note the usage of the `SERVICE` keyword, from SPARQL 1.1, to query a remote SPARQL endpoint. Having the coordinates of the location, we use [Leaflet](https://leafletjs.com/) to display a map with all the locations associated with a composer. When the user clicks a location, additional information, such as its name and population, can be seen. |
| 83 | + |
| 84 | +### Integration with External Datasets |
| 85 | + |
| 86 | +Within the Linked Classical application, a collaborative section within composer pages invites user engagement through the association of external resource that are the same as the respective composer resource. This collaboration results in the seamless integration of fresh insights, thereby enriching the interface’s informational landscape. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +The user chooses the external resource URI and its datasource and the application integrates new information retrieved from that datasource: |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +## Setup |
| 96 | + |
| 97 | +The first step for the setup of the application is to clone this repository: |
| 98 | + |
| 99 | +```git clone https://gitlab.inesctec.pt/episa/ld-app.git``` |
| 100 | + |
| 101 | +To run the application, run on the root of the repository: |
| 102 | + |
| 103 | +```./setup.sh``` |
| 104 | + |
| 105 | +To stop the application, run on the root of the repository: |
| 106 | + |
| 107 | +```./stop.sh``` |
| 108 | + |
| 109 | +## Usage |
| 110 | + |
| 111 | +After starting the application, the following services will be available: |
| 112 | + |
| 113 | +- Apache Jena Fuseki dashboard, available at `http://localhost:3030` |
| 114 | +- Sprint Boot REST API, available at `http://localhost:8080` |
| 115 | +- Laravel frontend, available at `http://localhost:8000` |
| 116 | + |
| 117 | +## Demo |
| 118 | + |
| 119 | + |
0 commit comments