
:- [rdelta, ns].
:- rdf_register_ns(code, 'http://www.w3.org/2004/???code???').
:- rdf_register_ns(test, 'http://www.w3.org/2004/???test???').

rdelta_provide(_DB, _V, S, T, O, C) :-
	storable_term(test:incr, T),
	storable_term(code:rdelta_test_provide, C),
	number(O), number(S), O is S+1.
rdelta_provide(_DB, _V, S, T, O, C) :-
	storable_term(test:incr, T),
	storable_term(code:rdelta_test_provide, C),
	var(O), number(S), O is S+1.
rdelta_provide(_DB, _V, S, T, O, C) :-
	storable_term(test:incr, T),
	storable_term(code:rdelta_test_provide, C),
	number(O), var(S), S is O-1.

go1 :-
	rxm(match(1,B,C,D)),
	B = 'http://www.w3.org/2004/???test???incr',
        C = 2,
	D = 'http://www.w3.org/2004/???code???rdelta_test_provide'.

	
go2 :- 	rxm(match(A,test:incr,9,D)),
        A = 8,
	D = 'http://www.w3.org/2004/???code???rdelta_test_provide'.


go3 :- 	rxm(match(3,test:incr,4,D)),
	D = 'http://www.w3.org/2004/???code???rdelta_test_provide'.

go4 :- 	rxm(match(3,test:incr,4,code:rdelta_test_provide)).

go :-
	go1, go2, go3, go4.