Jump to content

User:Feeglgeef/wf-query-examples

From Wikifunctions
  • Functions with labels starting with a capital, between Z11000 and Z12000
$filter(
  $,
  function($item) {
    $item.Z2K3.Z12K1[1].Z11K2 ~> $match(/^[A-Z]/) and
    $number($substringAfter( $item.Z2K1.Z6K1, "Z")) >= 11000 and
    $number($substringAfter( $item.Z2K1.Z6K1, "Z")) <= 12000 and
    $item.Z2K2.Z1K1 = "Z8"
  }
)
  • Tests or implementations without a German label
$filter(
 $,
 function($item) {
   $not($exists($item.Z2K3.Z12K1[Z11K1 = "Z1430"])) and
   ($item.Z2K2.Z1K1 = "Z20" or $item.Z2K2.Z1K1 = "Z14")
 }
)
  • Functions with at least one Rational Number input and Boolean output
$filter(
 $,
 function($item) {
   $item.Z2K2.Z8K1[Z17K1 = "Z19677"] and
   $item.Z2K2.Z8K2 = "Z40"
 }
)
  • Python implementations
$filter(
 $,
 function($item) {
   $item.Z2K2.Z14K3.Z16K1 = "Z610"
 }
)
  • Predefined types
$filter(
 $,
 function($item) {
   $item.Z2K2.Z1K1 = "Z4" and
   $number($substringAfter( $item.Z2K1.Z6K1, "Z")) < 10000
 }
)
  • Objects with a French label
$filter(
 $,
 function($item) {
   $item.Z2K3.Z12K1[Z11K1 = "Z1004"]
 }
)
  • Objects with a label in more than 3 languages
$filter(
 $,
 function($item) {
   $count($item.Z2K3.Z12K1) > 4 /*4 instead of 3 because typed lists*/
 }
)
  • Objects with no description in English
$filter(
 $,
 function($item) {
   $not($exists($item.Z2K5.Z12K1[Z11K1 = "Z1002"]))
 }
)
  • Objects with a label in French, but not in Breton
$filter(
 $,
 function($item) {
   $exists($item.Z2K3.Z12K1[Z11K1 = "Z1004"]) and
   $not($exists($item.Z2K3.Z12K1[Z11K1 = "Z1282"]))
 }
)