• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OWLOntology类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: removeMorfAnnotations

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
private static List<OWLAxiomChange> removeMorfAnnotations(OWLOntology ont, OWLEntity entity) {
	List<OWLAxiomChange> removeList = Lists.newArrayList();
	Set<OWLAxiom> rAxioms = ont.getReferencingAxioms(entity);
	for (OWLAxiom rAx : rAxioms) {
		if (rAx instanceof OWLEntityAnnotationAxiom &&
				FieldType.isLexiconEntryURI(((OWLEntityAnnotationAxiom) rAx).getAnnotation().getAnnotationURI())) {
			removeList.add(new RemoveAxiom(ont, rAx));
		}
	}
	return removeList;
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:12,代码来源:ACEViewTab.java


示例17: verbalizeWithWS

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * <p>Verbalizes the OWL axiom using the Verbalizer webservice.</p>
 * 
 * @param uri URI
 * @param axiom OWL axiom
 * @return Verbalization of the given axiom
 * @throws OWLRendererException 
 * @throws OWLOntologyChangeException 
 * @throws OWLOntologyCreationException 
 */
private String verbalizeWithWS(URI uri, OWLLogicalAxiom axiom, OWLDataFactory df) throws OWLRendererException, OWLOntologyCreationException, OWLOntologyChangeException {
	Set<OWLAxiom> allAxioms = Sets.newHashSet((OWLAxiom) axiom);

	for (OWLEntity entity : axiom.getReferencedEntities()) {
		Set<OWLEntityAnnotationAxiom> annotationAxioms = MorphAnnotation.getMorphAnnotationsFromLexicon(df, lexicon, entity);
		allAxioms.addAll(annotationAxioms);
	}

	OWLOntologyManager ontologyManager = ACETextManager.createOWLOntologyManager();
	OWLOntology ontology = ontologyManager.createOntology(allAxioms, uri);
	return verbalizeOntology(ontologyManager, ontology);
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:23,代码来源:AxiomVerbalizer.java


示例18: setValueAt

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
/**
 * The delete/add is a single change i.e. one UNDO would suffice to restore
 * the original state.
 * 
 * TODO: This code is buggy as it accesses the LexiconField enum
 */
@Override
public void setValueAt(Object newValue, int row, int column) {
	String newValueAsString = (String) newValue;
	String oldValueAsString = (String) getValueAt(row, column);
	if (newValueAsString.equals(oldValueAsString)) {
		logger.info("No change");
	}
	else {
		logger.info("Changing: " + oldValueAsString + " -> " + newValueAsString);
		OWLEntity entity = (OWLEntity) entityArray[row];
		if (entity != null) {
			OWLModelManager mm = ACETextManager.getOWLModelManager();
			OWLOntology ont = mm.getActiveOntology();
			// TODO: BUG: This way of finding the URI is waiting to be broken.
			FieldType field = FieldType.values()[column - 3];
			List<OWLAxiomChange> changes = Lists.newArrayList();

			// Remove the respective annotation (if present)
			changes.addAll(ACETextManager.findEntityAnnotationAxioms(ont, entity, field.getURI()));

			// We add a new annotation only if the modification of the table cell is
			// a non-empty string.
			if (newValueAsString.length() > 0) {
				OWLDataFactory df = mm.getOWLDataFactory();
				OWLEntityAnnotationAxiom newAnnot = df.getOWLEntityAnnotationAxiom(entity, field.getURI(), df.getOWLUntypedConstant(newValueAsString));
				changes.add(new AddAxiomByACEView(ont, newAnnot));
			}

			OntologyUtils.changeOntology(mm.getOWLOntologyManager(), changes);
			fireTableCellUpdated(row, column);
		}
	}
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:40,代码来源:LexiconTableModel.java


示例19: actionPerformed

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public void actionPerformed(ActionEvent actionEvent) {
	OWLModelManager mm = ACETextManager.getOWLModelManager();
	OWLDataFactory df = mm.getOWLDataFactory();
	Set<OWLOntology> ontologies = mm.getActiveOntologies();
	OWLOntologyManager ontologyManager = mm.getOWLOntologyManager();
	int ontologyCounter = 0;
	int entityCounter = 0;
	int annotatedEntityCounter = 0;
	int annotationCounter = 0;

	List<AddAxiom> additions = Lists.newArrayList();

	for (OWLOntology ont : ontologies) {
		ontologyCounter++;
		for (OWLEntity entity : ont.getReferencedEntities()) {
			entityCounter++;
			String entityRendering = getOWLModelManager().getRendering(entity);
			Set<OWLEntityAnnotationAxiom> entityAnnotationAxioms = MorphAnnotation.getMorphAnnotations(df, ont, entity, entityRendering);
			int size = entityAnnotationAxioms.size();
			if (size > 0) {
				for (OWLEntityAnnotationAxiom ax : entityAnnotationAxioms) {
					additions.add(new AddAxiom(ont, ax));
				}
				annotatedEntityCounter++;
				annotationCounter += size;
			}
		}
	}

	OntologyUtils.changeOntology(ontologyManager, additions);

	ACETextManager.fireEvent(EventType.ACELEXICON_CHANGED);
	String message = "Checked " + entityCounter + " entities in " + ontologyCounter + " active ontologies.";
	message += "\nAnnotated " + annotatedEntityCounter + " entities with " + annotationCounter + " annotations.";
	JOptionPane.showMessageDialog(null, message, "Fill Lexicon Action", JOptionPane.INFORMATION_MESSAGE);
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:37,代码来源:FillLexiconAction.java


示例20: getAnnotationURIs

import org.semanticweb.owl.model.OWLOntology; //导入依赖的package包/类
public static Set<URI> getAnnotationURIs(OWLOntology ontology, OWLEntity entity) {
	Set<URI> annotationURIs = Sets.newHashSet();
	for (OWLAnnotation annotation : entity.getAnnotations(ontology)) {
		annotationURIs.add(annotation.getAnnotationURI());
	}
	return annotationURIs;
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:8,代码来源:OntologyUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GraphDatabaseConfiguration类代码示例发布时间:2022-05-23
下一篇:
Java XmlAttributeValueImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap