org.apache.jena.datatypes.xsd.XSDDateTime Java Examples

The following examples show how to use org.apache.jena.datatypes.xsd.XSDDateTime. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstanceAggregator.java    From rdf2x with Apache License 2.0 6 votes vote down vote up
/**
 * Get literal type based on class of the value instance.
 *
 * @param value the requested value
 * @return the value's literal type, null if not recognized
 */
private int getLiteralTypeFromValue(Object value) {
    if (value instanceof Integer) {
        return LiteralType.INTEGER;
    } else if (value instanceof Double) {
        return LiteralType.DOUBLE;
    } else if (value instanceof Float) {
        return LiteralType.FLOAT;
    } else if (value instanceof String) {
        return LiteralType.STRING;
    } else if (value instanceof Long) {
        return LiteralType.LONG;
    } else if (value instanceof Boolean) {
        return LiteralType.BOOLEAN;
    } else if (value instanceof XSDDateTime) {
        return LiteralType.DATETIME;
    }
    return 0;
}
 
Example #2
Source File: AbstractJunitXmlResultsWriter.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
private String testLength(XSDDateTime datetimeStart, XSDDateTime datetimeEnd) {
	long diff = datetimeEnd.asCalendar().getTimeInMillis() - datetimeStart.asCalendar().getTimeInMillis();
	return String.format("%02d:%02d:%02d", 
		    TimeUnit.MILLISECONDS.toHours(diff),
		    TimeUnit.MILLISECONDS.toMinutes(diff) - 
		    TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(diff)),
		    TimeUnit.MILLISECONDS.toSeconds(diff) - 
		    TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(diff)));
}
 
Example #3
Source File: InstanceAggregator.java    From rdf2x with Apache License 2.0 5 votes vote down vote up
private Object convertToSupportedValue(Object value) {
    if (value instanceof XSDDateTime) {
        // spark only accepts java.sql.Timestamp and assumes it uses the current JVM timezone
        // therefore this is not correct
        // return new Timestamp(((XSDDateTime)value).asCalendar().getTimeInMillis());
        // store the datetime as string instead
        return value.toString();
    }
    return value;
}
 
Example #4
Source File: BaseTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
protected BaseTestCaseResultImpl(Resource element, Resource testCaseUri, RLOGLevel severity, String message, XSDDateTime timestamp) {
    this.element = element;
    this.testCaseUri = testCaseUri;
    this.severity = severity;
    this.message = message;
    this.timestamp = timestamp;
}
 
Example #5
Source File: ShaclTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public ShaclTestCaseResultImpl(Resource element, Resource testCaseUri, RLOGLevel severity, String message, XSDDateTime timestamp, RDFNode focusNode, Set<PropertyValuePair> resultAnnotations) {
    super(element, testCaseUri, severity, message, timestamp, focusNode);
    this.resultAnnotations = ImmutableSet.copyOf(checkNotNull(resultAnnotations));
}
 
Example #6
Source File: AggregatedTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public AggregatedTestCaseResultImpl(Resource element, Resource testCaseUri, RLOGLevel severity, String message, XSDDateTime timestamp, TestCaseResultStatus status, long errorCount, long prevalenceCount) {
    super(element, testCaseUri, severity, message, timestamp, status);
    this.errorCount = errorCount;
    this.prevalenceCount = prevalenceCount;
}
 
Example #7
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public void setEndTime(XSDDateTime endTime) {
    this.endTime = endTime;
}
 
Example #8
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public void setStartTime(XSDDateTime startTime) {
    this.startTime = startTime;
}
 
Example #9
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public void setEndTime() {
    this.endTime = new XSDDateTime(Calendar.getInstance());
}
 
Example #10
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public XSDDateTime getEndTime() {
    return endTime;
}
 
Example #11
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public void setStartTime() {
    this.startTime = new XSDDateTime(Calendar.getInstance());
}
 
Example #12
Source File: DatasetOverviewResults.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public XSDDateTime getStartTime() {
    return startTime;
}
 
Example #13
Source File: ShaclLiteTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public ShaclLiteTestCaseResultImpl(Resource element, Resource testCaseUri, RLOGLevel severity, String message, XSDDateTime timestamp, RDFNode focusNode) {
    super(element, testCaseUri, severity, message, timestamp);
    this.focusNode = focusNode;
}
 
Example #14
Source File: StatusTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
public StatusTestCaseResultImpl(Resource element, Resource testCaseUri, RLOGLevel severity, String message, XSDDateTime timestamp, TestCaseResultStatus status) {
    super(element, testCaseUri, severity, message, timestamp);
    this.status = status;
}
 
Example #15
Source File: BaseTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
@Override
public XSDDateTime getTimestamp() {
    return timestamp;
}
 
Example #16
Source File: BaseTestCaseResultImpl.java    From RDFUnit with Apache License 2.0 4 votes vote down vote up
protected BaseTestCaseResultImpl(Resource testCaseUri, RLOGLevel severity, String message) {
    this(ResourceFactory.createResource(), testCaseUri, severity, message, new XSDDateTime(Calendar.getInstance()));
}
 
Example #17
Source File: TestCaseResult.java    From RDFUnit with Apache License 2.0 votes vote down vote up
XSDDateTime getTimestamp();