1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.deri.wsmo4j.validator;
17
18 import org.omwg.ontology.Attribute;
19 import org.wsmo.common.*;
20 import org.wsmo.validator.AttributeError;
21
22 public class AttributeErrorImpl extends ValidationErrorImpl implements AttributeError {
23
24 private Attribute attribute = null;
25
26
27 public AttributeErrorImpl(Entity entity, Attribute attribute, String reason, String variant) {
28 super(entity, reason, variant);
29 this.attribute = attribute;
30 }
31
32
33
34
35
36
37 public Attribute getAttribute() {
38 return attribute;
39 }
40
41
42
43
44
45
46 public String toString() {
47 String id = "<Identifier>";
48
49
50 if (getEntity() != null) {
51 id = getEntity().getIdentifier().toString();
52 if (getEntity().getIdentifier()instanceof IRI) {
53 id = ((IRI)getEntity().getIdentifier()).getLocalName();
54 }
55 }
56
57 String shortVariant = getViolatesVariant();
58 if (getViolatesVariant().lastIndexOf('/') != -1) {
59 shortVariant = getViolatesVariant().substring(getViolatesVariant().lastIndexOf('/') + 1);
60 }
61 return id + ":\n" + getReason() + "\n(violated variant: " +
62 shortVariant + ")";
63 }
64
65 }