public class PropertyInfo {
public final Resource predicate;
public final String name;
+ public final boolean isImmutable;
public final boolean isHasProperty;
public final boolean isFunctional;
public final Set<String> classifications;
public final Map<String,Pair<Resource, ChildReference>> subliteralPredicates;
public final ValueAccessor valueAccessor;
public final boolean hasEnumerationRange;
- public PropertyInfo(Resource predicate, String name, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Binding defaultBinding, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) {
+ public PropertyInfo(Resource predicate, String name, boolean isImmutable, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Binding defaultBinding, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) {
this.predicate = predicate;
this.name = name;
+ this.isImmutable = isImmutable;
this.isFunctional = isFunctional;
this.isHasProperty = isHasProperty;
this.classifications = classifications;
this.hasEnumerationRange = hasEnumerationRange;
}
public static PropertyInfo make(ReadGraph graph, Resource predicate, String name, boolean isFunctional, boolean isHasProperty, Set<String> classifications, VariableBuilder builder, Resource literalRange, Datatype requiredDatatype, String definedUnit, String requiredValueType, Map<String,Pair<Resource, ChildReference>> subliteralPredicates, ValueAccessor valueAccessor, boolean hasEnumerationRange) throws DatabaseException {
-
Layer0 L0 = Layer0.getInstance(graph);
if(literalRange != null) {
Collection<Resource> dts = graph.getAssertedObjects(literalRange, L0.HasDataType);
if(requiredDatatype == null) requiredDatatype = dt;
}
}
-
Binding defaultBinding = requiredDatatype != null ? Bindings.getBinding(requiredDatatype) : null;
-
- return new PropertyInfo(predicate, name, isFunctional, isHasProperty, classifications, builder, literalRange, requiredDatatype, definedUnit, requiredValueType, defaultBinding, subliteralPredicates, valueAccessor, hasEnumerationRange);
-
+ return new PropertyInfo(predicate, name, graph.isImmutable(predicate), isFunctional, isHasProperty, classifications, builder, literalRange, requiredDatatype, definedUnit, requiredValueType, defaultBinding, subliteralPredicates, valueAccessor, hasEnumerationRange);
}
public boolean hasClassification(String classification) {
return classifications.contains(classification);
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((builder == null) ? 0 : builder.hashCode());
- result = prime * result + ((classifications == null) ? 0 : classifications.hashCode());
- result = prime * result + ((defaultBinding == null) ? 0 : defaultBinding.hashCode());
- result = prime * result + ((definedUnit == null) ? 0 : definedUnit.hashCode());
- result = prime * result + (hasEnumerationRange ? 1231 : 1237);
- result = prime * result + (isFunctional ? 1231 : 1237);
- result = prime * result + (isHasProperty ? 1231 : 1237);
- result = prime * result + ((literalRange == null) ? 0 : literalRange.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((predicate == null) ? 0 : predicate.hashCode());
- result = prime * result + ((requiredDatatype == null) ? 0 : requiredDatatype.hashCode());
- result = prime * result + ((requiredValueType == null) ? 0 : requiredValueType.hashCode());
- result = prime * result + ((subliteralPredicates == null) ? 0 : subliteralPredicates.hashCode());
- result = prime * result + ((valueAccessor == null) ? 0 : valueAccessor.hashCode());
+ if(!isImmutable) {
+ result = prime * result + ((builder == null) ? 0 : builder.hashCode());
+ result = prime * result + ((classifications == null) ? 0 : classifications.hashCode());
+ result = prime * result + ((defaultBinding == null) ? 0 : defaultBinding.hashCode());
+ result = prime * result + ((definedUnit == null) ? 0 : definedUnit.hashCode());
+ result = prime * result + (hasEnumerationRange ? 1231 : 1237);
+ result = prime * result + (isFunctional ? 1231 : 1237);
+ result = prime * result + (isHasProperty ? 1231 : 1237);
+ result = prime * result + ((literalRange == null) ? 0 : literalRange.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((requiredDatatype == null) ? 0 : requiredDatatype.hashCode());
+ result = prime * result + ((requiredValueType == null) ? 0 : requiredValueType.hashCode());
+ result = prime * result + ((subliteralPredicates == null) ? 0 : subliteralPredicates.hashCode());
+ result = prime * result + ((valueAccessor == null) ? 0 : valueAccessor.hashCode());
+ }
return result;
}
@Override
if (getClass() != obj.getClass())
return false;
PropertyInfo other = (PropertyInfo) obj;
+ if (predicate == null) {
+ if (other.predicate != null)
+ return false;
+ } else if (!predicate.equals(other.predicate))
+ return false;
+ if(isImmutable)
+ return true;
if (builder == null) {
if (other.builder != null)
return false;
return false;
} else if (!name.equals(other.name))
return false;
- if (predicate == null) {
- if (other.predicate != null)
- return false;
- } else if (!predicate.equals(other.predicate))
- return false;
if (requiredDatatype == null) {
if (other.requiredDatatype != null)
return false;