% Test 002 Jena 2.0 Toolkit
% prova_jena.bat or prova_jena.sh must be used to run this code.
% Jena packages should be in ./lib/jena.

% The example demonstrates how
%   - a model can be read from a file in RDF;
%   - it can be output to System.out accessed from a static field;
%   - to recover a Resource from the model that was read;
%   - to access a specific property inside this resource.
:- eval(test030()).

test030() :-
	println(["==========test030=========="]),
	Model = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(),
	IS = java.io.FileInputStream("vc-db-1.rdf"),
	ISR = java.io.InputStreamReader(IS),
	Model.read(ISR,""),
	% Write the model back in RDF
	Model.write(System.out),
	PersonURI = "http://somewhere/MattJones/",
	Vcard = Model.getResource(PersonURI),
	println(["Vcard=",Vcard]),
	% Retrieve the Statement with the specified VCARD.FN property
	PropertyStmt = Vcard.getProperty(com.hp.hpl.jena.vocabulary.VCARD.FN),
	println(["PropertyStmt=",PropertyStmt]),
	% Retrieve the Object in the Statement
	PropertyObject = PropertyStmt.getObject(),
	println(["PropertyObject=",PropertyObject]).
