本文整理汇总了Java中org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue.DT_TIME属性的典型用法代码示例。如果您正苦于以下问题:Java DatatypeIdValue.DT_TIME属性的具体用法?Java DatatypeIdValue.DT_TIME怎么用?Java DatatypeIdValue.DT_TIME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue
的用法示例。
在下文中一共展示了DatatypeIdValue.DT_TIME属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRdfValue
@Override
public Value getRdfValue(TimeValue value, PropertyIdValue propertyIdValue,
boolean simple) {
String datatype = this.propertyRegister.setPropertyTypeFromTimeValue(
propertyIdValue, value);
switch (datatype) {
case DatatypeIdValue.DT_TIME:
if (simple) {
this.rdfConversionBuffer.addDatatypeProperty(propertyIdValue);
return TimeValueConverter.getTimeLiteral(value, this.rdfWriter);
} else {
URI valueUri = this.rdfWriter.getUri(Vocabulary
.getTimeValueUri(value,
this.propertyRegister.getUriPrefix()));
this.rdfConversionBuffer.addObjectProperty(propertyIdValue);
addValue(value, valueUri);
return valueUri;
}
default:
logIncompatibleValueError(propertyIdValue, datatype, "time");
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: 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;
}
}
示例4: testGetDatatypeId
@Test
public final void testGetDatatypeId() {
DatatypeIdValue o1 = new DatatypeIdImpl(DatatypeIdValue.DT_TIME);
DatatypeIdValue o2 = converter.copy(o1);
assertEquals(o1.toString(), o2.toString());
assertEquals(o1.hashCode(), o2.hashCode());
assertEquals(o2, o1);
}
示例5: testGetPropertyDocument
@Test
public final void testGetPropertyDocument() {
PropertyDocument o1 = new PropertyDocumentImpl(
getTestPropertyIdValue(2),
getTestMtvList(1, 0), // labels
getTestMtvList(4, 13), // descriptions
getTestMtvList(0, 0), // aliases
getTestStatementGroups(2, 17, 1, EntityIdValue.ET_PROPERTY),
new DatatypeIdImpl(DatatypeIdValue.DT_TIME), 1234);
PropertyDocument o2 = converter.copy(o1);
assertEquals(o1.toString(), o2.toString());
assertEquals(o1.hashCode(), o2.hashCode());
assertEquals(o2, o1);
}
示例6: setUp
@Before
public void setUp() {
d1 = new DatatypeIdImpl(DatatypeIdValue.DT_ITEM);
d2 = new DatatypeIdImpl("http://wikiba.se/ontology#WikibaseItem");
d3 = new DatatypeIdImpl(DatatypeIdValue.DT_TIME);
}
示例7: setPropertyTypeFromTimeValue
/**
* Returns the IRI of the primitive Type of an Property for
* {@link TimeValue} objects.
*
* @param propertyIdValue
* @param value
*/
public String setPropertyTypeFromTimeValue(PropertyIdValue propertyIdValue,
TimeValue value) {
return DatatypeIdValue.DT_TIME;
}