本文整理汇总了Java中org.apache.jena.graph.impl.LiteralLabel.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java LiteralLabel.getValue方法的具体用法?Java LiteralLabel.getValue怎么用?Java LiteralLabel.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.graph.impl.LiteralLabel
的用法示例。
在下文中一共展示了LiteralLabel.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertDateLiteral
import org.apache.jena.graph.impl.LiteralLabel; //导入方法依赖的package包/类
private String convertDateLiteral(LiteralLabel lit) {
RDFDatatype dt = lit.getDatatype();
String s = lit.getLexicalForm();
try {
Object value = lit.getValue();
if (value instanceof XSDDateTime) {
Calendar calendar = ((XSDDateTime) value).asCalendar();
if (dt.equals(XSDDatatype.XSDgMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, PORTUGUESE_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgMonthDay)) {
s = calendar.get(Calendar.DAY_OF_MONTH)
+ calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, PORTUGUESE_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgYearMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, PORTUGUESE_LOCAL) + " "
+ calendar.get(Calendar.YEAR);
} else if (dt.equals(XSDDatatype.XSDgYear)) {
s = "" + calendar.get(Calendar.YEAR);
} else {
s = calendar.get(Calendar.DAY_OF_MONTH) + " de "
+ calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, PORTUGUESE_LOCAL) + " de "
+ calendar.get(Calendar.YEAR);
// dateFormat.format(calendar.getTime());
}
}
} catch (DatatypeFormatException | IllegalDateTimeFieldException e) {
logger.error("Conversion of date literal " + lit + " failed. Reason: " + e.getMessage());
// fallback
// DateTime time = ISODateTimeFormat.dateTime
DateTime time;
try {
time = ISODateTimeFormat.dateTimeParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd 'de' MMMM 'de' YYYY", PORTUGUESE_LOCAL);
} catch (Exception e1) {
try {
time = ISODateTimeFormat.localDateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd 'de' MMMM 'de' YYYY", PORTUGUESE_LOCAL);
} catch (Exception e2) {
e2.printStackTrace();
time = ISODateTimeFormat.dateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd 'de' MMMM 'de' YYYY", PORTUGUESE_LOCAL);
}
}
}
return s;
}
示例2: convertDateLiteral
import org.apache.jena.graph.impl.LiteralLabel; //导入方法依赖的package包/类
private String convertDateLiteral(LiteralLabel lit){
RDFDatatype dt = lit.getDatatype();
String s = lit.getLexicalForm();
try {
Object value = lit.getValue();
if (value instanceof XSDDateTime) {
Calendar calendar = ((XSDDateTime) value).asCalendar();
if(dt.equals(XSDDatatype.XSDgMonth)){
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL);
} else if(dt.equals(XSDDatatype.XSDgMonthDay)){
s = calendar.get(Calendar.DAY_OF_MONTH) + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL);
} else if(dt.equals(XSDDatatype.XSDgYearMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " " + calendar.get(Calendar.YEAR);
} else if(dt.equals(XSDDatatype.XSDgYear)) {
s = "" + calendar.get(Calendar.YEAR);
} else {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " " + calendar.get(Calendar.DAY_OF_MONTH)
+ ", " + calendar.get(Calendar.YEAR);
// dateFormat.format(calendar.getTime());
}
}
} catch (DatatypeFormatException | IllegalDateTimeFieldException e) {
logger.error("Conversion of date literal " + lit + " failed. Reason: " + e.getMessage());
//fallback
// DateTime time = ISODateTimeFormat.dateTime
DateTime time;
try {
time = ISODateTimeFormat.dateTimeParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
} catch (Exception e1) {
try {
time = ISODateTimeFormat.localDateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
} catch (Exception e2) {
e2.printStackTrace();
time = ISODateTimeFormat.dateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
}
}
}
return s;
}
示例3: convertDateLiteral
import org.apache.jena.graph.impl.LiteralLabel; //导入方法依赖的package包/类
private String convertDateLiteral(LiteralLabel lit) {
RDFDatatype dt = lit.getDatatype();
String s = lit.getLexicalForm();
try {
Object value = lit.getValue();
if (value instanceof XSDDateTime) {
Calendar calendar = ((XSDDateTime) value).asCalendar();
if (dt.equals(XSDDatatype.XSDgMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, FRENCH_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgMonthDay)) {
s = calendar.get(Calendar.DAY_OF_MONTH)
+ calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, FRENCH_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgYearMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, FRENCH_LOCAL) + " "
+ calendar.get(Calendar.YEAR);
} else if (dt.equals(XSDDatatype.XSDgYear)) {
s = "" + calendar.get(Calendar.YEAR);
} else {
s = calendar.get(Calendar.DAY_OF_MONTH) + " "
+ calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, FRENCH_LOCAL) + " "
+ calendar.get(Calendar.YEAR);
// dateFormat.format(calendar.getTime());
}
}
} catch (DatatypeFormatException | IllegalDateTimeFieldException e) {
logger.error("Conversion of date literal " + lit + " failed. Reason: " + e.getMessage());
// fallback
// DateTime time = ISODateTimeFormat.dateTime
DateTime time;
try {
time = ISODateTimeFormat.dateTimeParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd MMMM YYYY", FRENCH_LOCAL);
} catch (Exception e1) {
try {
time = ISODateTimeFormat.localDateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd MMMM YYYY", FRENCH_LOCAL);
} catch (Exception e2) {
e2.printStackTrace();
time = ISODateTimeFormat.dateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("dd MMMM YYYY", FRENCH_LOCAL);
}
}
}
return s;
}
示例4: convertDateLiteral
import org.apache.jena.graph.impl.LiteralLabel; //导入方法依赖的package包/类
private String convertDateLiteral(LiteralLabel lit) {
RDFDatatype dt = lit.getDatatype();
String s = lit.getLexicalForm();
try {
Object value = lit.getValue();
if (value instanceof XSDDateTime) {
Calendar calendar = ((XSDDateTime) value).asCalendar();
if (dt.equals(XSDDatatype.XSDgMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgMonthDay)) {
s = calendar.get(Calendar.DAY_OF_MONTH)
+ calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL);
} else if (dt.equals(XSDDatatype.XSDgYearMonth)) {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " "
+ calendar.get(Calendar.YEAR);
} else if (dt.equals(XSDDatatype.XSDgYear)) {
s = "" + calendar.get(Calendar.YEAR);
} else {
s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " "
+ calendar.get(Calendar.DAY_OF_MONTH) + ", " + calendar.get(Calendar.YEAR);
// dateFormat.format(calendar.getTime());
}
}
} catch (DatatypeFormatException | IllegalDateTimeFieldException e) {
logger.error("Conversion of date literal " + lit + " failed. Reason: " + e.getMessage());
// fallback
// DateTime time = ISODateTimeFormat.dateTime
DateTime time;
try {
time = ISODateTimeFormat.dateTimeParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
} catch (Exception e1) {
try {
time = ISODateTimeFormat.localDateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
} catch (Exception e2) {
e2.printStackTrace();
time = ISODateTimeFormat.dateParser().parseDateTime(lit.getLexicalForm());
s = time.toString("MMMM dd, yyyy");
}
}
}
return s;
}