
file_search_path(semwalker, '/home/sandro/semwalker').

:- ensure_loaded(semwalker(qtest)).
:- ensure_loaded(semwalker(datapage_parser)).

qtest(dp) :-
	XML = [ element(p, [], ['This page uses the ', Link, ' with ' | Vocabs]) ],
	
	Link = element(a, [href='http://www.w3.org/2006/06/datapage'], ['datapage conventions']),
	Vocabs = [],
	xml_codes3(XML, XMLCodes),
	parse_datapage(XMLCodes, []).

qtest(dp1) :-
	xml(1, XML), 
	xml_codes3(XML, XMLCodes),
	parse_datapage(XMLCodes, []).

qtest(data_header) :-
	flag_content(Version, Vocabs, [84, 104, 105, 115, 32, 112, 97, 103, 101, 32, 117, 115, 101, 115, 32, 116, 104, 101, 32, element(a, [href='ver'], [100, 97, 116, 97, 112, 97, 103, 101, 32, 99, 111, 110, 118, 101, 110, 116, 105, 111, 110, 115]), 32, 119, 105, 116, 104, 32, element(a, [href=n2], [118, 50]), element(a, [href=n3], [118, 51]), element(a, [href=n4], [118, 52]), element(a, [href=n1], [118, 49]), 46, 10], Rest),
	Version = 'ver',
	Vocabs = [n2, n3, n4, n1],
	Rest = [46, 10].

qtest(vocab) :-
	vocab(V, [element(a, [href=n1], [118, 49]), 46, 10], Rest),
	V = n1,
	Rest = [46, 10].
	

qtest :-
	xml(33, XML), 
	xml_codes3(XML, XMLCodes),
	data_header(Control, XMLCodes, []),
	Control = control('dpc-v1', [n2, n3, n4, n1]).

qtest :-
	xml(333, XML), 
	xml_codes3(XML, XMLCodes),
	data_header(Control, XMLCodes, []),
	Control = control('dpc-v1', [n2, n3, n4, n1]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

qtest :-
	Text = [element(a, [href=n2], [118, 50]), element(a, [href=n3], [118, 51]), element(a, [href=n4], [118, 52]), element(a, [href=n1], [118, 49]), 46, 10], 
	zero_or_more(vocab, _Vocabs, Text, Rest),
	Rest = [46, 10].

qtest :-
	Text = [element(a, [href=n2], [118, 50]), element(a, [href=n3], [118, 51])],
	zero_or_more(vocab, Vocabs, Text, []),
	Vocabs = [n2, n3].

qtest :-   %% CORE PROBLEM -- unification order on this....
	Rest = [46, 10],
	Text = [element(a, [href=n2], [118, 50]), element(a, [href=n3], [118, 51]),  46, 10],
	zero_or_more(vocab, Vocabs, Text, Rest),
	Vocabs = [n2, n3].


qtest :-
	Text = [element(a, [href=n2], [118, 50])],
	zero_or_more(vocab, _Vocabs, Text, []).

qtest :-
	Text = [],
	zero_or_more(vocab, _Vocabs, Text, []).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

qtest(external) :-
	t(1,[]),
	t(2,[]),
	t(3,[]),
	t(4,[]).

qtest(e5) :-
	tp(5, []).