Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ontology engineering Lab #8 – October 20, 2014.

Similar presentations


Presentation on theme: "Ontology engineering Lab #8 – October 20, 2014."— Presentation transcript:

1 Ontology engineering Lab #8 – October 20, 2014

2 Installing Fuseki a SPARQL Server (Windows)
Download the jena-fuseki distribution.zip file from Unzip the folder Find the fuseki-server.jar file. Create a subdirectory in the directory where this .jar file is located, name it dataDir Open a command prompt and navigate to the directory of the .jar file Enter the command: fuseki-server --update -- loc=dataDir /myDataSet

3 Running Fuseki If your installation of Fuseki was successful, then you’ll see a number of messages appear in the Command Prompt window. Once the messages, stop appearing. Open a browser and enter: in the address bar. At the next page, click on the Control Panel link. At the Fuseki Control Panel page select the /myDataset dataset If all has gone well, you’ll be taken to a page that looks like this…

4 Fuseki Query Page To exit Fuseki, simply close your browser and enter Ctrl+C in the Command Prompt Window

5 Loading Data into Fuseki
Run the following construct query on the Dbpedia SPARQL Server: CONSTRUCT {?country dbpedia-owl:capital ?capital . ?country dbpprop:gdpNominalPerCapita ?gdbPerCapita . ?country dbpprop:gdbNominalPerCapitaRank ?gdbPerCapitaRank . ?country dbpprop:gdpNominalYear ?gdpYear . ?country dbpprop:hdi ?hdi . ?country dbpprop:hdiRank ?hdiRank . ?country dbpprop:hdiYear ?hdiYear . } WHERE { ?country rdf:type dbpedia-owl:Country . ?country dbpedia-owl:capital ?capital . ?country dbpprop:gdpNominalPerCapitaRank ?gdbPerCapitaRank . ?country dbpprop:hdiYear ?hdiYear . }

6 Loading Data into Fuseki
Choose “Turtle” as the results format and save the output in a file named countrydata.ttl in the Data subdirectory of the directory in which the fuseki- server.jar file is located. Using the Browse button of the File Upload section, select the countrydata.ttl file. Leave the graph set to default and select the Upload button. You should see a page declaring SUCCESS and that you’ve loaded 343 triples. Use your browser’s back button to return to the Query page.

7 Loading Data into a Named Graph in Fuseki
In the SPARQL Update pane enter the following INSERT DATA query: PREFIX persons: < CREATE GRAPH <persons:royals> Next, browse to the individuals.owl file change the graph from default to persons:royals and click on the Upload button. If successful you should see a screen confirming that you’ve loaded 830 triples

8 Selecting Data from a Named Graph
The following query will return a set of results from the <persons:royals> graph: PREFIX persons: < PREFIX agent: < PREFIX rdf: < SELECT ?person1 ?relation ?person2 FROM <persons:royals> WHERE { ?person1 rdf:type agent:Person . ?person2 rdf:type agent:Person . ?person1 ?relation ?person2 . }

9 Removing Triples The CLEAR DEFAULT command removes all triples from the default graph The CLEAR GRAPH <> command removes all triples from a particular named graph. For example, CLEAR GRAPH <person:royals> removes all triples from the named graph we’ve created earlier The CLEAR NAMED command removes all triples from all named graphs

10 Removing Graphs The DROP DEFAULT command removes all triples from the default graph as you cannot drop the default graph The DROP GRAPH <> command removes a particular named graph. For example, DROP GRAPH <persons:royals> removes the named graph we’ve created earlier The DROP NAMED command removes all named graphs The DROP ALL command removes all triples from the default graph and removes all named graphs

11 Adding Data The following query adds a triple to the named graph <persons:royals> from Dbpedia asserting that Edward VII is a parent of George_V: PREFIX persons: < PREFIX dbpprop: < PREFIX dbpedia: < INSERT DATA {GRAPH <persons:royals> {dbpedia:Edward_VII dbpprop:issue dbpedia:George_V } }

12 Deleting Data The following DELETE request removes the parent relationship between George the 5th and Edward the 8th PREFIX persons: < PREFIX agent: < DELETE DATA {GRAPH <persons:royals> {persons:GeorgeThe5th agent:is_parent_of persons:EdwardThe8th}}

13 Deleting Data The following Delete request removes all of George the 5th’s parent relationships: PREFIX persons: < PREFIX agent: < DELETE {GRAPH <persons:royals> {persons:GeorgeThe5th agent:is_parent_of ?child}} WHERE

14 Updating Data The following query changes the triple:
{dbpedia:Edward_VII dbpprop:issue dbpedia:George_V} to the triple: {persons:EdwardThe7th agent:is_parent_of persons:GeorgeThe5th } PREFIX persons: < PREFIX dbpprop: < PREFIX dbpedia: < PREFIX agent: < DELETE {GRAPH <persons:royals> {dbpedia:Edward_VII dbpprop:issue dbpedia:George_V } } INSERT WHERE

15 Updating Data The following request uses the “WITH” keyword to accomplish the same changes as the previous request, but with fewer keystrokes: PREFIX persons: < PREFIX dbpprop: < PREFIX dbpedia: < PREFIX agent: < WITH <persons:royals> DELETE {dbpedia:Edward_VII dbpprop:issue dbpedia:George_V } INSERT {persons:EdwardThe7th agent:is_parent_of persons:GeorgeThe5th } WHERE


Download ppt "Ontology engineering Lab #8 – October 20, 2014."

Similar presentations


Ads by Google