Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ante el hecho de querer cambiar esas URNs que terminan en número por un nombre, con el objetivo de poder identificarlos mejor en avisos y alertas de construcción de cubos; debemos seguir el siguiente procedimiento

...

xQuery para modificar en base eXist O3BI

...

Base eXist-db

  • Abrir el cliente exist-db con el comando exist-db-client.bat ubicado en <O3Instalación>/bat

  • Cambiar en la URL el valor 8080 por 8088

    Image Added
  • Luego Connect

  • En el icono de los prismáticos (ver imagen), hacer click

    Image Added
  • En la ventana de diálogo “Query Input” ingresar la consulta que se indica a continuación

    Image Added
  • Code Block
    xquery version "3.0";
    
    declare namespace vd='http://ns.ideasoft.biz/o3bi/schema/ViewDefinition/2011-01';
    declare namespace dc='http://purl.org/dc/terms';
    declare namespace dxml='http://ns.ideasoft.biz/o3bi/schema/CubeDefinition/2011-01';
    declare namespace ns6='http://ns.ideasoft.biz/o3bi/schema/CubeDefinition/2011-01';
    declare namespace ns3="http://ns.ideasoft.biz/common/schema/ScheduleTask/v7";
    declare namespace ns4="http://ns.ideasoft.biz/o3bi/schema/Ad-Hoc/2011-01";
    
    declare function local:chgViewRef($cubeUrn as xs:string, $newCubeUrn) as node()* {
    
    let $baseCollection:='/db/o3bi/domains/default/current/runtime'
    for $view in collection($baseCollection)//vd:viewDefinition[./dc:dublinCore/vd:cube/dc:identifier/text()=$cubeUrn]
        return update replace $view/dc:dublinCore/vd:cube/dc:identifier with element{'dc:identifier'}{$newCubeUrn}
    };
    
    declare function local:chgAdhocRef($cubeUrn as xs:string, $newCubeUrn) as node()* {
    
    let $baseCollection:='/db/o3bi/domains/default/current/runtime'
    for $adhoc  in collection($baseCollection)//ns4:adhoc//dc:identifier[./text() =$cubeUrn]
    return(
    	let $tst:= update replace $adhoc with element{'dc:identifier'}{$newCubeUrn} 
    	return $adhoc/..
    	)
    
    };
    
    declare function local:chgProfileRef($cubeUrn as xs:string, $newCubeUrn) as node()* {
    
    let $baseCollection:='/db/o3bi/domains/default/current/runtime'
    for $profile in collection($baseCollection)//dxml:cubeProfile[./dxml:cube/dc:identifier/text() = $cubeUrn]
        return (
    		let $sts1:= update replace $profile/dxml:cube/dc:identifier with element{'dc:identifier'}{$newCubeUrn}
    		return $profile
    	)
    
    };
    
    declare function local:chgTaskRef($cubeUrn as xs:string, $newCubeUrn) as node()* {
    
    	let $baseCollection:='/db/o3bi/domains/default/current/runtime'
    	for $scheduleTask  in collection($baseCollection)//ns3:scheduleTask/ns3:property[./ns3:key/text() = 'urn:cube' and ./ns3:value/text()=$cubeUrn]
    	return (
    		let $sts1:= update replace $scheduleTask/ns3:value with element{'ns3:value'}{$newCubeUrn}	
    		return	$scheduleTask/.. 
    	)
    };
    
    declare function local:chgCubeName($cubeName as xs:string, $newCubeName as xs:string, $prefixUrn as xs:string) as node()* {
    
    let $cubeUrn:=$prefixUrn|| $cubeName
    let $newCubeUrn:=$prefixUrn|| $newCubeName
    let $baseCollection:='/db/o3bi/domains/default/current/runtime'
    (:CubeName:)
    let $cube:=collection($baseCollection)/dxml:cubeDefinition[./dc:dublinCore/dc:identifier/text()=$cubeUrn]
    return
    if (not(empty($cube))) then (
    	let $sts1:= update replace $cube/dc:dublinCore/dc:identifier with element{'dc:identifier'}{$newCubeUrn}
    	let $sts1:= update replace $cube/ns6:cubeName with element{'ns6:cubeName'}{$newCubeName}
    	let $sts1:= if (not(empty($cube/dc:dublinCore/dc:name))) then  
    					update replace $cube/dc:dublinCore/dc:name with element{'dc:name'}{$newCubeName} 
    				else update insert element{'dc:name'}{$newCubeName} following $cube/dc:dublinCore/dc:namespace 
    	(:cubeView:)
    	let $views:=local:chgViewRef($cubeUrn, $newCubeUrn)
    (:chgProfileRef:)
    	let $profile:=local:chgProfileRef($cubeUrn, $newCubeUrn)
    (:chgTaskRef:)
    	let $task:=local:chgTaskRef($cubeUrn, $newCubeUrn)
    (:chgAdhocRef:)
    	let $adhoc:=local:chgAdhocRef($cubeUrn, $newCubeUrn)
    	return 
    	 element{'resultadoOk'} {
     $cube/ns6:cubeName,
     $profile/dxml:cube/dc:identifier,
     $profile,
            $cube,
    	     $views,
    $task,
    $adhoc
    	}
    ) else (
     element{'resultado'} {
         'No se encontro el cubo de name:'|| $cubeName
    	}
    )
    };
    
    
    (:Ejecucion de cambio de nombre:)
    let $cubeName:='2103'
    let $newCubeName:='

...

  • NombreNuevo'
    let $prefixUrn:='urn:o3bi:default:r:cube:a:'
    
    return local:chgCubeName($cubeName,$newCubeName, $prefixUrn)

  • Y hacer click sobre el icono

    Image Added

Consulta SQL para modificar en base de Liferay

Corresponde aplicar si hay ControlDashlets configurados con el cubo a modificar la urn

Code Block
languagesql
UPDATE PortletPreferences 
SET preferences = REPLACE(preferences, 'urn:o3bi:default:r:cube:a:2017' , 'urn:o3bi:default:r:cube:a:AtPresencial')

where preferences like'%urn:o3bi:default:r:cube:a:2017%'