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


Java OWLObjectCardinalityRestriction类代码示例

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


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

示例1: addCardinalityRestriction

import org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction; //导入依赖的package包/类
long addCardinalityRestriction(OWLObjectCardinalityRestriction desc) {
  long restriction = getOrCreateNode(getIri(desc), OwlLabels.OWL_ANONYMOUS);
  graph.setNodeProperty(restriction, "cardinality", desc.getCardinality());
  long property = getOrCreateNode(getIri(desc.getProperty()));
  getOrCreateRelationship(restriction, property, OwlRelationships.PROPERTY);
  long cls = getOrCreateNode(getIri(desc.getFiller()));
  getOrCreateRelationship(restriction, cls, OwlRelationships.CLASS);
  return restriction;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:10,代码来源:GraphOwlVisitor.java

示例2: equals

import org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof OWLObjectCardinalityRestriction)) {
        return false;
    }
    return getProperty().equals(
            ((OWLObjectCardinalityRestriction) obj).getProperty());
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:15,代码来源:OWLObjectCardinalityRestrictionImpl.java

示例3: compareObjectOfSameType

import org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction; //导入依赖的package包/类
@Override
protected int compareObjectOfSameType(OWLObject object) {
    OWLObjectCardinalityRestriction other = (OWLObjectCardinalityRestriction) object;
    int diff = getProperty().compareTo(other.getProperty());
    if (diff != 0) {
        return diff;
    }
    diff = getCardinality() - other.getCardinality();
    if (diff != 0) {
        return diff;
    }
    return getFiller().compareTo(other.getFiller());
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:14,代码来源:OWLObjectCardinalityRestrictionImpl.java

示例4: visitCardinalityRestriction

import org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction; //导入依赖的package包/类
private void visitCardinalityRestriction(OWLObjectCardinalityRestriction cardinalityRestriction) {
	OWLClassExpression filler = cardinalityRestriction.getFiller();
	OWLObjectPropertyExpression property = cardinalityRestriction.getProperty();

	String fillerName, comperator;

	if (cardinalityRestriction instanceof OWLObjectMinCardinality)
		comperator = "<";
	else if (cardinalityRestriction instanceof OWLObjectMaxCardinality)
		comperator = ">";
	else
		comperator = "=";

	if (filler instanceof OWLObjectComplementOf){
		OWLClassExpression operand = ((OWLObjectComplementOf) filler).getOperand();
		fillerName = mapper.getPredicateName(((OWLObjectComplementOf) filler).getOperand().asOWLClass());
		fillerName = ASP2CoreSymbols.NAF + " " + fillerName;
		if (isAuxiliaryClass(operand.asOWLClass()))
			auxClasses.add(operand.asOWLClass());
	}
	else if (filler instanceof OWLObjectOneOf) {
		System.out.println("Shouldn't be here anymore");
		//TODO: in case of a max-cardinality we will never end up within here,
		// since the normalization for max-cardinality uses an "optimization".
		OWLObjectOneOf oneOf = (OWLObjectOneOf) filler;
		OWLClass auxOneOf= getOneOfAuxiliaryClass(oneOf);

		fillerName = mapper.getPredicateName(auxOneOf);
	}
	else {
		assert filler instanceof OWLClass;

		fillerName = mapper.getPredicateName(filler.asOWLClass());

		if (isAuxiliaryClass(filler.asOWLClass()))
			auxClasses.add(filler.asOWLClass());
	}

	assert property instanceof OWLObjectProperty;

	boolean isInverseOf = false;

	if(property instanceof OWLObjectInverseOf) {
		isInverseOf = true;
		property = ((OWLObjectInverseOf) property).getInverse();
	} else {

	}

	String propertyName = mapper.getPredicateName(property.asOWLObjectProperty());

	String currentVar = var.currentVar();
	String nextVar = var.nextVariable();
	String classVar = nextVar;

	if (isInverseOf) {
		String temp = currentVar;
		currentVar = nextVar;
		nextVar = temp;
	}

	writer.print("#count{");
	writer.print(classVar + "," + propertyName + ":");
	writer.print(propertyName);
	writer.print(ASP2CoreSymbols.BRACKET_OPEN);
	writer.print(currentVar);
	writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
	writer.print(nextVar);
	writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
	writer.print(ASP2CoreSymbols.CONJUNCTION);
	writer.print(fillerName);
	writer.print(ASP2CoreSymbols.BRACKET_OPEN);
	writer.print(classVar);
	writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
	writer.print("}" + comperator + cardinalityRestriction.getCardinality());

	var.reset();
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:79,代码来源:NaiveTranslation.java


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