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


Java OConstants.INSTANCE属性代码示例

本文整理汇总了Java中gate.creole.ontology.OConstants.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java OConstants.INSTANCE属性的具体用法?Java OConstants.INSTANCE怎么用?Java OConstants.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gate.creole.ontology.OConstants的用法示例。


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

示例1: getHasValue

public Object getHasValue() {
    ResourceInfo resource = ontologyService.getRestrictionValue(
            this.nodeId.toString(), OConstants.HAS_VALUE_RESTRICTION);
    RDFProperty prop = getOnPropertyValue();
    if (prop instanceof DatatypePropertyImpl) {
        try {
            return new Literal(resource.getUri(), ((DatatypePropertyImpl) prop).getDataType());
        } catch (InvalidValueException ive) {
            throw new GateRuntimeException(ive);
        }
    }

    if (resource.getClassType() == OConstants.INSTANCE) {
        return Utils.createOInstance(this.ontology,
                this.ontologyService, resource.getUri());
    }

    return Utils.createOClass(this.ontology, this.ontologyService,
            resource.getUri(), resource.getClassType());
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:20,代码来源:HasValueRestrictionImpl.java

示例2: getHasValue

public Object getHasValue() {
    ResourceInfo resource = ontologyService.getRestrictionValue(
            this.nodeId.toString(), OConstants.HAS_VALUE_RESTRICTION);
    RDFProperty prop = getOnPropertyValue();
    if(prop instanceof DatatypePropertyImpl) {
      try {
        return new Literal(resource.getUri(),((DatatypePropertyImpl)prop).getDataType());
      } catch(InvalidValueException ive) {
        throw new GateRuntimeException(ive);
      }
    }
    
    if(resource.getClassType() == OConstants.INSTANCE) {
    return Utils.createOInstance(this.ontology,
        this.ontologyService, resource.getUri());
  }
    
    return Utils.createOClass(this.ontology, this.ontologyService,
            resource.getUri(), resource.getClassType());
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:20,代码来源:HasValueRestrictionImpl.java

示例3: getHasValue

public OResource getHasValue() {
    ResourceInfo resource = ontologyService.getRestrictionValue(
            this.nodeId.toString(), OConstants.ALL_VALUES_FROM_RESTRICTION);

    if (resource.getClassType() == OConstants.INSTANCE)
        return Utils.createOInstance(this.ontology,
                this.ontologyService, resource.getUri());

    return Utils.createOClass(this.ontology, this.ontologyService,
            resource.getUri(), resource.getClassType());
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:11,代码来源:AllValuesFromRestrictionImpl.java

示例4: getHasValue

public OResource getHasValue() {
    ResourceInfo resource = ontologyService.getRestrictionValue(
            this.nodeId.toString(), OConstants.SOME_VALUES_FROM_RESTRICTION);

    if (resource.getClassType() == OConstants.INSTANCE)
        return Utils.createOInstance(this.ontology,
                this.ontologyService, resource.getUri());

    return Utils.createOClass(this.ontology, this.ontologyService,
            resource.getUri(), resource.getClassType());
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:11,代码来源:SomeValuesFromRestrictionImpl.java

示例5: getHasValue

public OResource getHasValue() {
  ResourceInfo resource = ontologyService.getRestrictionValue(
          this.nodeId.toString(), OConstants.ALL_VALUES_FROM_RESTRICTION);

  if(resource.getClassType() == OConstants.INSTANCE)
    return Utils.createOInstance(this.ontology,
            this.ontologyService, resource.getUri());

  return Utils.createOClass(this.ontology, this.ontologyService,
          resource.getUri(), resource.getClassType());
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:11,代码来源:AllValuesFromRestrictionImpl.java

示例6: getHasValue

public OResource getHasValue() {
    ResourceInfo resource = ontologyService.getRestrictionValue(
            this.nodeId.toString(), OConstants.SOME_VALUES_FROM_RESTRICTION);

    if(resource.getClassType() == OConstants.INSTANCE)
      return Utils.createOInstance(this.ontology,
              this.ontologyService, resource.getUri());

    return Utils.createOClass(this.ontology, this.ontologyService,
            resource.getUri(), resource.getClassType());
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:11,代码来源:SomeValuesFromRestrictionImpl.java

示例7: getRestrictionValue

/**
 * Gets the cardinality value specified on the given restriction uri.
 * 
 * @param restrictionURI
 * @param restrictionType
 *          - either of the following constants from the OConstants -
 *          ALL_VALUES_FROM_RESTRICTION, SOME_VALUES_FROM_RESTRICTION, and
 *          HAS_VALUE_RESTRICTION
 * @return
 */
public ResourceInfo getRestrictionValue(
    String restrictionURI, byte restrictionType)
{
  System.out.println("getRestrictionValue for "+restrictionURI);
  URI whatValueURI = null;
  switch (restrictionType) {
    case OConstants.ALL_VALUES_FROM_RESTRICTION:
      whatValueURI = OWL.ALLVALUESFROM;
      break;
    case OConstants.HAS_VALUE_RESTRICTION:
      whatValueURI = OWL.HASVALUE;
      break;
    case OConstants.SOME_VALUES_FROM_RESTRICTION:
      whatValueURI = OWL.SOMEVALUESFROM;
      break;
    default:
      throw new GateOntologyException("Invalid restriction type:" + restrictionType + " for the restriction " + restrictionURI);
  }
  String resourceURI;
  try {
    RepositoryResult<Statement> iter =
        repositoryConnection.getStatements(string2SesameResource(restrictionURI), whatValueURI,
        null, true);
    if (iter.hasNext()) {
      resourceURI = iter.next().getObject().toString();
      Resource res = getResource(resourceURI);
      boolean isRestriction =
          repositoryConnection.hasStatement(
          res,
          RDF.TYPE,
          OWL.RESTRICTION,
          true);
      byte classType = OConstants.OWL_CLASS;
      if (isRestriction) {
        if (repositoryConnection.hasStatement(res, OWL.HASVALUE, null, true)) {
          classType = OConstants.HAS_VALUE_RESTRICTION;
        } else if (repositoryConnection.hasStatement(res, OWL.SOMEVALUESFROM, null, true)) {
          classType = OConstants.SOME_VALUES_FROM_RESTRICTION;
        } else if (repositoryConnection.hasStatement(res, OWL.ALLVALUESFROM, null, true)) {
          classType = OConstants.ALL_VALUES_FROM_RESTRICTION;
        } else if (repositoryConnection.hasStatement(res, OWL.CARDINALITY, null, true)) {
          classType = OConstants.CARDINALITY_RESTRICTION;
        } else if (repositoryConnection.hasStatement(res, OWL.MINCARDINALITY, null, true)) {
          classType = OConstants.MIN_CARDINALITY_RESTRICTION;
        } else if (repositoryConnection.hasStatement(res, OWL.MAXCARDINALITY, null, true)) {
          classType = OConstants.MAX_CARDINALITY_RESTRICTION;
        }
      }

      if (classType == OConstants.OWL_CLASS) {
        if (res instanceof BNode) {
          classType = OConstants.ANNONYMOUS_CLASS;
        } else {
          // check if it is an instance
          if (isIndividual(resourceURI)) {
            classType = OConstants.INSTANCE;
          }
        }
      }

      return new ResourceInfo(resourceURI, classType);
    }
  } catch (Exception e) {
    throw new GateOntologyException("Problem getting restriction value for "+restrictionURI,e);
  }
  return null;
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:77,代码来源:OntologyServiceImplSesame.java


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