⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elementdeclarationcontext.java

📁 normkit is a set of tools supporting ontology learning. from xml,xsd to rdfs.
💻 JAVA
字号:
package it.itc.ectrl.normkit.cnorm.XSModel;

import oracle.xml.parser.schema.*;

import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;

import it.itc.ectrl.normkit.cnorm.impl.C_NormalisationImpl;
import it.itc.ectrl.normkit.cnorm.heuristics.*;

import it.itc.ectrl.normkit.common.*;

/**
 * Class representing the context of an element declaration component within a XML Schema to the Normalisation process. The context represents elements type and scope of the declaration (global or local).
 * @author Oliver Fodor (fodor@itc.it)
 */
public class ElementDeclarationContext extends XSDComponent {

    ElementDeclaration m_elementDeclaration;

    /**
     * Creates an instance of this class and associates it with given C-Normalisation process and an ElementDeclaration).
     */
    public ElementDeclarationContext(ElementDeclaration elementDeclaration, C_NormalisationImpl c_norm) throws Exception {

        super (c_norm);

        m_elementDeclaration = elementDeclaration;

        //initialize();
    }

    protected void initialize() throws Exception {   // this can be set up by reading some definition file

        ElementType2PropertyRange myHeuristic = new ElementType2PropertyRange(this, m_c_norm);
        associateNormalisationHeuristic((NormalisationHeuristic) myHeuristic);

    }


    public void process() throws Exception {

        processElementsType();

        runNormalisationHeuristics();
    }

    public void processElementsType() throws Exception {

        XSDNode elmType = m_elementDeclaration.getType();

        int typeHashCode = TransformationUtil.getHashCode(elmType);

        if (!m_c_norm.isAllreadyNormalized(typeHashCode)) {

            if (elmType.getClass().getName().equals("oracle.xml.parser.schema.XSDComplexType")) {

                ComplexTypeDefinition ct = new ComplexTypeDefinition((XSDComplexType)elmType, m_c_norm, m_elementDeclaration.getNode());

                ct.runNormalisationHeuristics();

                ct.processNestedElements();

                ct.processNestedAttributes();

            } else {

                SimpleType2Class st2cHeuristic = new SimpleType2Class((XSDSimpleType)elmType, m_c_norm );

                st2cHeuristic.runConceptExtraction();
            }
        }

    }

    public int getHashCode() {

        return m_elementDeclaration.getHashCode();
    }

    public int getHashCodeOfElementsType() {

        return TransformationUtil.getHashCode(m_elementDeclaration.getType());
    }

    public String getName() {

        return m_elementDeclaration.getName();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -