本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}