SPARQL DROP MACRO LIBRARY ; SPARQL PREFIX rel: ## CREATE SPIN LIBRARY CREATE SPIN LIBRARY { CLASS <#RoyalPerson> { comment """ Class instance generated from a Macro that customizes relations such as rel:siblingOf while introducing new relations such as <#hasAuntie>, <#hasUncle>, and <#hasCousin> . """ defmacro rel:ancestorOf { ?this rel:ancestorOf ?n } {{ { ?this rel:parentOf+ ?n . } UNION { ?this rel:siblingOf ?n . } FILTER ( NOT EXISTS {?this rel:siblingOf|^rel:siblingOf ?n} ) }} defmacro rel:descendantOf { ?this rel:descendantOf ?n } {{ { ?this ^rel:parentOf+ ?n . } }} defmacro rel:sibingOf { ?this rel:siblingOf ?n } {{ [] rel:parentOf ?this, ?n. FILTER (?n != ?this) . }} defmacro <#hasAuntie> { ?this <#hasAuntie> ?n } {{ [] rel:parentOf ?this ; rel:siblingOf ?n . ?n a <#FemalePerson> . }} defmacro <#hasUncle> { ?this <#hasUncle> ?n } {{ [] rel:parentOf ?this ; rel:siblingOf ?n . ?n a <#MalePerson> . }} defmacro <#hasCousin> { ?this <#hasCousin> ?n } {{ [] rel:parentOf ?n ; rel:siblingOf [ rel:parentOf ?this ] . }} } } ASK FROM virtrdf: WHERE { ?s ?o } ;