% 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;
%   - recover a Resource from the model that was read.
:- eval(test033()).

test033() :-
	println(["==========test030=========="]),
	Model = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(),
	IS = java.io.FileInputStream("vc-db-1.rdf"),
	ISR = java.io.InputStreamReader(IS),
	println(["ISR=",ISR]),
	Model.read(ISR,""),
%	Selector = com.hp.hpl.jena.rdf.model.impl.SelectorImpl(Vcard,com.hp.hpl.jena.vocabulary.VCARD.FN,0),
%	type(Selector,TS),
%	println(["type(Selector)=",TS]),
%	Iter2 = Model.listStatements(Selector),
%	element(Subj2,Iter2),
%	println(["Subj2=",Subj2]),
%	Iter2 = Vcard.listStatements(),
%	println(["Iter2=",Iter2]),
%	element(Subj2,Iter2),
%	println(["Subj2=",Stmt]),
%	PropertyName2 = Vcard.getProperty(com.hp.hpl.jena.vocabulary.VCARD.FN),
%	println(["PropertyName2=",PropertyName2]),
	println(["Prop=",com.hp.hpl.jena.vocabulary.VCARD.FN]),
%	Iter = Model.listStatements(),
%	element(Stmt,Iter),
%	println(["Stmt=",Stmt]),
%	Iter = Model.listSubjects(),
	Iter = Model.listSubjectsWithProperty(com.hp.hpl.jena.vocabulary.VCARD.FN),
%	println(["Iter=",Iter]),
	element(Subj,Iter),
	println(["Subj=",Subj," ",Vcard]),
	type(Subj,T),
	println(["type(Subj)=",T]),
%	Stmt=Vcard,
	PropertyName = Subj.getProperty(com.hp.hpl.jena.vocabulary.VCARD.FN),
	println(["PropertyName=",PropertyName]),
	Name = PropertyName.getObject(),
	println(["Name=",Name]).
