:- ensure_loaded(common).
cvs_id('$Id: people.pl,v 1.1 2005/03/22 22:52:21 sandro Exp $').
/*

  Skeletal foaf:Person view -- might some day grow into a social-network
  browser, like Orkut or Friendster, based on FOAF data.

  Not a bad "Hello World" introduction to writing tabs & views.

*/



tab(1000, Q, Focus, 'Person', +person_view(Q, Focus)) :-
	once(rdfq(Q, Focus, rdf:type, foaf:'Person'')).

person_view(Q, Focus, H) :-
	H=[h2('Oh, look, a person!'),
	   p('Name: ', +person_name(Q, Focus))
	  ].

person_name(Q, Focus, H) :-
	( rdfq(Q, Focus, foaf:givenname, literal(N1))
	; rdfq(Q, Focus, foaf:firstName, literal(N1))
	),
	( rdfq(Q, Focus, foaf:family_name, literal(N2))
	; rdfq(Q, Focus, foaf:surname, literal(N2))
	),
	delang(N1, N1L),
	delang(N2, N2L),
	H = [N1L, ' ', N2L].
