All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xsparql.base.foaf_lifting.xsparql Maven / Gradle / Ivy

The newest version!
declare namespace foaf="http://xmlns.com/foaf/0.1/"; 
let $doc := doc("http://xsparql.deri.org/data/relations.xml")
let $persons := $doc//*[@name or ../knows] 
return 
 for $p in $persons 
 let $n := if( $p[@name] ) then $p/@name else $p 
 let $id := count($p/preceding::*) + count($p/ancestor::*) 
 where not(exists($p/following::*[@name=$n or data(.)=$n])) 
 construct 
 { _:b{$id} a foaf:Person; 
            foaf:name {data($n)}. 
   { for $k in $persons 
     let $kn := if( $k[@name] ) then $k/@name else $k 
     let $kid :=count($k/preceding::*) + count($k/ancestor::*) 
     where $kn = data($doc//*[@name=$n]/knows) and 
                 not(exists($kn/../following::*[@name=$kn or data(.)=$kn])) 
     construct 
     { _:b{$id}  foaf:knows _:b{$kid}. 
       _:b{$kid} a foaf:Person. }
   } 
 }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy