Saturday, January 13, 2018

Notes Getting a Jena Example Running in Eclipse

Step 1: Get the Jena Library into Eclipse Oxygen.

Go to: Window>Preferences>Java>Build Path>UserLibraries>New>{Add Name}>Add External JARS>Save/Continue

like in the first part of:

[Tutorial] Using Apache Jena with Eclipse + HelloWorld! | Apache Jena con Eclipse + HelloWorld! https://www.youtube.com/watch?v=nrv_Y3AEWLk

Step 2: Create project folder, if you have not already. Once this is created, right click on the folder>Select Build Path>Add Libraries>User Library>Jena

See: Jena tutorial - download and setup Jena in Eclipse (Semantic web applications)
https://www.youtube.com/watch?v=u4rPZynTWFo&index=1&list=PLr_TipxhoDryHmYOZWH9LrZmB2G0DJ2IUStep 3: Create an RDF file. Make sure you change the file associations to (XML or something else?) if the file associates with Firefox (or perhaps some other web browser?)

I tried: Window>Preferences>General>Editors>File Associations>File Types>Add>*.rdf

Secondly, for Window>Preferences>General>Editors>File Associations>Associated Editors>Add>XML Editor

Inspiration : (https://stackoverflow.com/questions/5859641/eclipse-associate-an-editor-with-a-content-type)

Step 4: Create the Java file as in the video below, and run it.

Apache Jena tutorial - write models in different formats with jena RDF,TURTLE,JSON)https://www.youtube.com/watch?v=Ps_cVNSwfeA&index=3&list=PLr_TipxhoDryHmYOZWH9LrZmB2G0DJ2IU





Step 5: Set up a Sparql query.

Follow:
Apache jena tutorial - using sparql with jena to query rdf document (https://www.youtube.com/watch?v=nUdHneViLp4&list=PLr_TipxhoDryHmYOZWH9LrZmB2G0DJ2IU&index=4)


I found it useful to look at this Stackoverflow page to find other classes and interfaces that were missing from the video:

https://stackoverflow.com/questions/38640091/retrieve-items-from-a-model-in-jena

I produced screenshots of the result 
 




No comments:

Post a Comment