Mostrando entradas con la etiqueta xquery. Mostrar todas las entradas
Mostrando entradas con la etiqueta xquery. Mostrar todas las entradas

consulta mismo DGMkey

for $anun in input()/anuncio
let $key := $anun/DGMkey
where count(for $b in input()/anuncio where $b/DGMkey = $key return $anun/DGMkey)>1
return

{ $key , count(for $b in input()/anuncio where $b/DGMkey = $key return $anun/DGMkey)}

consulta ordenar

for $q in input() /anuncio
where $q/ordenBoletin
orderby xs:int($q/ordenBoletin)
return <anuncio>{$q/codigo, $q/ordenBoletin}</anuncio>

consulta mismo codigo y versión

-- query mismo codigo y version:
for $a in input()/anuncio
let $y := $a/codigo
where $a/DGMversionData/DGMversNumber = 99 and
count(for $b in input()/anuncio where $b/codigo = $y and $b/DGMversionData/DGMversNumber=99 return $a/codigo)>1
return

{ $y , count(for $b in input()/anuncio where $b/codigo = $y and $b/DGMversionData/DGMversNumber=99 return $a/codigo), $a/estado}

insertar

update insert
<tag2>xxxxxxx<tag2>
following input()/anuncio/tag1[//DGMkey="00000"]

//un poco más general --aquí se puede sustituir into por
following $a/nombreCampo
update for $a in input()/anuncio
where $a/numeroBoletin
do (
insert
<anio>2008</anio> into $a
)

modificar

update replace input()/anuncio/estado[//DGMkey="xxxxxxx"]
with <estado>Publicable</estado>

update for $a in input()/anuncio
where $a/DGMkey="xxxxxxx"
do replace $a/tag1/tab2 with <tag2>98</tag2>

borrar

----- borro todo el documento
update for $a in input() /entidad[DGMkey="00000"]
do(delete root($a))

----- borro todo el documento
update for $a in input()./DGMnoxml/test.txt
do(delete root($a))

----- borro solo el nombreCampo dentro de un documento con condiciones
update delete input()/anuncio/nombreCampo[//estado="test"]

----- borro solo el nombreCampo dentro de un documento con condiciones
update for $a in input()/boletin
where $a/DGMkey="1560"
do(delete $a/
nombreCampo)