wiki:PublicView

Version 2 (modified by detwiler, 11 years ago) (diff)

updated public view on wiki

The following is the full PublicView.xq. The public view is generated by the CSM.rxq RXQuery file, which is a bit shorter. my_canonical_view.cv is an abbreviated database schema.

<root> {
	for $term in CanonicalView("my_canonical_view.cv")/term
	return 
	<term> 
		<parent> {$term/parent/text()} </parent> 
		<sequence> {$term/sequence/text()} </sequence> 
		<authority> {$term/authority/text()} </authority> 
		<comment> {$term/comment/text()} </comment> 
		<fullname> {$term/fullname/text()} </fullname> 
		<abbrev> {$term/abbrev/text()} </abbrev> 
		<subtype> {$term/subtype/text()} </subtype> 
		<_type> {$term/type/text()} </_type> 
		<_oid> {$term/_oid/text()} </_oid> 
	</term> , 
	for $patient in CanonicalView("my_canonical_view.cv")/patient
	return 
	<patient> 
		<year_of_birth> {$patient/year_of_birth/text()} </year_of_birth> 
		<status> {$patient/status/text()} </status> 
		<wada_comments> {$patient/wada_comments/text()} </wada_comments> 
		<wada_memory> {$patient/wada_memory/text()} </wada_memory> 
		<wada_language> {$patient/wada_language/text()} </wada_language> 
		<handedness> {$patient/handedness/text()} </handedness> 
		<sex> {$patient/sex/text()} </sex> 
		<type> {$patient/type/text()} </type> 
		<gao_research_num> {$patient/gao_research_num/text()} </gao_research_num> 
		<description> {$patient/description/text()} </description> 
		<pre> {$patient/pre/text()} </pre> 
		<copy> {$patient/copy/text()} </copy> 
		<size> {$patient/size/text()} </size> 
		<is_public> {$patient/public/text()} </is_public> 
		<pnum> {$patient/pnum/text()} </pnum> 
		<viq> {$patient/viq/text()} </viq> 
		<age_at_registration> {$patient/age_at_registration/text()} </age_at_registration> 
		<location> {$patient/location/text()} </location> 
		<_oid> {$patient/_oid/text()} </_oid> {
		for $imagingstudy in CanonicalView("my_canonical_view.cv")/imagingstudy
		where $patient/_oid/text()= $imagingstudy/patient/text()
		return 
		<imagingstudy> 
			<imaging_study_year> {$imagingstudy/imaging_study_year/text()} </imaging_study_year> 
			<billed> {$imagingstudy/billed/text()} </billed> 
			<description> {$imagingstudy/description/text()} </description> 
			<acquisition_location> {$imagingstudy/acquisition_location/text()} </acquisition_location> 
			<aligned_pathname> {$imagingstudy/aligned_pathname/text()} </aligned_pathname> 
			<lowres_surface_filename> {$imagingstudy/lowres_surface_filename/text()} </lowres_surface_filename> 
			<lowres_surface_pathname> {$imagingstudy/lowres_surface_pathname/text()} </lowres_surface_pathname> 
			<computed_coords_filename> {$imagingstudy/computed_coords_filename/text()} </computed_coords_filename> 
			<computed_coords_pathname> {$imagingstudy/computed_coords_pathname/text()} </computed_coords_pathname> 
			<computed_image_filename> {$imagingstudy/computed_image_filename/text()} </computed_image_filename> 
			<computed_image_pathname> {$imagingstudy/computed_image_pathname/text()} </computed_image_pathname> 
			<suffix> {$imagingstudy/suffix/text()} </suffix> 
			<subject> {$imagingstudy/subject/text()} </subject> 
			<prefix> {$imagingstudy/prefix/text()} </prefix> 
			<patient> {$imagingstudy/patient/text()} </patient> 
			<_oid> {$imagingstudy/_oid/text()} </_oid> {
			for $mrexam in CanonicalView("my_canonical_view.cv")/mrexam
			where $imagingstudy/_oid/text()= $mrexam/imaging_study/text()
			return 
			<mrexam> 
				<location> {$mrexam/location/text()} </location> 
				<import_info> {$mrexam/import_info/text()} </import_info> 
				<description> {$mrexam/description/text()} </description> 
				<exam_num> {$mrexam/exam_num/text()} </exam_num> 
				<imaging_study> {$mrexam/imaging_study/text()} </imaging_study> 
				<_oid> {$mrexam/_oid/text()} </_oid> {
				for $mrseries in CanonicalView("my_canonical_view.cv")/mrseries
				where $mrexam/_oid/text()= $mrseries/mrexam/text()
				return 
				<mrseries> 
					<spacing> {$mrseries/spacing/text()} </spacing> 
					<thickness> {$mrseries/thickness/text()} </thickness> 
					<label> {$mrseries/label/text()} </label> 
					<last> {$mrseries/last/text()} </last> 
					<first> {$mrseries/first/text()} </first> 
					<tissue> {$mrseries/tissue/text()} </tissue> 
					<threshold> {$mrseries/threshold/text()} </threshold> 
					<stop_img> {$mrseries/stop_img/text()} </stop_img> 
					<start_img> {$mrseries/start_img/text()} </start_img> 
					<optical_disk> {$mrseries/optical_disk/text()} </optical_disk> 
					<bits_per_pixel> {$mrseries/bits_per_pixel/text()} </bits_per_pixel> 
					<bytes_per_pixel> {$mrseries/bytes_per_pixel/text()} </bytes_per_pixel> 
					<width> {$mrseries/width/text()} </width> 
					<height> {$mrseries/height/text()} </height> 
					<fov_y> {$mrseries/fov_y/text()} </fov_y> 
					<fov_x> {$mrseries/fov_x/text()} </fov_x> 
					<description> {$mrseries/description/text()} </description> 
					<type> {$mrseries/type/text()} </type> 
					<psd> {$mrseries/psd/text()} </psd> 
					<scan_end> {$mrseries/scan_end/text()} </scan_end> 
					<scan_start> {$mrseries/scan_start/text()} </scan_start> 
					<plane> {$mrseries/plane/text()} </plane> 
					<total_images> {$mrseries/total_images/text()} </total_images> 
					<showing> {$mrseries/showing/text()} </showing> 
					<location> {$mrseries/location/text()} </location> 
					<mrexam> {$mrseries/mrexam/text()} </mrexam> 
					<_oid> {$mrseries/_oid/text()} </_oid> {
					for $mrslice in CanonicalView("my_canonical_view.cv")/mrslice
					where $mrseries/_oid/text()= $mrslice/mrseries/text()
					return 
					<mrslice> 
						<mrseries> {$mrslice/mrseries/text()} </mrseries> 
						<image_file> {$mrslice/image_file/text()} </image_file> 
						<sequence_num> {$mrslice/sequence_num/text()} </sequence_num> 
						<_oid> {$mrslice/_oid/text()} </_oid> 
					</mrslice> , 
					for $alignedvolume in CanonicalView("my_canonical_view.cv")/alignedvolume
					where $mrseries/_oid/text()= $alignedvolume/series/text()
					return 
					<alignedvolume> 
						<patient> {$alignedvolume/patient/text()} </patient> 
						<tissue> {$alignedvolume/tissue/text()} </tissue> 
						<filename> {$alignedvolume/filename/text()} </filename> 
						<volume_file> {$alignedvolume/volume_file/text()} </volume_file> 
						<format> {$alignedvolume/format/text()} </format> 
						<series> {$alignedvolume/series/text()} </series> 
						<_oid> {$alignedvolume/_oid/text()} </_oid> {
						for $surfacemodel in CanonicalView("my_canonical_view.cv")/surfacemodel
						where $alignedvolume/_oid/text()= $surfacemodel/volume/text()
						return 
						<surfacemodel> 
							<preference> {$surfacemodel/preference/text()} </preference> 
							<model_filename> {$surfacemodel/model_filename/text()} </model_filename> 
							<model_pathname> {$surfacemodel/model_pathname/text()} </model_pathname> 
							<model_file> {$surfacemodel/model_file/text()} </model_file> 
							<format> {$surfacemodel/format/text()} </format> 
							<model_instance> {$surfacemodel/model_instance/text()} </model_instance> 
							<volume> {$surfacemodel/volume/text()} </volume> 
							<_oid> {$surfacemodel/_oid/text()} </_oid> {
							for $radialslicemodelinstance in CanonicalView("my_canonical_view.cv")/radialslicemodelinstance
							where $surfacemodel/model_instance/text()= $radialslicemodelinstance/_oid/text()
							return 
							<radialslicemodelinstance> 
								<derived_from> {$radialslicemodelinstance/derived_from/text()} </derived_from> 
								<landmarks_filename> {$radialslicemodelinstance/landmarks_filename/text()} </landmarks_filename> 
								<landmarks_pathname> {$radialslicemodelinstance/landmarks_pathname/text()} </landmarks_pathname> 
								<preference> {$radialslicemodelinstance/preference/text()} </preference> 
								<instance_filename> {$radialslicemodelinstance/instance_filename/text()} </instance_filename> 
								<instance_pathname> {$radialslicemodelinstance/instance_pathname/text()} </instance_pathname> 
								<expansion_factor> {$radialslicemodelinstance/expansion_factor/text()} </expansion_factor> 
								<instance_file> {$radialslicemodelinstance/instance_file/text()} </instance_file> 
								<landmarks_file> {$radialslicemodelinstance/landmarks_file/text()} </landmarks_file> 
								<model> {$radialslicemodelinstance/model/text()} </model> 
								<volume> {$radialslicemodelinstance/volume/text()} </volume> 
								<_oid> {$radialslicemodelinstance/_oid/text()} </_oid> {
								for $radialslicemodel in CanonicalView("my_canonical_view.cv")/radialslicemodel
								where $radialslicemodelinstance/model/text()= $radialslicemodel/_oid/text()
								return 
								<radialslicemodel> 
									<preference> {$radialslicemodel/preference/text()} </preference> 
									<model_file> {$radialslicemodel/model_file/text()} </model_file> 
									<training_set> {$radialslicemodel/training_set/text()} </training_set> 
									<slices> {$radialslicemodel/slices/text()} </slices> 
									<theta_radials> {$radialslicemodel/theta_radials/text()} </theta_radials> 
									<comment> {$radialslicemodel/comment/text()} </comment> 
									<filename> {$radialslicemodel/filename/text()} </filename> 
									<pathname> {$radialslicemodel/pathname/text()} </pathname> 
									<_oid> {$radialslicemodel/_oid/text()} </_oid> 
								</radialslicemodel> 
								}
							</radialslicemodelinstance> 
							}
						</surfacemodel> , 
						for $radialslicemodelinstance in CanonicalView("my_canonical_view.cv")/radialslicemodelinstance
						where $alignedvolume/_oid/text()= $radialslicemodelinstance/volume/text()
						return 
						<radialslicemodelinstance> 
							<derived_from> {$radialslicemodelinstance/derived_from/text()} </derived_from> 
							<landmarks_filename> {$radialslicemodelinstance/landmarks_filename/text()} </landmarks_filename> 
							<landmarks_pathname> {$radialslicemodelinstance/landmarks_pathname/text()} </landmarks_pathname> 
							<preference> {$radialslicemodelinstance/preference/text()} </preference> 
							<instance_filename> {$radialslicemodelinstance/instance_filename/text()} </instance_filename> 
							<instance_pathname> {$radialslicemodelinstance/instance_pathname/text()} </instance_pathname> 
							<expansion_factor> {$radialslicemodelinstance/expansion_factor/text()} </expansion_factor> 
							<instance_file> {$radialslicemodelinstance/instance_file/text()} </instance_file> 
							<landmarks_file> {$radialslicemodelinstance/landmarks_file/text()} </landmarks_file> 
							<model> {$radialslicemodelinstance/model/text()} </model> 
							<volume> {$radialslicemodelinstance/volume/text()} </volume> 
							<_oid> {$radialslicemodelinstance/_oid/text()} </_oid> {
							for $radialslicemodel in CanonicalView("my_canonical_view.cv")/radialslicemodel
							where $radialslicemodelinstance/model/text()= $radialslicemodel/_oid/text()
							return 
							<radialslicemodel> 
								<preference> {$radialslicemodel/preference/text()} </preference> 
								<model_file> {$radialslicemodel/model_file/text()} </model_file> 
								<training_set> {$radialslicemodel/training_set/text()} </training_set> 
								<slices> {$radialslicemodel/slices/text()} </slices> 
								<theta_radials> {$radialslicemodel/theta_radials/text()} </theta_radials> 
								<comment> {$radialslicemodel/comment/text()} </comment> 
								<filename> {$radialslicemodel/filename/text()} </filename> 
								<pathname> {$radialslicemodel/pathname/text()} </pathname> 
								<_oid> {$radialslicemodel/_oid/text()} </_oid> 
							</radialslicemodel> 
							}
						</radialslicemodelinstance> 
						}
					</alignedvolume> 
					}
				</mrseries> 
				}
			</mrexam> , 
			for $scene in CanonicalView("my_canonical_view.cv")/scene
			where $imagingstudy/_oid/text()= $scene/imaging_study/text()
			return 
			<scene> 
				<ismapscene> {$scene/ismapscene/text()} </ismapscene> 
				<preference> {$scene/preference/text()} </preference> 
				<description_file> {$scene/description_file/text()} </description_file> 
				<description> {$scene/description/text()} </description> 
				<imaging_study> {$scene/imaging_study/text()} </imaging_study> 
				<_oid> {$scene/_oid/text()} </_oid> {
				for $rendering in CanonicalView("my_canonical_view.cv")/rendering
				where $scene/_oid/text()= $rendering/scene/text()
				return 
				<rendering> 
					<image_filename> {$rendering/image_filename/text()} </image_filename> 
					<image_pathname> {$rendering/image_pathname/text()} </image_pathname> 
					<scene> {$rendering/scene/text()} </scene> 
					<image> {$rendering/image/text()} </image> 
					<preference> {$rendering/preference/text()} </preference> 
					<rendering_type> {$rendering/rendering_type/text()} </rendering_type> 
					<_oid> {$rendering/_oid/text()} </_oid> 
				</rendering> , 
				for $scenecomponent in CanonicalView("my_canonical_view.cv")/scenecomponent
				where $scene/_oid/text()= $scenecomponent/scene/text()
				return 
				<scenecomponent> 
					<volume> {$scenecomponent/volume/text()} </volume> 
					<surface_model> {$scenecomponent/surface_model/text()} </surface_model> 
					<description> {$scenecomponent/description/text()} </description> 
					<scene> {$scenecomponent/scene/text()} </scene> 
					<_oid> {$scenecomponent/_oid/text()} </_oid> {
					for $surfacemodel in CanonicalView("my_canonical_view.cv")/surfacemodel
					where $scenecomponent/surface_model/text()= $surfacemodel/_oid/text()
					return 
					<surfacemodel> 
						<preference> {$surfacemodel/preference/text()} </preference> 
						<model_filename> {$surfacemodel/model_filename/text()} </model_filename> 
						<model_pathname> {$surfacemodel/model_pathname/text()} </model_pathname> 
						<model_file> {$surfacemodel/model_file/text()} </model_file> 
						<format> {$surfacemodel/format/text()} </format> 
						<model_instance> {$surfacemodel/model_instance/text()} </model_instance> 
						<volume> {$surfacemodel/volume/text()} </volume> 
						<_oid> {$surfacemodel/_oid/text()} </_oid> 
					</surfacemodel> 
					}
				</scenecomponent> 
				}
			</scene> 
			}
		</imagingstudy> , 
		for $surgery in CanonicalView("my_canonical_view.cv")/surgery
		where $patient/_oid/text()= $surgery/patient/text()
		return 
		<surgery> 
			<surgery_year> {$surgery/surgery_year/text()} </surgery_year> 
			<lfp> {$surgery/lfp/text()} </lfp> 
			<ecog> {$surgery/ecog/text()} </ecog> 
			<micro_electrode_comments> {$surgery/micro_electrode_comments/text()} </micro_electrode_comments> 
			<micro_electrode_sites> {$surgery/micro_electrode_sites/text()} </micro_electrode_sites> 
			<audiotape> {$surgery/audiotape/text()} </audiotape> 
			<preference> {$surgery/preference/text()} </preference> 
			<grid_strips_description> {$surgery/grid_strips_description/text()} </grid_strips_description> 
			<surgery_comments> {$surgery/surgery_comments/text()} </surgery_comments> 
			<age_at_surgery> {$surgery/age_at_surgery/text()} </age_at_surgery> 
			<side> {$surgery/side/text()} </side> 
			<grid> {$surgery/grid/text()} </grid> 
			<diagnosis> {$surgery/diagnosis/text()} </diagnosis> 
			<surgeon> {$surgery/surgeon/text()} </surgeon> 
			<patient> {$surgery/patient/text()} </patient> 
			<_oid> {$surgery/_oid/text()} </_oid> {
			for $photo in CanonicalView("my_canonical_view.cv")/photo
			where $surgery/_oid/text()= $photo/surgery/text()
			return 
			<photo> 
				<description> {$photo/description/text()} </description> 
				<surgery> {$photo/surgery/text()} </surgery> 
				<image_filename> {$photo/image_filename/text()} </image_filename> 
				<image_pathname> {$photo/image_pathname/text()} </image_pathname> 
				<image> {$photo/image/text()} </image> 
				<preference> {$photo/preference/text()} </preference> 
				<_oid> {$photo/_oid/text()} </_oid> 
			</photo> , 
			for $sitetoanatomymap in CanonicalView("my_canonical_view.cv")/sitetoanatomymap
			where $surgery/_oid/text()= $sitetoanatomymap/surgery/text()
			return 
			<sitetoanatomymap> 
				<surgery> {$sitetoanatomymap/surgery/text()} </surgery> 
				<modtime> {$sitetoanatomymap/modtime/text()} </modtime> 
				<preference> {$sitetoanatomymap/preference/text()} </preference> 
				<sitetoanatomy_filename> {$sitetoanatomymap/sitetoanatomy_filename/text()} </sitetoanatomy_filename> 
				<sitetoanatomy_pathname> {$sitetoanatomymap/sitetoanatomy_pathname/text()} </sitetoanatomy_pathname> 
				<rendered_map> {$sitetoanatomymap/rendered_map/text()} </rendered_map> 
				<sitetoanatomyfile> {$sitetoanatomymap/sitetoanatomyfile/text()} </sitetoanatomyfile> 
				<map_date> {$sitetoanatomymap/map_date/text()} </map_date> 
				<author> {$sitetoanatomymap/author/text()} </author> 
				<scene> {$sitetoanatomymap/scene/text()} </scene> 
				<_oid> {$sitetoanatomymap/_oid/text()} </_oid> {
				for $photo in CanonicalView("my_canonical_view.cv")/photo
				where $sitetoanatomymap/photo/text()= $photo/_oid/text()
				return 
				<photo> 
					<description> {$photo/description/text()} </description> 
					<surgery> {$photo/surgery/text()} </surgery> 
					<image_filename> {$photo/image_filename/text()} </image_filename> 
					<image_pathname> {$photo/image_pathname/text()} </image_pathname> 
					<image> {$photo/image/text()} </image> 
					<preference> {$photo/preference/text()} </preference> 
					<_oid> {$photo/_oid/text()} </_oid> 
				</photo> , 
				for $scene in CanonicalView("my_canonical_view.cv")/scene
				where $sitetoanatomymap/scene/text()= $scene/_oid/text()
				return 
				<scene> 
					<ismapscene> {$scene/ismapscene/text()} </ismapscene> 
					<preference> {$scene/preference/text()} </preference> 
					<description_file> {$scene/description_file/text()} </description_file> 
					<description> {$scene/description/text()} </description> 
					<imaging_study> {$scene/imaging_study/text()} </imaging_study> 
					<_oid> {$scene/_oid/text()} </_oid> {
					for $rendering in CanonicalView("my_canonical_view.cv")/rendering
					where $scene/_oid/text()= $rendering/scene/text()
					return 
					<rendering> 
						<image_filename> {$rendering/image_filename/text()} </image_filename> 
						<image_pathname> {$rendering/image_pathname/text()} </image_pathname> 
						<scene> {$rendering/scene/text()} </scene> 
						<image> {$rendering/image/text()} </image> 
						<preference> {$rendering/preference/text()} </preference> 
						<rendering_type> {$rendering/rendering_type/text()} </rendering_type> 
						<_oid> {$rendering/_oid/text()} </_oid> 
					</rendering> , 
					for $scenecomponent in CanonicalView("my_canonical_view.cv")/scenecomponent
					where $scene/_oid/text()= $scenecomponent/scene/text()
					return 
					<scenecomponent> 
						<volume> {$scenecomponent/volume/text()} </volume> 
						<surface_model> {$scenecomponent/surface_model/text()} </surface_model> 
						<description> {$scenecomponent/description/text()} </description> 
						<scene> {$scenecomponent/scene/text()} </scene> 
						<_oid> {$scenecomponent/_oid/text()} </_oid> {
						for $surfacemodel in CanonicalView("my_canonical_view.cv")/surfacemodel
						where $scenecomponent/surface_model/text()= $surfacemodel/_oid/text()
						return 
						<surfacemodel> 
							<preference> {$surfacemodel/preference/text()} </preference> 
							<model_filename> {$surfacemodel/model_filename/text()} </model_filename> 
							<model_pathname> {$surfacemodel/model_pathname/text()} </model_pathname> 
							<model_file> {$surfacemodel/model_file/text()} </model_file> 
							<format> {$surfacemodel/format/text()} </format> 
							<model_instance> {$surfacemodel/model_instance/text()} </model_instance> 
							<volume> {$surfacemodel/volume/text()} </volume> 
							<_oid> {$surfacemodel/_oid/text()} </_oid> 
						</surfacemodel> 
						}
					</scenecomponent> 
					}
				</scene> , 
				for $sitetoanatomymapelement in CanonicalView("my_canonical_view.cv")/sitetoanatomymapelement
				where $sitetoanatomymap/_oid/text()= $sitetoanatomymapelement/sitetoanatomymap/text()
				return 
				<sitetoanatomymapelement> 
					<confidence> {$sitetoanatomymapelement/confidence/text()} </confidence> 
					<y> {$sitetoanatomymapelement/y/text()} </y> 
					<x> {$sitetoanatomymapelement/x/text()} </x> 
					<right_coord> {$sitetoanatomymapelement/right_coord/text()} </right_coord> 
					<sup_coord> {$sitetoanatomymapelement/sup_coord/text()} </sup_coord> 
					<ant_coord> {$sitetoanatomymapelement/ant_coord/text()} </ant_coord> 
					<stimsite> {$sitetoanatomymapelement/stimsite/text()} </stimsite> 
					<sitetoanatomymap> {$sitetoanatomymapelement/sitetoanatomymap/text()} </sitetoanatomymap> 
					<_oid> {$sitetoanatomymapelement/_oid/text()} </_oid> {
					for $stimsite in CanonicalView("my_canonical_view.cv")/stimsite
					where $sitetoanatomymapelement/stimsite/text()= $stimsite/_oid/text()
					return 
					<stimsite> 
						<type> {$stimsite/type/text()} </type> 
						<surgery> {$stimsite/surgery/text()} </surgery> 
						<lobe> {$stimsite/lobe/text()} </lobe> 
						<zone> {$stimsite/zone/text()} </zone> 
						<site_label> {$stimsite/site_label/text()} </site_label> 
						<_oid> {$stimsite/_oid/text()} </_oid> 
					</stimsite> 
					}
				</sitetoanatomymapelement> 
				}
			</sitetoanatomymap> , 
			for $csmstudy in CanonicalView("my_canonical_view.cv")/csmstudy
			where $surgery/_oid/text()= $csmstudy/surgery/text()
			return 
			<csmstudy> 
				<updated_by> {$csmstudy/updated_by/text()} </updated_by> 
				<updated> {$csmstudy/updated/text()} </updated> 
				<type> {$csmstudy/type/text()} </type> 
				<other_function> {$csmstudy/other_function/text()} </other_function> 
				<function> {$csmstudy/function/text()} </function> 
				<site_data> {$csmstudy/site_data/text()} </site_data> 
				<trial_data> {$csmstudy/trial_data/text()} </trial_data> 
				<surgery> {$csmstudy/surgery/text()} </surgery> 
				<_oid> {$csmstudy/_oid/text()} </_oid> {
				for $trial in CanonicalView("my_canonical_view.cv")/trial
				where $csmstudy/_oid/text()= $trial/csmstudy/text()
				return 
				<trial> 
					<stimulated> {$trial/stimulated/text()} </stimulated> 
					<coder_confidence> {$trial/coder_confidence/text()} </coder_confidence> 
					<patient_response> {$trial/patient_response/text()} </patient_response> 
					<surgeon_comments> {$trial/surgeon_comments/text()} </surgeon_comments> 
					<coder_comments> {$trial/coder_comments/text()} </coder_comments> 
					<different_target> {$trial/different_target/text()} </different_target> 
					<target> {$trial/target/text()} </target> 
					<item> {$trial/item/text()} </item> 
					<csmstudy> {$trial/csmstudy/text()} </csmstudy> 
					<site_suffix> {$trial/site_suffix/text()} </site_suffix> 
					<km_score> {$trial/km_score/text()} </km_score> 
					<comments> {$trial/comments/text()} </comments> 
					<miriam_code> {$trial/miriam_code/text()} </miriam_code> 
					<eeg_score> {$trial/eeg_score/text()} </eeg_score> 
					<current> {$trial/current/text()} </current> 
					<trial_time> {$trial/trial_time/text()} </trial_time> 
					<trial_num> {$trial/trial_num/text()} </trial_num> 
					<_oid> {$trial/_oid/text()} </_oid> {
					for $stimsite1 in CanonicalView("my_canonical_view.cv")/stimsite
					where $trial/stimsite1/text()= $stimsite1/_oid/text()
					return 
					<stimsite1> 
						<type> {$stimsite1/type/text()} </type> 
						<surgery> {$stimsite1/surgery/text()} </surgery> 
						<lobe> {$stimsite1/lobe/text()} </lobe> 
						<zone> {$stimsite1/zone/text()} </zone> 
						<site_label> {$stimsite1/site_label/text()} </site_label> 
						<_oid> {$stimsite1/_oid/text()} </_oid> 
					</stimsite1> , 
					for $stimsite2 in CanonicalView("my_canonical_view.cv")/stimsite
					where $trial/stimsite2/text()= $stimsite2/_oid/text()
					return 
					<stimsite2> 
						<type> {$stimsite2/type/text()} </type> 
						<surgery> {$stimsite2/surgery/text()} </surgery> 
						<lobe> {$stimsite2/lobe/text()} </lobe> 
						<zone> {$stimsite2/zone/text()} </zone> 
						<site_label> {$stimsite2/site_label/text()} </site_label> 
						<_oid> {$stimsite2/_oid/text()} </_oid> 
					</stimsite2> , 
					for $trialcode in CanonicalView("my_canonical_view.cv")/trialcode
					where $trial/_oid/text()= $trialcode/trial/text()
					return 
					<trialcode> 
						<code> {$trialcode/code/text()} </code> 
						<trial> {$trialcode/trial/text()} </trial> 
						<_oid> {$trialcode/_oid/text()} </_oid> {
						for $term in CanonicalView("my_canonical_view.cv")/term
						where $trialcode/code/text()= $term/_oid/text()
						return 
						<term> 
							<parent> {$term/parent/text()} </parent> 
							<sequence> {$term/sequence/text()} </sequence> 
							<authority> {$term/authority/text()} </authority> 
							<comment> {$term/comment/text()} </comment> 
							<fullname> {$term/fullname/text()} </fullname> 
							<abbrev> {$term/abbrev/text()} </abbrev> 
							<subtype> {$term/subtype/text()} </subtype> 
							<type> {$term/type/text()} </type> 
							<_oid> {$term/_oid/text()} </_oid> 
						</term> 
						}
					</trialcode> 
					}
				</trial> 
				}
			</csmstudy> , 
			for $anatomytonamemap in CanonicalView("my_canonical_view.cv")/anatomytonamemap
			where $surgery/_oid/text()= $anatomytonamemap/surgery/text()
			return 
			<anatomytonamemap> 
				<description> {$anatomytonamemap/description/text()} </description> 
				<preference> {$anatomytonamemap/preference/text()} </preference> 
				<site_to_anatomy_map> {$anatomytonamemap/site_to_anatomy_map/text()} </site_to_anatomy_map> 
				<photo> {$anatomytonamemap/photo/text()} </photo> 
				<updated> {$anatomytonamemap/updated/text()} </updated> 
				<updated_by> {$anatomytonamemap/updated_by/text()} </updated_by> 
				<parcellation> {$anatomytonamemap/parcellation/text()} </parcellation> 
				<other_source> {$anatomytonamemap/other_source/text()} </other_source> 
				<surgery> {$anatomytonamemap/surgery/text()} </surgery> 
				<_oid> {$anatomytonamemap/_oid/text()} </_oid> {
				for $anatomytonamemapelement in CanonicalView("my_canonical_view.cv")/anatomytonamemapelement
				where $anatomytonamemap/_oid/text()= $anatomytonamemapelement/anatomy_to_name_map/text()
				return 
				<anatomytonamemapelement> 
					<belief> {$anatomytonamemapelement/belief/text()} </belief> 
					<name> {$anatomytonamemapelement/name/text()} </name> 
					<stimulation_site> {$anatomytonamemapelement/stimulation_site/text()} </stimulation_site> 
					<anatomy_to_name_map> {$anatomytonamemapelement/anatomy_to_name_map/text()} </anatomy_to_name_map> 
					<_oid> {$anatomytonamemapelement/_oid/text()} </_oid> {
					for $term in CanonicalView("my_canonical_view.cv")/term
					where $anatomytonamemapelement/name/text()= $term/_oid/text()
					return 
					<term> 
						<parent> {$term/parent/text()} </parent> 
						<sequence> {$term/sequence/text()} </sequence> 
						<authority> {$term/authority/text()} </authority> 
						<comment> {$term/comment/text()} </comment> 
						<fullname> {$term/fullname/text()} </fullname> 
						<abbrev> {$term/abbrev/text()} </abbrev> 
						<subtype> {$term/subtype/text()} </subtype> 
						<type> {$term/type/text()} </type> 
						<_oid> {$term/_oid/text()} </_oid> 
					</term> , 
					for $stimsite in CanonicalView("my_canonical_view.cv")/stimsite
					where $anatomytonamemapelement/stimulation_site/text()= $stimsite/_oid/text()
					return 
					<stimsite> 
						<type> {$stimsite/type/text()} </type> 
						<surgery> {$stimsite/surgery/text()} </surgery> 
						<lobe> {$stimsite/lobe/text()} </lobe> 
						<zone> {$stimsite/zone/text()} </zone> 
						<site_label> {$stimsite/site_label/text()} </site_label> 
						<_oid> {$stimsite/_oid/text()} </_oid> 
					</stimsite> 
					}
				</anatomytonamemapelement> 
				}
			</anatomytonamemap> , 
			for $stimsite in CanonicalView("my_canonical_view.cv")/stimsite
			where $surgery/_oid/text()= $stimsite/surgery/text()
			return 
			<stimsite> 
				<type> {$stimsite/type/text()} </type> 
				<surgery> {$stimsite/surgery/text()} </surgery> 
				<lobe> {$stimsite/lobe/text()} </lobe> 
				<zone> {$stimsite/zone/text()} </zone> 
				<site_label> {$stimsite/site_label/text()} </site_label> 
				<_oid> {$stimsite/_oid/text()} </_oid> {
				for $anatomytonamemap in CanonicalView("my_canonical_view.cv")/anatomytonamemap
				where $surgery/_oid/text()= $anatomytonamemap[ parcellation= 'Martin'] /surgery/text()
				return 
				<anatomytonamemap> 
					<_oid> {$anatomytonamemap/_oid/text()} </_oid> {
					for $anatomytonamemapelement in CanonicalView("my_canonical_view.cv")/anatomytonamemapelement
					where $anatomytonamemap/_oid/text()= $anatomytonamemapelement/anatomy_to_name_map/text()and $anatomytonamemapelement/stimulation_site/text()= $stimsite/_oid/text()
					return 
					<anatomytonamemapelement> 
						<name> {$anatomytonamemapelement/name/text()} </name> 
						<stimulation_site> {$anatomytonamemapelement/stimulation_site/text()} </stimulation_site> 
						<_oid> {$anatomytonamemapelement/_oid/text()} </_oid> {
						for $term in CanonicalView("my_canonical_view.cv")/term
						where $anatomytonamemapelement/name/text()= $term/_oid/text()
						return 
						<term> 
							<parent> {$term/parent/text()} </parent> 
							<sequence> {$term/sequence/text()} </sequence> 
							<authority> {$term/authority/text()} </authority> 
							<comment> {$term/comment/text()} </comment> 
							<fullname> {$term/fullname/text()} </fullname> 
							<abbrev> {$term/abbrev/text()} </abbrev> 
							<subtype> {$term/subtype/text()} </subtype> 
							<type> {$term/type/text()} </type> 
							<_oid> {$term/_oid/text()} </_oid> 
						</term> 
						}
					</anatomytonamemapelement> 
					}
				</anatomytonamemap> , 
				for $csmstudy in CanonicalView("my_canonical_view.cv")/csmstudy
				where $csmstudy/surgery/text()= $surgery/_oid/text()
				return 
				<csmstudy> 
					<updated_by> {$csmstudy/updated_by/text()} </updated_by> 
					<updated> {$csmstudy/updated/text()} </updated> 
					<type> {$csmstudy/type/text()} </type> 
					<other_function> {$csmstudy/other_function/text()} </other_function> 
					<function> {$csmstudy/function/text()} </function> 
					<site_data> {$csmstudy/site_data/text()} </site_data> 
					<trial_data> {$csmstudy/trial_data/text()} </trial_data> 
					<surgery> {$csmstudy/surgery/text()} </surgery> 
					<_oid> {$csmstudy/_oid/text()} </_oid> {
					for $trial in CanonicalView("my_canonical_view.cv")/trial
					where $trial/csmstudy/text()= $csmstudy/_oid/text()and $trial/stimsite1/text()= $stimsite/_oid/text()
					return 
					<trial> 
						<stimulated> {$trial/stimulated/text()} </stimulated> 
						<stimsite2> {$trial/stimsite2/text()} </stimsite2> 
						<stimsite1> {$trial/stimsite1/text()} </stimsite1> 
						<coder_confidence> {$trial/coder_confidence/text()} </coder_confidence> 
						<patient_response> {$trial/patient_response/text()} </patient_response> 
						<surgeon_comments> {$trial/surgeon_comments/text()} </surgeon_comments> 
						<coder_comments> {$trial/coder_comments/text()} </coder_comments> 
						<different_target> {$trial/different_target/text()} </different_target> 
						<target> {$trial/target/text()} </target> 
						<item> {$trial/item/text()} </item> 
						<csmstudy> {$trial/csmstudy/text()} </csmstudy> 
						<site_suffix> {$trial/site_suffix/text()} </site_suffix> 
						<km_score> {$trial/km_score/text()} </km_score> 
						<comments> {$trial/comments/text()} </comments> 
						<miriam_code> {$trial/miriam_code/text()} </miriam_code> 
						<eeg_score> {$trial/eeg_score/text()} </eeg_score> 
						<current> {$trial/current/text()} </current> 
						<trial_time> {$trial/trial_time/text()} </trial_time> 
						<site_label> {$trial/site_label/text()} </site_label> 
						<trial_num> {$trial/trial_num/text()} </trial_num> 
						<_oid> {$trial/_oid/text()} </_oid> {
						for $trialcode in CanonicalView("my_canonical_view.cv")/trialcode
						where $trial/_oid/text()= $trialcode/trial/text()
						return 
						<trialcode> 
							<code> {$trialcode/code/text()} </code> 
							<trial> {$trialcode/trial/text()} </trial> 
							<_oid> {$trialcode/_oid/text()} </_oid> {
							for $term in CanonicalView("my_canonical_view.cv")/term
							where $trialcode/code/text()= $term/_oid/text()
							return 
							<term> 
								<parent> {$term/parent/text()} </parent> 
								<sequence> {$term/sequence/text()} </sequence> 
								<authority> {$term/authority/text()} </authority> 
								<comment> {$term/comment/text()} </comment> 
								<fullname> {$term/fullname/text()} </fullname> 
								<abbrev> {$term/abbrev/text()} </abbrev> 
								<subtype> {$term/subtype/text()} </subtype> 
								<type> {$term/type/text()} </type> 
								<_oid> {$term/_oid/text()} </_oid> 
							</term> 
							}
						</trialcode> 
						}
					</trial> 
					}
				</csmstudy> , 
				for $sitetoanatomymap in CanonicalView("my_canonical_view.cv")/sitetoanatomymap
				where $sitetoanatomymap[ preference= 1 ] /surgery/text()= $surgery/_oid/text()
				return 
				<sitetoanatomymap> 
					<surgery> {$sitetoanatomymap/surgery/text()} </surgery> 
					<modtime> {$sitetoanatomymap/modtime/text()} </modtime> 
					<preference> {$sitetoanatomymap/preference/text()} </preference> 
					<sitetoanatomy_filename> {$sitetoanatomymap/sitetoanatomy_filename/text()} </sitetoanatomy_filename> 
					<sitetoanatomy_pathname> {$sitetoanatomymap/sitetoanatomy_pathname/text()} </sitetoanatomy_pathname> 
					<rendered_map> {$sitetoanatomymap/rendered_map/text()} </rendered_map> 
					<sitetoanatomyfile> {$sitetoanatomymap/sitetoanatomyfile/text()} </sitetoanatomyfile> 
					<map_date> {$sitetoanatomymap/map_date/text()} </map_date> 
					<author> {$sitetoanatomymap/author/text()} </author> 
					<scene> {$sitetoanatomymap/scene/text()} </scene> 
					<photo> {$sitetoanatomymap/photo/text()} </photo> 
					<_oid> {$sitetoanatomymap/_oid/text()} </_oid> {
					for $sitetoanatomymapelement in CanonicalView("my_canonical_view.cv")/sitetoanatomymapelement
					where $sitetoanatomymapelement/sitetoanatomymap/text()= $sitetoanatomymap/_oid/text()and $sitetoanatomymapelement/stimsite/text()= $stimsite/_oid/text()
					return 
					<sitetoanatomymapelement> 
						<confidence> {$sitetoanatomymapelement/confidence/text()} </confidence> 
						<y> {$sitetoanatomymapelement/y/text()} </y> 
						<x> {$sitetoanatomymapelement/x/text()} </x> 
						<right_coord> {$sitetoanatomymapelement/right_coord/text()} </right_coord> 
						<sup_coord> {$sitetoanatomymapelement/sup_coord/text()} </sup_coord> 
						<ant_coord> {$sitetoanatomymapelement/ant_coord/text()} </ant_coord> 
						<site_label> {$sitetoanatomymapelement/site_label/text()} </site_label> 
						<stimsite> {$sitetoanatomymapelement/stimsite/text()} </stimsite> 
						<sitetoanatomymap> {$sitetoanatomymapelement/sitetoanatomymap/text()} </sitetoanatomymap> 
						<_oid> {$sitetoanatomymapelement/_oid/text()} </_oid> 
					</sitetoanatomymapelement> 
					}
				</sitetoanatomymap> 
				}
			</stimsite> 
			}
		</surgery> 
		}
	</patient> 
	}
</root>