}
public void validate() throws D2RQException {
if (this.refersToClassMap != null) {
if (!this.refersToClassMap.database().equals(this.belongsToClassMap.database())) {
throw new D2RQException(toString() +
" links two d2rq:ClassMaps with different d2rq:dataStorages",
D2RQException.PROPERTYBRIDGE_CONFLICTING_DATABASES);
}
// TODO refersToClassMap cannot be combined w/ value constraints or translation tables
}
if (properties.isEmpty() && dynamicPropertyPatterns.isEmpty()) {
throw new D2RQException(toString() + " needs a d2rq:property or d2rq:dynamicProperty",
D2RQException.PROPERTYBRIDGE_MISSING_PREDICATESPEC);
}
assertHasPrimarySpec(new Property[]{
D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.bNodeIdColumns,
D2RQ.column, D2RQ.pattern, D2RQ.sqlExpression, D2RQ.uriSqlExpression, D2RQ.constantValue,
D2RQ.refersToClassMap
});
if (this.datatype != null && this.lang != null) {
throw new D2RQException(toString() + " has both d2rq:datatype and d2rq:lang",
D2RQException.PROPERTYBRIDGE_LANG_AND_DATATYPE);
}
if (this.datatype != null && this.column == null && this.pattern == null
&& this.sqlExpression == null) {
throw new D2RQException("d2rq:datatype can only be used with d2rq:column, d2rq:pattern " +
"or d2rq:sqlExpression at " + this,
D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_DATATYPE);
}
if (this.lang != null && this.column == null && this.pattern == null) {
throw new D2RQException("d2rq:lang can only be used with d2rq:column, d2rq:pattern " +
"or d2rq:sqlExpression at " + this,
D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_LANG);
}
}