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

xsparql.base.usecase-lowering.xsparql Maven / Gradle / Ivy

The newest version!
declare namespace bkrdf="http://example.org/bookTicket#";                    
declare namespace bkxml="http://example.com/bookTicket.xsd";                 
declare namespace tool="http://example.com/tools";
                                                                             
declare function tool:locationLowering ($node, $name) {                           
  for $city $country $station from                          
     where { optional { $node a bkrdf:TrainStation ;                         
                               bkrdf:name $station ;                               
                               bkrdf:isInCity $cityNode .                          
                           $cityNode bkrdf:name $city ;                            
                               bkrdf:isInCountry $countryNode .                    
                           $countryNode bkrdf:name $country . }                    
               optional { $node a bkrdf:City ;                               
                               bkrdf:name $city ;                                  
                               bkrdf:isInCountry $countryNode .                    
                           $countryNode bkrdf:name $country . } }                  
     return                                                                  
       element { $name } {
                                                             
         {$country}             
         {$city}                        
         { if ($station) then {$station} else () }   
        
      }                                                                      
};
                                                                             
for $date $count $from $to from                             
where { $req a bkrdf:ReservationRequest ;                                      
           bkrdf:time $date ;                                             
           bkrdf:from $from ;                                             
           bkrdf:to $to ;                                                 
           bkrdf:passengerCount $count . }                                
return                                                                       
                                                 
     {$date}                    
     {$count}       
     { tool:locationLowering($from, bkxml:start) }                                
     { tool:locationLowering($to, bkxml:destination) }                            
  




© 2015 - 2025 Weber Informatics LLC | Privacy Policy