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

Java OWLModelManager类代码示例

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

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



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

示例1: removeAnnotation

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
/** Removes the set annotations of the entity from the given ontology using the given manager.
 * @param modelManager
 * @param currentEntity
 * @param ontology
 * @param annotations
 */
public static void removeAnnotation(OWLModelManager modelManager,
		OWLEntity currentEntity,
		OWLOntology ontology,
		Set<OWLAnnotation> annotations) {

	OWLDataFactory factory = modelManager.getOWLDataFactory();

	List<OWLOntologyChange> changes = new Vector<OWLOntologyChange>();
	for(OWLAnnotation annot : annotations) {
		OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(
				currentEntity.getIRI(),
				annot);
		changes.add(new RemoveAxiom(ontology, axiom));
	}
	modelManager.applyChanges(changes);
}
 
开发者ID:ics-upmc,项目名称:archonte,代码行数:23,代码来源:ArchonteUtils.java


示例2: renderSnippetAxioms

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
private static String renderSnippetAxioms(OWLModelManager mm, ACESnippet snippet) {
	StringBuilder html = new StringBuilder();
	if (snippet.isQuestion()) {
		OWLDescription dlquery = snippet.getDLQuery();
		if (dlquery != null) {
			html.append("<pre>");
			html.append(mm.getRendering(dlquery));
			html.append("</pre>");
		}
	}
	else {
		Set<OWLLogicalAxiom> axioms = snippet.getLogicalAxioms();
		for (OWLLogicalAxiom ax : axioms) {
			html.append("<pre>");
			html.append(mm.getRendering(ax));
			html.append("</pre>");
		}
	}
	return html.toString();
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:21,代码来源:ACEFeedbackViewComponent.java


示例3: addAnnotation

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
/** Adding the set annotations to the entity from the given ontology using the given manager.
 * @param modelManager
 * @param currentEntity
 * @param ontology
 * @param annotations
 */
public static void addAnnotation(OWLModelManager modelManager,
		OWLEntity currentEntity,
		OWLOntology ontology,
		Set<OWLAnnotation> annotations) {

	OWLDataFactory factory = modelManager.getOWLDataFactory();

	List<OWLOntologyChange> changes = new Vector<OWLOntologyChange>();
	for(OWLAnnotation annot : annotations) {
		OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(
				currentEntity.getIRI(), 
				annot);
		changes.add(new AddAxiom(ontology, axiom));
	}
	modelManager.applyChanges(changes);
}
 
开发者ID:ics-upmc,项目名称:archonte,代码行数:23,代码来源:ArchonteUtils.java


示例4: getBuiltinDatatypes

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
public Set<OWLDatatype> getBuiltinDatatypes(OWLModelManager owlModelManager) {
	Set<OWLDatatype> datatypes = new HashSet<>();
	final OWLDataFactory df = owlModelManager.getOWLDataFactory();

	datatypes.add(df.getTopDatatype());
	for (OWL2Datatype dt : OWL2Datatype.values()) {
		datatypes.add(df.getOWLDatatype(dt.getIRI()));
	}
	return datatypes;
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:11,代码来源:EditorToolBar.java


示例5: getKnownDatatypes

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
public Set<OWLDatatype> getKnownDatatypes(OWLModelManager owlModelManager, Set<OWLOntology> onts) {
	Set<OWLDatatype> knownTypes = getBuiltinDatatypes(owlModelManager);
	for (OWLOntology ont : onts) {
		knownTypes.addAll(ont.getDatatypesInSignature());
	}
	return knownTypes;
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:8,代码来源:EditorToolBar.java


示例6: createIfEmpty

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
/**
 * Initialize any hashmap if it isn't yet.
 */
private static void createIfEmpty() {
	if (_owlManager == null) {
		_owlManager = new HashMap<String, OWLModelManager>();
	}

	if (_owlModelManagerListener == null) {
		_owlModelManagerListener = new HashMap<String, OntologyModelManageListener>();
	}

	if (_owlOntologyChangedListener == null) {
		_owlOntologyChangedListener = new HashMap<String, OntologyChangedListener>();
	}

}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:18,代码来源:OWLModelManagerStorage.java


示例7: setOWLManager

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
/**
 * saves the current OWLManager for later use
 *
 * @param o OWLModelManager
 */
public static void setOWLManager(OWLModelManager o, String id) {
	createIfEmpty();
	disposeListener(id);
	_owlManager.put(id, o);
	addListener(id);
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:12,代码来源:OWLModelManagerStorage.java


示例8: setup

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
public void setup(final OWLModelManager owlModelManager) {

        SKOSRendererPreferences prefs = SKOSRendererPreferences.getInstance();

        List<OWLPropertyExpression> properties = new ArrayList<OWLPropertyExpression>(prefs.getDataPropertyLabels());


        Map<OWLDataPropertyExpression, List<String>> propToLangs = new HashMap<OWLDataPropertyExpression, List<String>>(prefs.getPropertyLangs());

        propVal = new PropertyAssertionValueShortFormProvider(properties, propToLangs, new OWLOntologySetProvider() {

                    public Set<OWLOntology> getOntologies() {
                        return owlModelManager.getOntologies();

                    }
                });

//        OWLDataProperty prefLabelProp = owlModelManager.getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.PREFLABEL);
//        List<OWLPropertyExpression> properties = new ArrayList<OWLPropertyExpression>();
//        properties.add(prefLabelProp);
//        propVal = new PropertyAssertionValueShortFormProvider(properties, new HashMap(), new OWLOntologySetProvider() {
//
//            public Set<OWLOntology> getOntologies() {
//                return owlModelManager.getOntologies();
//
//            }
//        });

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


示例9: SKOSInSchemeAssertedHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSInSchemeAssertedHierarchyProvider(final OWLModelManager modelManager) {
    super(modelManager.getOWLOntologyManager());
    this.modelManager = modelManager;

    inScheme = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSRDFVocabulary.INSCHEME.getURI());
    topConceptOf = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSRDFVocabulary.TOPCONCEPTOF.getURI());

    conceptsToView = new HashSet<OWLIndividual>(10000);
    topConcepts = new HashSet<OWLIndividual>(10000);

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


示例10: SKOSConceptInferredHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSConceptInferredHierarchyProvider(final OWLModelManager modelManager, OWLReasoner reasoner) {
    super(modelManager.getOWLOntologyManager());

    this.modelManager = modelManager;
    this.reasoner = reasoner;
    conceptsToView = new HashSet<OWLIndividual>(10000);

    skosConcept = modelManager.getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPT.getURI());
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:10,代码来源:SKOSConceptInferredHierarchyProvider.java


示例11: SKOSInSchemeInferredHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSInSchemeInferredHierarchyProvider(final OWLModelManager modelManager, OWLReasoner reasoner) {
    super(modelManager.getOWLOntologyManager());
    this.modelManager = modelManager;
    this.reasoner = reasoner;

    skosConcept = modelManager.getOWLDataFactory().getOWLClass(SKOSRDFVocabulary.CONCEPT.getURI());
    inScheme = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSRDFVocabulary.INSCHEME.getURI());
    topConceptOf = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSRDFVocabulary.TOPCONCEPTOF.getURI());

    conceptsToView = new HashSet<OWLIndividual>(10000);
    topConcepts = new HashSet<OWLIndividual>(10000);

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


示例12: setup

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
public void setup(final OWLModelManager owlModelManager) {

        SKOSRendererPreferences prefs = SKOSRendererPreferences.getInstance();

        List<OWLPropertyExpression> properties = new ArrayList<OWLPropertyExpression> ();
        properties.addAll(prefs.getDataPropertyLabels());


        Map<OWLDataPropertyExpression, List<String>> propToLangs = new HashMap<OWLDataPropertyExpression, List<String>>(prefs.getPropertyLangs());

        propVal = new PropertyAssertionValueShortFormProvider(properties, propToLangs, new OWLOntologySetProvider() {

                    public Set<OWLOntology> getOntologies() {
                        return owlModelManager.getOntologies();

                    }
                });

//        OWLDataProperty prefLabelProp = owlModelManager.getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.PREFLABEL);
//        List<OWLPropertyExpression> properties = new ArrayList<OWLPropertyExpression>();
//        properties.add(prefLabelProp);
//        propVal = new PropertyAssertionValueShortFormProvider(properties, new HashMap(), new OWLOntologySetProvider() {
//
//            public Set<OWLOntology> getOntologies() {
//                return owlModelManager.getOntologies();
//
//            }
//        });

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


示例13: SKOSInSchemeAssertedHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSInSchemeAssertedHierarchyProvider(final OWLModelManager modelManager) {
    super(modelManager.getOWLOntologyManager());
    this.modelManager = modelManager;

    inScheme = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSVocabulary.INSCHEME.getIRI());
    topConceptOf = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSVocabulary.TOPCONCEPTOF.getIRI());

    conceptsToView = new HashSet<OWLNamedIndividual>(10000);
    topConcepts = new HashSet<OWLNamedIndividual>(10000);

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


示例14: SKOSConceptInferredHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSConceptInferredHierarchyProvider(final OWLModelManager modelManager, OWLReasoner reasoner) {
    super(modelManager.getOWLOntologyManager());

    this.modelManager = modelManager;
    this.reasoner = reasoner;
    conceptsToView = new HashSet<OWLNamedIndividual>(10000);

    skosConcept = modelManager.getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPT.getIRI());
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:10,代码来源:SKOSConceptInferredHierarchyProvider.java


示例15: SKOSInSchemeInferredHierarchyProvider

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
protected SKOSInSchemeInferredHierarchyProvider(final OWLModelManager modelManager, OWLReasoner reasoner) {
    super(modelManager.getOWLOntologyManager());
    this.modelManager = modelManager;
    this.reasoner = reasoner;

    skosConcept = modelManager.getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPT.getIRI());
    inScheme = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSVocabulary.INSCHEME.getIRI());
    topConceptOf = modelManager.getOWLDataFactory().getOWLObjectProperty(SKOSVocabulary.TOPCONCEPTOF.getIRI());

    conceptsToView = new HashSet<OWLNamedIndividual>(10000);
    topConcepts = new HashSet<OWLNamedIndividual>(10000);

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


示例16: getObjectEditor

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
public OWLObjectEditor<OWLAnnotation> getObjectEditor() {
    if (!getOWLEditorKit().getModelManager().getActiveOntology().getAnnotationPropertiesInSignature().contains(property)) {
        // create the SKOS label property
        OWLModelManager man = getOWLEditorKit().getModelManager();
        OWLAxiom ax = man.getOWLDataFactory().getOWLDeclarationAxiom(property);
        man.applyChange(new AddAxiom(getOWLEditorKit().getModelManager().getActiveOntology(), ax));

        OWLAnnotationProperty label = man.getOWLDataFactory().getRDFSLabel();
        OWLAxiom ax2 = man.getOWLDataFactory().getOWLSubAnnotationPropertyOfAxiom(property, label);
        man.applyChange(new AddAxiom(man.getActiveOntology(), ax2));
    }
    return new SKOSAnnotationEditor(getOWLEditorKit(), property);
}
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:14,代码来源:SKOSAnnotationFrameSection.java


示例17: renderingChanged

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的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


示例18: setValueAt

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的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: setAnswerLists

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的package包/类
private void setAnswerLists(OWLModelManager mngr, OWLReasoner reasoner, OWLDescription desc) throws OWLReasonerException {
	Set<OWLIndividual> answerIndividuals = reasoner.getIndividuals(desc, false);

	setIndividualAnswerList(individuals, answerIndividuals);
	setClassAnswerList(subClasses, OWLReasonerAdapter.flattenSetOfSets(reasoner.getDescendantClasses(desc)));
	setClassAnswerList(supClasses, OWLReasonerAdapter.flattenSetOfSets(reasoner.getAncestorClasses(desc)));

	// We remove inconsistent classes as they might be confusing when presented as answers.
	subClasses.removeAll(reasoner.getInconsistentClasses());

	isIndividualAnswersComplete = isCompleteIndividuals(mngr.getOWLDataFactory(), reasoner, desc, individuals);
	isSubClassesAnswersComplete = isCompleteSubClasses(mngr.getOWLDataFactory(), reasoner, desc, subClasses);
}
 
开发者ID:Kaljurand,项目名称:aceview,代码行数:14,代码来源:ACEAnswer.java


示例20: actionPerformed

import org.protege.editor.owl.model.OWLModelManager; //导入依赖的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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DelegateAsyncProcessor类代码示例发布时间:2022-05-23
下一篇:
Java ExecuteMethod类代码示例发布时间: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