Prolog Examples - Gnorion/BizVR GitHub Wiki

Prolog Examples (using Visual Prolog)

Example 1

image

Example 2

image

Expressed in Biz:

// SIBLING: IF x and y have the same parent then they are siblings
binding:	{p1, p2 in RDF where predicate='parent', p1.subject=p2.subject} 
action:		RDF.new(p1.object,'sibling',p2.object)

// FATHER: if p is the father of x then p is a parent of x
binding:	{p in RDF where predicate='father'}
action:		RDF.new(p.subject,'parent',p.object)

// PARENT: if p is the father of b then p is also the parent of any brother of b
binding:	{p, b in RDF where p.predicate='father', b.predicate='brother',p.object=b.subject}
action:		RDF.new(p.subject,'parent',b.object)