:: Semantic Web Seminar
A course by the Department of Information and Computing Sciences.
A course on the Semantic Web
Jena & ARQ Semantic Web Application
Download the practice session.
Step-by-step Installation in Eclipse.
- Go to 'File' -> 'New' -> 'Project...'
- Select 'Java Project' and click 'Next'
- Give your project a name (eg. 'MySemwebApp')
- Click 'Finish'
- Find your project in the 'Package Explorer'
- If you do not see the 'Package Explorer' Press: Alt+Shift+Q, P
- Right click on your project
- Choose 'Import...'
- Choose 'Archive file' and click 'Next'
- Browse to the ZIP-file 'MySemanticWebApp.zip' and click 'Open'
- Click 'Finish'
- If the system asks to overwrite stuff, simply click 'Yes To All'
- Open the 'src' folder and go to the 'application' package.
- Open the file 'MyApp.java', this is your main application class.
- Run 'MyApp.java' by pressing Alt+Shift+X, J
- Or right-click the file in the package explorer, go to 'Run as' and choose 'Java Application'
- Open the 'model' package. Here's your rdf-model class 'MyRDFModel.java'.
- Open the 'queries' package. Here's your SPARQL query class 'MySPARQLQuery.java'.
Some general hints for using Eclipse
- Eclipse makes use of code completion. Whenever you use a Class, just hit '.' and a menu will appear showing you all Methods in that Class.
- By hitting
Ctrl+Space, Eclipse will show you all Methods and Classes available at the moment. - Try automatically tidying you code by hitting
Ctrl+F - If Eclipse says a resource is unavailable, hit
Ctrl+O. Eclipse will automatically add the package for the resource, if available.
- Jena's Javadoc
- You need to use a Resource, a Property and and a literal, which is a String in Java. They are all provided by Jena.
- You need to define the namespaces of your resources properly. Take a look at the constant
BASE_URIat the top of the code in MyApp.java, use it!
- A SPARQL Tutorial
- Things become simpler and less messy when you first define the namespaces of the properties you want to use in your query.
- If you want to put some text in between quotes inside your query-string, use the escape character. Like this:
\"text in quotes\"