Revision 44900
Added by Claudio Atzori over 7 years ago
DNGFDecoder.java | ||
---|---|---|
12 | 12 |
import eu.dnetlib.data.proto.DNGFProtos.DNGF; |
13 | 13 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFEntity; |
14 | 14 |
import eu.dnetlib.data.proto.DNGFProtos.DNGFRel; |
15 |
import eu.dnetlib.data.proto.FieldTypeProtos.Qualifier; |
|
15 | 16 |
import eu.dnetlib.data.proto.KindProtos.Kind; |
16 | 17 |
import eu.dnetlib.data.proto.RelTypeProtos.RelType; |
17 | 18 |
|
... | ... | |
116 | 117 |
return decodeRel().getRel(); |
117 | 118 |
} |
118 | 119 |
|
119 |
public RelType relType() {
|
|
120 |
public Qualifier relType() {
|
|
120 | 121 |
return decodeRel().getRelType(); |
121 | 122 |
} |
122 | 123 |
|
... | ... | |
132 | 133 |
return decodeRel().getRelTargetId(); |
133 | 134 |
} |
134 | 135 |
|
135 |
public String getCFQ() { |
|
136 |
switch (getKind()) { |
|
137 |
case entity: |
|
138 |
return getEntity().getType().toString(); |
|
139 |
case relation: |
|
140 |
return decodeRel().getCFQ(); |
|
141 |
default: |
|
142 |
throw new IllegalArgumentException("Invalid Kind: " + getKind()); |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
public RelDescriptor getRelDescriptor() { |
|
147 |
if (!getKind().equals(Kind.relation)) return null; |
|
148 |
return decodeRel().getRelDescriptor(); |
|
149 |
} |
|
150 |
|
|
151 | 136 |
private DNGFRelDecoder decodeRel() { |
152 | 137 |
if (relDecoder == null) { |
153 | 138 |
relDecoder = DNGFRelDecoder.decode(getDNGFRel()); |
Also available in: Unified diff
1st attempt to simplify the proto model