querying linked data on android

17
Querying Linked Data on Android Module 2 adaptation for Android enabled devices 28.08.2022 1

Upload: euclid-project

Post on 25-Jun-2015

1.512 views

Category:

Technology


1 download

DESCRIPTION

Querying Linked Data on Android

TRANSCRIPT

Page 1: Querying Linked Data on Android

13.04.2023 1

Querying Linked Data on Android

Module 2 adaptation for Android enabled devices

Page 2: Querying Linked Data on Android

13.04.2023 2

Outline

• This document complements to webinar Module 2: Querying Linked Data

• It targets querying linked data on mobile (Android) devices

• Original queries modified to correspond to limited resources environments

• Triple store implementation by Ontos AG (http:// www.ontos.com)

Page 3: Querying Linked Data on Android

13.04.2023 3

Webinar Structure

• OntoQuad installation instructions• Deployment of preloaded dataset in

OntoQuad• Running sample queries against the

OntoQuad SPARQL endpoint

Page 4: Querying Linked Data on Android

13.04.2023 4

OntoQuad Installation

• RDF store for Android• Detailed setup instructions already

provided by Ontos AG (attached)• Fresh installations should be started at

least once to initialize their data directory structures

• OntoQuad should be completely stopped before deploying preloaded datasets (next slides)

Page 5: Querying Linked Data on Android

13.04.2023 5

Prebuild dataset deployment

• Musicbrainz dataset extract– 5 million RDF triples subset– No special hardware requirements

(<1GB external storage)– Sufficient deployment and query

response times– Still representative for demonstration

and educational purposes

Page 6: Querying Linked Data on Android

13.04.2023 6

Prebuild dataset setup

• Download the binary files archive (musicbrainz-5m-bin.zip) on your PC

• Extract the archive on the local file system– Important files and folders: ./vm,

./txlogs, .universe, .commands

• Ensure OntoQuad in not active/running before performing the next steps

Page 7: Querying Linked Data on Android

13.04.2023 7

Prebuild dataset setup (2)

• Connect the mobile device via appropriate USB cable to PC and overwrite the existing files in folder: /storage/extSdCard/margot/ with the ones from the archive

• Disconnect the mobile device and start the OntoQuad server

Page 8: Querying Linked Data on Android

13.04.2023 8

Setup Verification

• Start the Admin Console and select the SPARQL section (it will take some time)

• Execute the following query:SELECT (COUNT(?s) as ?count)WHERE { ?s ?p ?o }

• The result count value should be approximately 5 million

Page 9: Querying Linked Data on Android

13.04.2023 9

Module 2 for Android

• Based on original Webinar Module 2 content

• SPARQL queries adapted for the extracted data set and the current implementation limitations

• Each query description refers to the original location in the Module 2 presentation

Page 10: Querying Linked Data on Android

13.04.2023 10

Module 2 for Android (2)

• What albums did Queen make (slide 15) ?

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX mo: <http://purl.org/ontology/mo/>

SELECT ?albumWHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album a mo:Release ; dc:title ?title} ORDER BY ?title

Page 11: Querying Linked Data on Android

13.04.2023 11

Module 2 for Android (3)

• What albums and tracks did Queen make (slide 22) ?

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX mo: <http://purl.org/ontology/mo/>

SELECT ?album_name ?track_titleWHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album dc:title ?album_name ; mo:record ?record . ?record mo:track ?track . ?track dc:title ?track_title . }

Page 12: Querying Linked Data on Android

13.04.2023 12

Module 2 for Android (4)

• Retrieve the albums and tracks recorded by Queen, where the duration of the song is more than 300 secs. and no longer than 400 secs (slide 23)

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX mo: <http://purl.org/ontology/mo/>

SELECT ?album_name ?track_title ?durationWHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album dc:title ?album_name ; mo:record ?record . ?record mo:track ?track . ?track dc:title ?track_title ;

mo:duration ?duration; FILTER (?duration > 300000 && ?duration < 400000) }

Page 13: Querying Linked Data on Android

13.04.2023 13

Module 2 for Android (5)

• Retrieve the name of the albums recorded by Queen which have at least two different songs (slide 24)

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX mo: <http://purl.org/ontology/mo/>

SELECT DISTINCT ?album_nameWHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album dc:title ?album_name ;

mo:record ?record . ?record mo:track ?track1 . ?record mo:track ?track2 . FILTER (?track1 != ?track2) }

Page 14: Querying Linked Data on Android

13.04.2023 14

Module 2 for Android (6)

• Retrieve the duration of the albums recorded by Queen (slide 25)

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX mo: <http://purl.org/ontology/mo/>

SELECT ?album ?album_name (SUM(?track_duration) AS ?album_duration)WHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album mo:record ?record ; dc:title ?album_name. ?record mo:track ?track . ?track mo:duration ?track_duration .} GROUP BY ?album ?album_nameHAVING (SUM(?track_duration) > 3600000)

Page 15: Querying Linked Data on Android

13.04.2023 15

Module 2 for Android (7)

• Create the dc:creator descriptions for albums and their tracks recorded by Queen (slide 29)*

PREFIX dbpedia: <http://dbpedia.org/resource/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dc: <http://purl.org/dc/elements/1.1/>

CONSTRUCT { ?album dc:creator ?band . ?track dc:creator ?band .}WHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album mo:record ?record . ?record mo:track ?track . }

*Note: CONSTRUCT queries might not work properly with the current implementation

Page 16: Querying Linked Data on Android

13.04.2023 16

Module 2 for Android (8)

• Create the dc:creator descriptions of the albums recorded by Queen whose title contains the word 'rock’ (slide 31)*

PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>

CONSTRUCT { ?album dc:creator ?band }WHERE { ?band foaf:name "Queen" . ?band foaf:made ?album . ?album dc:title ?album_name . FILTER (REGEX(?album_name, ".*rock.*", "i")) }

*Note: CONSTRUCT queries might not work properly with the current implementation

Page 17: Querying Linked Data on Android

13.04.2023 17

Module 2 for Android

Thank you!