/*
 *  DDL script for Oracle 8.x and Oracle 9.x
 *
 *  Copyright (c) 1998-2002, The University of Sheffield.
 *
 *  This file is part of GATE (see http://gate.ac.uk/), and is free
 *  software, licenced under the GNU Library General Public License,
 *  Version 2, June 1991 (in the distribution as file licence.html,
 *  and also available at http://gate.ac.uk/gate/licence.html).
 *
 *  Marin Dimitrov, 19/Sep/2001
 *
 *  auto generated: Wed Jan 23 16:13:59 2002
 *
 *  $Id: createView.sql,v 1.1 2002/02/28 16:39:31 marin Exp $
 *
 */

DROP VIEW V_DOCUMENT;

CREATE OR REPLACE VIEW V_DOCUMENT AS
       SELECT T_DOCUMENT.DOC_CONTENT_ID, T_DOCUMENT.DOC_LR_ID, T_DOCUMENT.DOC_ID, T_DOCUMENT.DOC_URL, T_DOCUMENT.DOC_START, T_DOCUMENT.DOC_END, T_DOCUMENT.DOC_IS_MARKUP_AWARE, T_LANG_RESOURCE.LR_ID, T_LANG_RESOURCE.LR_NAME, T_LR_TYPE.LRTP_TYPE, T_LANG_RESOURCE.LR_PARENT_ID
       FROM T_DOCUMENT, T_LANG_RESOURCE, T_LR_TYPE
       WHERE doc_lr_id = lr_id
   AND lr_type_id = lrtp_id;


DROP VIEW V_ANNOTATION_FEATURES;

CREATE OR REPLACE VIEW V_ANNOTATION_FEATURES (ANN_LOCAL_ID, set_id, key, FT_VALUE_TYPE, FT_NUMBER_VALUE, FT_CHARACTER_VALUE, FT_LONG_CHARACTER_VALUE, FT_BINARY_VALUE)  AS
       SELECT T_ANNOTATION.ANN_LOCAL_ID, T_AS_ANNOTATION.ASANN_AS_ID, T_FEATURE_KEY.FK_STRING, T_FEATURE.FT_VALUE_TYPE, T_FEATURE.FT_NUMBER_VALUE, T_FEATURE.FT_CHARACTER_VALUE, T_FEATURE.FT_LONG_CHARACTER_VALUE, T_FEATURE.FT_BINARY_VALUE
       FROM T_AS_ANNOTATION, T_FEATURE, T_ANNOTATION, T_FEATURE_KEY
       WHERE          ft_entity_id = ann_global_id
and   ft_entity_type = 3
and  ANN_GLOBAL_ID = ASANN_ANN_ID
and  FT_KEY_ID = FK_ID;


DROP VIEW V_ANNOTATION;

CREATE OR REPLACE VIEW V_ANNOTATION (ANN_LOCAL_ID, AT_NAME, start_offset, end_offset, ASANN_AS_ID)  AS
       SELECT T_ANNOTATION.ANN_LOCAL_ID, T_ANNOTATION_TYPE.AT_NAME, s_node.NODE_OFFSET, e_node.NODE_OFFSET, T_AS_ANNOTATION.ASANN_AS_ID
       FROM T_AS_ANNOTATION, T_ANNOTATION, T_ANNOTATION_TYPE, T_NODE s_node, T_NODE e_node
       WHERE       asann_ann_id=ann_global_id
and ann_at_id=at_id
and ann_startnode_id=s_node.node_global_id
and ann_endnode_id=e_node.node_global_id;


DROP VIEW V_CONTENT;

CREATE OR REPLACE VIEW V_CONTENT AS
       SELECT T_DOC_CONTENT.DC_CHARACTER_CONTENT, T_DOC_CONTENT.DC_BINARY_CONTENT, T_DOC_CONTENT.DC_CONTENT_TYPE, T_DOC_ENCODING.ENC_NAME, T_DOC_CONTENT.DC_ID, V_DOCUMENT.DOC_ID, V_DOCUMENT.LR_ID
       FROM T_DOC_CONTENT, T_DOC_ENCODING, V_DOCUMENT
       WHERE enc_id = dc_encoding_id
AND doc_content_id = dc_id;


DROP VIEW V_LR;

CREATE OR REPLACE VIEW V_LR AS
       SELECT T_LR_TYPE.LRTP_TYPE, T_LANG_RESOURCE.LR_ID, T_LANG_RESOURCE.LR_OWNER_USER_ID, T_LANG_RESOURCE.LR_OWNER_GROUP_ID, T_LANG_RESOURCE.LR_LOCKING_USER_ID, T_LANG_RESOURCE.LR_NAME, T_LANG_RESOURCE.LR_ACCESS_MODE, T_LANG_RESOURCE.LR_PARENT_ID
       FROM T_LR_TYPE, T_LANG_RESOURCE
       WHERE lr_type_id = lrtp_id;


DROP VIEW V_ANNOTATION_SET;

CREATE OR REPLACE VIEW V_ANNOTATION_SET AS
       SELECT T_ANNOT_SET.AS_DOC_ID, T_ANNOT_SET.AS_ID, V_DOCUMENT.LR_ID, T_ANNOT_SET.AS_NAME
       FROM T_ANNOT_SET, V_DOCUMENT
       WHERE as_doc_id = doc_id;







