当前位置: 首页>>代码示例>>Java>>正文


Java OWLOntology类代码示例

本文整理汇总了Java中org.semanticweb.owl.model.OWLOntology的典型用法代码示例。如果您正苦于以下问题:Java OWLOntology类的具体用法?Java OWLOntology怎么用?Java OWLOntology使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OWLOntology类属于org.semanticweb.owl.model包,在下文中一共展示了OWLOntology类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refill

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * Refills the section with rows.  This method will be called
 * by the system and should be directly called.
 */
protected void refill(OWLOntology ontology) {
    added.clear();
    for (OWLObjectPropertyAssertionAxiom ax : ontology.getObjectPropertyAssertionAxioms(getRootObject())) {
        if (ax.getProperty().equals(relatedProp)) {
            addRow(new OWLObjectPropertyAssertionAxiomFrameSectionRow(getOWLEditorKit(),
                                                                  this,
                                                                  ontology,
                                                                  getRootObject(),
                                                                  ax) {

                protected OWLFrameSectionRowObjectEditor<OWLObjectPropertyIndividualPair> getObjectEditor() {
                    return new SKOSObjectPropertyIndividualPairEditor(getOWLEditorKit(), relatedProp, panel);
                }
            });
            added.add(ax);
        }
    }
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:23,代码来源:SKOSRelatedPropertyAssertionAxiomFrameSection.java

示例2: updateSnippet

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * <p>Updates the given snippet in the active text at the given index
 * by first removing the snippet,
 * then creating a new snippet out of the set of given sentences, and then
 * adding the new snippet to the text and setting it as the selected snippet.</p>
 * 
 * @param index Index of the snippet in the ACE text
 * @param snippet Snippet to be updated (i.e replaced)
 * @param sentences Sentences that form the new snippet
 */
public static void updateSnippet(int index, ACESnippet snippet, List<ACESentence> sentences) {
	ACESnippet newSnippet = new ACESnippetImpl(snippet.getDefaultNamespace(), sentences);
	ACEText<OWLEntity, OWLLogicalAxiom> acetext = getActiveACEText();
	logger.info("Del old snippet: " + snippet);
	Set<OWLLogicalAxiom> removedAxioms = acetext.remove(snippet);
	logger.info("Add new snippet: " + newSnippet);
	acetext.add(index, newSnippet);

	OWLOntology ontology = owlModelManager.getActiveOntology();
	List<OWLAxiomChange> changes = Lists.newArrayList();
	changes.addAll(getRemoveChanges(ontology, removedAxioms));
	changes.addAll(getAddChanges(ontology, newSnippet));
	changeOntology(changes);
	setSelectedSnippet(newSnippet);
	fireEvent(EventType.ACETEXT_CHANGED);
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:27,代码来源:ACETextManager.java

示例3: findAndRemove

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
private static List<OWLAxiomChange> findAndRemove(ACESentence sentence) {
	ACEText<OWLEntity, OWLLogicalAxiom> acetext = getActiveACEText();
	OWLOntology ontology = owlModelManager.getActiveOntology();
	List<OWLAxiomChange> changes = Lists.newArrayList();

	for (ACESnippet oldSnippet : ImmutableSet.copyOf(acetext.getSentenceSnippets(sentence))) {
		Set<OWLLogicalAxiom> removedAxioms = acetext.remove(oldSnippet);
		changes.addAll(getRemoveChanges(ontology, removedAxioms));

		if (oldSnippet.getSentences().size() > 1) {
			logger.info("Found super snippet: " + oldSnippet.toString());
			List<ACESentence> sentences = oldSnippet.getRest(sentence);
			ACESnippet snippet = new ACESnippetImpl(activeACETextURI, sentences);
			acetext.add(snippet);
			changes.addAll(getAddChanges(ontology, snippet));
		}
	}
	return changes;
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:20,代码来源:ACETextManager.java

示例4: verbalizeAndAdd

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * <p>Note that we do not add the axiom into the ontology, because
 * we expect it to be there already, as it is one of the tangling
 * axioms.</p>
 * 
 * @param acetext ACE text
 * @param ont OWL ontology
 * @param axiomVerbalizer AxiomVerbalizer
 * @param axiom OWL axiom
 */
private static void verbalizeAndAdd(ACEText<OWLEntity, OWLLogicalAxiom> acetext, OWLOntology ont, AxiomVerbalizer axiomVerbalizer, OWLLogicalAxiom axiom) {
	ACESnippet snippet = null;
	try {
		snippet = axiomVerbalizer.verbalizeAxiom(ont.getURI(), axiom);
	} catch (Exception e) {
		e.printStackTrace();
	}
	if (snippet != null) {
		acetext.add(snippet);
		OWLDataFactory df = owlModelManager.getOWLDataFactory();
		OWLAxiomAnnotationAxiom annAcetext = OntologyUtils.createAxiomAnnotation(df, axiom, acetextURI, snippet.toString());
		OWLAxiomAnnotationAxiom annTimestamp = OntologyUtils.createAxiomAnnotation(df, axiom, timestampURI, snippet.getTimestamp().toString());
		List<OWLAxiomChange> changes = Lists.newArrayList();
		changes.add(new AddAxiomByACEView(ont, annAcetext));
		changes.add(new AddAxiomByACEView(ont, annTimestamp));
		changeOntology(changes);
	}
	else {
		logger.warn("AxiomVerbalizer produced a null-snippet for: " + axiom.toString());
	}
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:32,代码来源:ACETextManager.java

示例5: newOntology

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public OWLAPIOntology newOntology( Object ontology ) throws OntowrapException {
if ( ontology instanceof OWLOntology ) {
    OWLAPIOntology onto = new OWLAPIOntology();
    onto.setFormalism( formalismId );
    onto.setFormURI( formalismUri );
    onto.setOntology( (OWLOntology)ontology );
    //onto.setFile( uri );// unknown
    try {
	onto.setURI( ((OWLOntology)ontology).getLogicalURI() );
    } catch (OWLException e) {
	// Better put in the OntowrapException of loaded
	e.printStackTrace();
    }
    //cache.recordOntology( uri, onto );
    return onto;
} else {
    throw new OntowrapException( "Argument is not an OWLOntology: "+ontology );
}
   }
 
开发者ID:dozed,项目名称:align-api-project,代码行数:20,代码来源:OWLAPIOntologyFactory.java

示例6: getOntologyInfos

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public OntologyInfo getOntologyInfos(URI uri) {
		OntologyInfo oi = new OntologyInfo();
		OWLOntology ont = getLoadedOntologie(uri);

		Set<OWLOntology> importsClosure = manager.getImportsClosure(ont);
		oi.setNumClasses(ont.getReferencedClasses().size());
		oi.setNumDataProperties(ont.getReferencedDataProperties().size());
		oi.setNumObjectProperties(ont.getReferencedObjectProperties().size());
		oi.setNumIndividuals(ont.getReferencedIndividuals().size());
		oi.setURI(uri);
		
		
		DLExpressivityChecker checker = new DLExpressivityChecker(importsClosure);
//		System.out.println("Expressivity: " + checker.getDescriptionLogicName());
		oi.setExpressivity(checker.getDescriptionLogicName());

		return oi;
	}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:19,代码来源:OntologyStore.java

示例7: getConceptSchemes

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public Set<OWLIndividual> getConceptSchemes () {

        Set<OWLIndividual> inds = new HashSet<OWLIndividual>(10);

        for (OWLOntology onto  : getOWLEditorKit().getModelManager().getOntologies()) {
            Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(getOWLEditorKit().getModelManager().getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPTSCHEME.getURI()));
            for (OWLClassAssertionAxiom axiom : axioms) {
                inds.add(axiom.getIndividual());
            }

        }
        return inds;
    }
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:14,代码来源:SKOSConceptSchemeInferredHierarchyViewComponent.java

示例8: getViewComponentPlugin

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
protected ViewComponentPlugin getViewComponentPlugin() {
    return new ViewComponentPluginAdapter() {
        public String getLabel() {
            return "Individuals";
        }

        public Workspace getWorkspace() {
            return getOWLEditorKit().getWorkspace();
        }

        public ViewComponent newInstance() throws ClassNotFoundException,
                IllegalAccessException, InstantiationException {
            viewComponent = new SKOSConceptListViewComponent(){
                protected void setupActions() {
                    if (isEditable()){
                        super.setupActions();
                    }
                }

                protected Set<OWLOntology> getOntologies() {
                    if (ontologies != null){
                        return ontologies;
                    }
                    return super.getOntologies();
                }
            };
            viewComponent.setup(this);
            return viewComponent;
        }

        public Color getBackgroundColor() {
            return OWLSystemColors.getOWLIndividualColor();
        }
    };
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:36,代码来源:SKOSConceptSelectorPanel.java

示例9: getViewComponentPlugin

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
protected ViewComponentPlugin getViewComponentPlugin() {
    return new ViewComponentPluginAdapter() {
        public String getLabel() {
            return "Individuals";
        }

        public Workspace getWorkspace() {
            return getOWLEditorKit().getWorkspace();
        }

        public ViewComponent newInstance() throws ClassNotFoundException,
                IllegalAccessException, InstantiationException {
            viewComponent = new SKOSConceptSchemeListViewComponent(){
                protected void setupActions() {
                    if (isEditable()){
                        super.setupActions();
                    }
                }

                protected Set<OWLOntology> getOntologies() {
                    if (ontologies != null){
                        return ontologies;
                    }
                    return super.getOntologies();
                }
            };
            viewComponent.setup(this);
            return viewComponent;
        }

        public Color getBackgroundColor() {
            return OWLSystemColors.getOWLIndividualColor();
        }
    };
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:36,代码来源:SKOSConceptSchemeSelectorPanel.java

示例10: getConceptSchemes

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public Set<OWLIndividual> getConceptSchemes () {

        Set<OWLIndividual> inds = new HashSet();

        for (OWLOntology onto  : owlEditorKit.getModelManager().getOntologies()) {
            Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(owlEditorKit.getModelManager().getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPTSCHEME.getURI()));
            Iterator it = axioms.iterator();
            while (it.hasNext()) {
                OWLClassAssertionAxiom axiom = (OWLClassAssertionAxiom) it.next();
                inds.add(axiom.getIndividual());
            }

        }
        return inds;
    }
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:16,代码来源:SKOSEntityCreationPanel2.java

示例11: getCurrentConceptScheme

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public OWLIndividual getCurrentConceptScheme () {

        OWLOntology onto = owlEditorKit.getModelManager().getActiveOntology();
        Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(owlEditorKit.getModelManager().getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPTSCHEME.getURI()));
        Iterator it = axioms.iterator();
        OWLClassAssertionAxiom ax = (OWLClassAssertionAxiom) it.next();
        return ax.getIndividual();

    }
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:10,代码来源:SKOSEntityCreationPanel2.java

示例12: getConceptSchemes

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public static Set<OWLIndividual> getConceptSchemes (OWLEditorKit owlEditorKit) {

        Set<OWLIndividual> inds = new HashSet<OWLIndividual>();

        for (OWLOntology onto  : owlEditorKit.getModelManager().getOntologies()) {
            Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(owlEditorKit.getModelManager().getOWLDataFactory().getOWLClass(SKOSRDFVocabulary.CONCEPTSCHEME.getURI()));
            for (OWLClassAssertionAxiom clssAx : axioms) {
                inds.add(clssAx.getIndividual());
            }
        }
        return inds;
    }
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:13,代码来源:ConceptSchemeComboBox.java

示例13: refill

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * Refills the section with rows.  This method will be called
 * by the system and should be directly called.
 */
protected void refill(OWLOntology ontology) {
    added.clear();
    for (OWLObjectPropertyAssertionAxiom ax : ontology.getObjectPropertyAssertionAxioms(getRootObject())) {
        if (!propertyFiltersSet.contains(ax.getProperty().asOWLObjectProperty())) {
            addRow(new OWLObjectPropertyAssertionAxiomFrameSectionRow(getOWLEditorKit(),
                                                                      this,
                                                                      ontology,
                                                                      getRootObject(),
                                                                      ax));
            added.add(ax);
        }
    }
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:18,代码来源:SKOSOtherObjectPropertyAssertionAxiomFrameSection.java

示例14: renderingChanged

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public void renderingChanged(OWLEntity entity, OWLEntityRenderer renderer) {
	String entityRendering = renderer.render(entity);
	logger.info("Rendering for " + entity + " changed to " + entityRendering);

	OWLModelManager mm = getOWLModelManager();
	OWLOntology ont = mm.getActiveOntology();
	OWLOntologyManager ontologyManager = mm.getOWLOntologyManager();

	List<OWLAxiomChange> changeList1 = removeMorfAnnotations(ont, entity);
	List<OWLAxiomChange> changeList2 = addMorfAnnotations(mm.getOWLDataFactory(), ont, entity, entityRendering);
	changeList1.addAll(changeList2);

	OntologyUtils.changeOntology(ontologyManager, changeList1);
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:15,代码来源:ACEViewTab.java

示例15: addMorfAnnotations

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
private static List<OWLAxiomChange> addMorfAnnotations(OWLDataFactory df, OWLOntology ont, OWLEntity entity, String lemma) {
	List<OWLAxiomChange> addList = Lists.newArrayList();
	Set<OWLEntityAnnotationAxiom> entityAnnotationAxioms = MorphAnnotation.createMorphAnnotations(df, entity, lemma);
	if (entityAnnotationAxioms.isEmpty()) {
		logger.info("Init: entity " + entity + " is already annotated");
	}
	else {
		logger.info("Init: entity " + entity + " adding annotations: " + entityAnnotationAxioms);
		for (OWLEntityAnnotationAxiom ax : entityAnnotationAxioms) {
			addList.add(new AddAxiom(ont, ax));
		}
	}
	return addList;
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:15,代码来源:ACEViewTab.java


注:本文中的org.semanticweb.owl.model.OWLOntology类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。