本文整理汇总了Java中org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue.DT_PROPERTY属性的典型用法代码示例。如果您正苦于以下问题:Java DatatypeIdValue.DT_PROPERTY属性的具体用法?Java DatatypeIdValue.DT_PROPERTY怎么用?Java DatatypeIdValue.DT_PROPERTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue
的用法示例。
在下文中一共展示了DatatypeIdValue.DT_PROPERTY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRdfValue
@Override
public Value getRdfValue(EntityIdValue value,
PropertyIdValue propertyIdValue, boolean simple) {
String datatype = this.propertyRegister
.setPropertyTypeFromEntityIdValue(propertyIdValue, value);
switch (datatype) {
case DatatypeIdValue.DT_ITEM:
if (simple) {
this.rdfConversionBuffer.addObjectProperty(propertyIdValue);
return this.rdfWriter.getUri(value.getIri());
} else {
return null; // or blank node
}
case DatatypeIdValue.DT_PROPERTY:
if (simple) {
this.rdfConversionBuffer.addObjectProperty(propertyIdValue);
return this.rdfWriter.getUri(value.getIri());
} else {
return null; // or blank node
}
default:
logIncompatibleValueError(propertyIdValue, datatype, "entity");
return null;
}
}
示例2: getDatatypeLabel
/**
* Returns an English label for a given datatype.
*
* @param datatype
* the datatype to label
* @return the label
*/
private String getDatatypeLabel(DatatypeIdValue datatype) {
if (datatype.getIri() == null) { // TODO should be redundant once the
// JSON parsing works
return "Unknown";
}
switch (datatype.getIri()) {
case DatatypeIdValue.DT_COMMONS_MEDIA:
return "Commons media";
case DatatypeIdValue.DT_GLOBE_COORDINATES:
return "Globe coordinates";
case DatatypeIdValue.DT_ITEM:
return "Item";
case DatatypeIdValue.DT_QUANTITY:
return "Quantity";
case DatatypeIdValue.DT_STRING:
return "String";
case DatatypeIdValue.DT_TIME:
return "Time";
case DatatypeIdValue.DT_URL:
return "URL";
case DatatypeIdValue.DT_PROPERTY:
return "Property";
case DatatypeIdValue.DT_EXTERNAL_ID:
return "External identifier";
case DatatypeIdValue.DT_MATH:
return "Math";
case DatatypeIdValue.DT_MONOLINGUAL_TEXT:
return "Monolingual Text";
default:
throw new RuntimeException("Unknown datatype " + datatype.getIri());
}
}
示例3: setPropertyTypeFromEntityIdValue
/**
* Returns the IRI of the primitive Type of an Property for
* {@link EntityIdValue} objects.
*
* @param propertyIdValue
* @param value
*/
public String setPropertyTypeFromEntityIdValue(
PropertyIdValue propertyIdValue, EntityIdValue value) {
switch (value.getId().charAt(0)) {
case 'Q':
return DatatypeIdValue.DT_ITEM;
case 'P':
return DatatypeIdValue.DT_PROPERTY;
default:
logger.warn("Could not determine Type of "
+ propertyIdValue.getId()
+ ". It is not a valid EntityDocument Id");
return null;
}
}
示例4: getRangeUri
/**
* Returns the class of datatype URI that best characterizes the range of
* the given property based on its datatype.
*
* @param propertyIdValue
* the property for which to get a range
* @return the range URI or null if the datatype could not be identified.
*/
String getRangeUri(PropertyIdValue propertyIdValue) {
String datatype = this.propertyRegister
.getPropertyType(propertyIdValue);
if (datatype == null)
return null;
switch (datatype) {
case DatatypeIdValue.DT_STRING:
case DatatypeIdValue.DT_EXTERNAL_ID:
case DatatypeIdValue.DT_MATH:
this.rdfConversionBuffer.addDatatypeProperty(propertyIdValue);
return Vocabulary.XSD_STRING;
case DatatypeIdValue.DT_COMMONS_MEDIA:
case DatatypeIdValue.DT_GLOBE_COORDINATES:
case DatatypeIdValue.DT_ITEM:
case DatatypeIdValue.DT_PROPERTY:
case DatatypeIdValue.DT_QUANTITY:
case DatatypeIdValue.DT_TIME:
case DatatypeIdValue.DT_URL:
this.rdfConversionBuffer.addObjectProperty(propertyIdValue);
return Vocabulary.OWL_THING;
default:
return null;
}
}