Showing posts with label jena. Show all posts
Showing posts with label jena. Show all posts

Saturday, August 27, 2011

Setup Semantic Web Development Environment

What you need:
The following links will take you to the download area for each tool.

Java JDK
Eclipse
Jena
Protege
Pellet

Jena Tutorial
The following website will give you a step-by-step tutorial for the Jena library in Eclipse.

http://www.iandickinson.me.uk/articles/jena-eclipse-helloworld/

Note:  The following is the completed JenaTutorial example for HelloRDFWorld.java


package tutorial;

import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;

public class HelloRDFWorld {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Model m = ModelFactory.createDefaultModel();
		String NS = "http://example.com/test/";
		
		Resource r = m.createResource(NS + "r");
		Property p = m.createProperty(NS + "p");
		
		r.addProperty(p,"hello world", XSDDatatype.XSDstring);
		
		m.write(System.out, "Turtle");
	}

}

The following is a screenshot of the completed HelloSemanticWeb example for Chapter 2 of the book.