@prefix sp: <http://spinrdf.org/sp#>.
@prefix spin: <http://spinrdf.org/spin#>.
@prefix spl: <http://spinrdf.org/spl#>.
@prefix ex: <ex:>.

ex:plusOne a spin:MagicProperty ;
	spin:constraint [
		a spl:Argument ;
		spl:predicate sp:arg1
	] ;
	spin:body [
			a sp:Select ;
			sp:text """PREFIX ex: <ex:>
						SELECT ?y
						WHERE {?arg1 ex:prop ?x . bind(?x+1 as ?y)}""" 
	] .

ex:TestClass a rdfs:Class ;
		spin:rule [
				a sp:Construct ;
				sp:text """PREFIX ex: <ex:>
							CONSTRUCT {?this ex:newProp ?o}
							WHERE {
								?this ex:plusOne ?o .
							}""" 
		] .

ex:testSubj1 a ex:TestClass ;
	ex:plusOne 2 .
ex:testSubj2 a ex:TestClass ;
	ex:prop 5 .
