Difference between revisions of "Java Examples"

From Info216
(Created page with "==Lecture 1== ===HelloJena.java=== <nowiki> package no.uib.sinoa.info216; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org....")
(No difference)

Revision as of 18:06, 18 January 2017

Lecture 1

HelloJena.java

package no.uib.sinoa.info216;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDFS;

public class HelloJena {

	public static void main(String[] args) {
		
		Model model = ModelFactory.createDefaultModel();
		
		Resource andreas = model.createResource("http://example.org/andreas");
		andreas.addLiteral(RDFS.label, "Andreas Lothe Opdahl");
		
		model.write(System.out, "TURTLE");

	}	
}