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

📄 cnoentity.java

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

/* Generated by Together */
import java.util.*;
import java.net.*;

import edu.unika.aifb.kaon.api.KAONException;
import edu.unika.aifb.kaon.api.oimodel.*;
import edu.unika.aifb.rdf.api.model.*;
import edu.unika.aifb.kaon.api.vocabulary.KAONVocabularyAdaptor;
import edu.unika.aifb.kaon.api.change.*;

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

/**
 * Parent class of all classes representing copncepts of the Conceptual Normalisation Ontology. <i>Under costruction.</i>
 * @author Oliver Fodor (fodor@itc.it)
 */
public class CNOEntity {

    NormMap m_normmap;
    Instance m_instance;
    String m_strName;
    String m_strComment;

    public CNOEntity() {

    }


    public CNOEntity(final NormMap normmap, Instance instance) {

        m_normmap = normmap;
        m_instance = instance;
    }

    public String getURI() {

        try {

            return m_instance.getURI();

        } catch(KAONException e){

            return CNOErrors.ERROR_INVALID_OR_UNDEFINED_URI;

        }
    }


    public String toString() {  // think about throwing an exception here

        String strURI = CNOErrors.ERROR_INVALID_OR_UNDEFINED_URI;

        try {
            if( m_strName != null )
                return m_strName;

            strURI = getURI();
            URL url = new URL(strURI);

            return url.getRef();

        } catch(MalformedURLException e) {

            return strURI;
        }
    }


    public String getName() {

        return m_strName;
    }


    protected void parse() throws Exception {
        // name
        m_strName = Parsing.readEventualPropertyLiteral(m_instance,
                                                      CNOVocabulary.URI_RDFS_LABEL,
                                                        CNOErrors.ERROR_MAXIMUM_ONE_LABEL);

        // comment
        m_strComment = Parsing.readEventualPropertyLiteral(m_instance,
                                                      CNOVocabulary.URI_RDFS_COMMENT,
                                                        CNOErrors.ERROR_MAXIMUM_ONE_COMMENT);
    }


    protected void addPropertyValueToOIModel( String strURIProperty, String strURIPropertyValue ) throws NormalisationException {

        try {

//        KAONUtils.addPropertyValueToOIModel( m_normmap.m_oimodelCNOInstance,
        KAONUtils.addPropertyValueToOIInstanceModel( m_normmap.m_oimodelNormMap, m_normmap.m_oimodelCNOInstance,
                                             getURI(),
                                             strURIProperty,
                                             strURIPropertyValue );

        } catch (KAONException e) {

            throw new NormalisationException("KAON exception while adding property value to model.", e);

        }
    }

}

⌨️ 快捷键说明

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