1 | package org.biohackathon.SPARQLBuilder.OWL;
|
---|
2 |
|
---|
3 | import org.json.JSONException;
|
---|
4 | import org.json.JSONObject;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * 繧ッ繝ゥ繧ケ縺ク縲√≠繧九>縺ッ繧ッ繝ゥ繧ケ縺九i縺ョ1繧ケ繝�ャ繝励Μ繝ウ繧ッ繧定ィ倩ソー縺吶k
|
---|
8 | * @author Norio KOBAYASHI
|
---|
9 | * @since 28.01.2014
|
---|
10 | * @version 29.01.2014
|
---|
11 | */
|
---|
12 | public class ClassLink {
|
---|
13 |
|
---|
14 | private String propertyURI = null;
|
---|
15 | private String linkedClassURI = null;
|
---|
16 | private String linkedLiteralDatatypeURI = null;
|
---|
17 | private Direction direction = null;
|
---|
18 | private int numOfLinks = 0;
|
---|
19 | private int numOfLinkedInstances = 0;
|
---|
20 | private int numOfOriginInstances = 0;
|
---|
21 | private int numOfOriginClassInstances = 0;
|
---|
22 | private int numOfLinkedClassInstances = 0;
|
---|
23 | private boolean domainClassLimitedQ = false;
|
---|
24 | private boolean rangeClassLimitedQ = false;
|
---|
25 |
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * 繝励Ο繝代ユ繧」URI縲√Μ繝ウ繧ッ蜈茨シ亥��峨け繝ゥ繧ケ縲√Μ繝ウ繧ッ縺ョ蜷代″繧剃ク弱∴繧区ァ区�蟄� |
---|
29 | *
|
---|
30 | * @param propertyURI縲繝励Ο繝代ユ繧」縺ョURI
|
---|
31 | * @param linkedClassURI縲繝ェ繝ウ繧ッ縺ョ荳サ隱槭√√≠繧九>縺ッ繝ェ繝ウ繧ッ縺ョ逶ョ逧�ェ槭→縺ェ縺」縺ヲ縺�k繧ッ繝ゥ繧ケ縺ョURI
|
---|
32 | * @param direction 繝励Ο繝代ユ繧」縺ョ蜷代″縲〕inkedClassURI縺ョ繧ッ繝ゥ繧ケ縺後Μ繝ウ繧ッ蜈医↓縺ェ縺」縺ヲ縺�k縺ィ縺阪�Direction.forward,繝ェ繝ウ繧ッ蜈�↓縺ェ縺」縺ヲ縺�k縺ィ縺阪�Direction.reverse, 縺昴l繧我ク。譁ケ縺ョ譎ゅ�Direction.both繧呈欠螳壹☆繧�
|
---|
33 | * @param numOfLinks 蠖楢ゥイ繝励Ο繝代ユ繧」縺ァ荳。遶ッ繧ッ繝ゥ繧ケ縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ蜷悟」ォ繧偵▽縺ェ縺�〒縺�k繝ェ繝ウ繧ッ謨ー�医ヨ繝ェ繝励Ν謨ー�� |
---|
34 | * @throws Exception
|
---|
35 | * @since 28.01.2014
|
---|
36 | */
|
---|
37 | public ClassLink(String propertyURI, String linkedClassURI, String linkedLiteralDatatypeURI, Direction direction,
|
---|
38 | int numLinks, int numOfOriginInstances, int numOfLinkedInstances,
|
---|
39 | int numOfOriginClassInstances, int numofLinkedClassInstances,
|
---|
40 | boolean domainClassLimitedQ, boolean rangeClassLimitedQ){
|
---|
41 | this.propertyURI = propertyURI;
|
---|
42 | this.linkedClassURI = linkedClassURI;
|
---|
43 | this.linkedLiteralDatatypeURI = linkedLiteralDatatypeURI;
|
---|
44 | this.direction = direction;
|
---|
45 | this.numOfLinks = numLinks;
|
---|
46 | this.numOfLinkedInstances = numOfLinkedInstances;
|
---|
47 | this.numOfOriginInstances = numOfOriginInstances;
|
---|
48 | this.numOfOriginClassInstances = numOfOriginClassInstances;
|
---|
49 | this.numOfLinkedClassInstances = numofLinkedClassInstances;
|
---|
50 | this.domainClassLimitedQ = domainClassLimitedQ;
|
---|
51 | this.rangeClassLimitedQ = rangeClassLimitedQ;
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | public JSONObject toJSON() throws JSONException{
|
---|
56 | JSONObject obj = new JSONObject();
|
---|
57 | if( propertyURI != null ) {
|
---|
58 | obj.put("propertyURI", propertyURI);
|
---|
59 | }
|
---|
60 | if( linkedClassURI != null ){
|
---|
61 | obj.put("linkedClassURI", linkedClassURI);
|
---|
62 | }
|
---|
63 | if( linkedLiteralDatatypeURI != null ){
|
---|
64 | obj.put("linkedLiteralDatatypeURI", linkedLiteralDatatypeURI);
|
---|
65 | }
|
---|
66 | obj.put("numOfLinks", numOfLinks);
|
---|
67 | obj.put("numOfLinkedInstances", numOfLinkedInstances);
|
---|
68 | obj.put("numOfOriginInstances", numOfOriginInstances);
|
---|
69 | obj.put("numOfOriginClassInstances", numOfOriginClassInstances);
|
---|
70 | obj.put("numOfLinkedClassInstances", numOfLinkedClassInstances);
|
---|
71 | return obj;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public String toJSONString2() {
|
---|
75 | String json_str ="{";
|
---|
76 |
|
---|
77 | if( propertyURI != null ) {
|
---|
78 | json_str+="\"propertyURI\":"+"\""+propertyURI+"\",";
|
---|
79 | }
|
---|
80 | else{
|
---|
81 | json_str+="\"propertyURI\":"+"\"propertyURI\",";
|
---|
82 | }
|
---|
83 | if( linkedClassURI != null ){
|
---|
84 | json_str+="\"linkedClassURI\":"+"\""+linkedClassURI+"\",";
|
---|
85 | }
|
---|
86 | else{
|
---|
87 | json_str+="\"linkedClassURI\":"+"\"linkedClassURI\",";
|
---|
88 | }
|
---|
89 | if( linkedLiteralDatatypeURI != null ){
|
---|
90 | json_str+="\"linkedLiteralDatatypeURI\":"+"\""+linkedLiteralDatatypeURI+"\"";
|
---|
91 | }
|
---|
92 | else{
|
---|
93 | json_str+="\"linkedLiteralDatatypeURI\":"+"\"linkedLiteralDatatypeURI\"";
|
---|
94 | }
|
---|
95 |
|
---|
96 | //json_str+="\"numOfLinks\":"+"\""+numOfLinks+"\",";
|
---|
97 | //json_str+="\"numOfLinkedInstances\":"+"\""+numOfLinkedInstances+"\",";
|
---|
98 | //json_str+="\"numOfOriginInstances\":"+"\""+numOfOriginInstances+"\",";
|
---|
99 | //json_str+="\"numOfOriginClassInstances\":"+"\""+numOfOriginClassInstances+"\",";
|
---|
100 | //json_str+="\"numOfLinkedClassInstances\":"+"\""+numOfLinkedClassInstances+"\"";
|
---|
101 |
|
---|
102 | json_str+="}";
|
---|
103 |
|
---|
104 | return json_str;
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | public int getNumOfLinks() {
|
---|
109 | return numOfLinks;
|
---|
110 | }
|
---|
111 |
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|
115 | public void setNumOfLinks(int numOfLinks) {
|
---|
116 | this.numOfLinks = numOfLinks;
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * 譁�ュ怜�陦ィ險倥r蜿門セ励☆繧� |
---|
124 | *
|
---|
125 | * @since 28.01.2014
|
---|
126 | */
|
---|
127 | public String toString(){
|
---|
128 | StringBuffer sb = new StringBuffer();
|
---|
129 | sb.append(propertyURI);
|
---|
130 | if( direction == Direction.forward ){
|
---|
131 | sb.append(" --> ");
|
---|
132 | }else{
|
---|
133 | if( direction == Direction.reverse ){
|
---|
134 | sb.append(" <-- ");
|
---|
135 | }else{
|
---|
136 | sb.append(" <-> ");
|
---|
137 | }
|
---|
138 | }
|
---|
139 | sb.append(linkedClassURI);
|
---|
140 | sb.append(" [");
|
---|
141 | sb.append(numOfOriginClassInstances);
|
---|
142 | sb.append("/");
|
---|
143 | sb.append(numOfOriginInstances);
|
---|
144 | sb.append("]縲---");
|
---|
145 |
|
---|
146 |
|
---|
147 | sb.append(" [");
|
---|
148 | sb.append(numOfLinks);
|
---|
149 | sb.append("] --->");
|
---|
150 |
|
---|
151 | sb.append(" [");
|
---|
152 | sb.append(numOfLinkedClassInstances);
|
---|
153 | sb.append("/");
|
---|
154 | sb.append(numOfLinkedInstances);
|
---|
155 | sb.append("]");
|
---|
156 | return sb.toString();
|
---|
157 | }
|
---|
158 |
|
---|
159 | public String getPropertyURI() {
|
---|
160 | return propertyURI;
|
---|
161 | }
|
---|
162 | public void setPropertyURI(String propertyURI) {
|
---|
163 | this.propertyURI = propertyURI;
|
---|
164 | }
|
---|
165 | public String getLinkedClassURI() {
|
---|
166 | return linkedClassURI;
|
---|
167 | }
|
---|
168 | public void setLinkedClassURI(String linkedClassURI) {
|
---|
169 | this.linkedClassURI = linkedClassURI;
|
---|
170 | }
|
---|
171 | public Direction getDirection() {
|
---|
172 | return direction;
|
---|
173 | }
|
---|
174 | public void setDirection(Direction direction) {
|
---|
175 | this.direction = direction;
|
---|
176 | }
|
---|
177 |
|
---|
178 | public final int getNumOfLinkedInstances() {
|
---|
179 | return numOfLinkedInstances;
|
---|
180 | }
|
---|
181 |
|
---|
182 | public final void setNumOfLinkedInstances(int numOfLinkedInstances) {
|
---|
183 | this.numOfLinkedInstances = numOfLinkedInstances;
|
---|
184 | }
|
---|
185 |
|
---|
186 |
|
---|
187 |
|
---|
188 |
|
---|
189 | public final boolean isDomainClassLimitedQ() {
|
---|
190 | return domainClassLimitedQ;
|
---|
191 | }
|
---|
192 |
|
---|
193 |
|
---|
194 | public final boolean isRangeClassLimitedQ() {
|
---|
195 | return rangeClassLimitedQ;
|
---|
196 | }
|
---|
197 |
|
---|
198 |
|
---|
199 | public final int getNumOfOriginInstances() {
|
---|
200 | return numOfOriginInstances;
|
---|
201 | }
|
---|
202 |
|
---|
203 |
|
---|
204 | public final void setNumOfOriginInstances(int numOfOriginInstances) {
|
---|
205 | this.numOfOriginInstances = numOfOriginInstances;
|
---|
206 | }
|
---|
207 |
|
---|
208 |
|
---|
209 | public final int getNumOfOriginClassInstances() {
|
---|
210 | return numOfOriginClassInstances;
|
---|
211 | }
|
---|
212 |
|
---|
213 |
|
---|
214 | public final void setNumOfOriginClassInstances(int numOfOriginClassInstances) {
|
---|
215 | this.numOfOriginClassInstances = numOfOriginClassInstances;
|
---|
216 | }
|
---|
217 |
|
---|
218 |
|
---|
219 | public final int getNumOfLinkedClassInstances() {
|
---|
220 | return numOfLinkedClassInstances;
|
---|
221 | }
|
---|
222 |
|
---|
223 |
|
---|
224 | public final void setNumOfLinkedClassInstances(int numOfLinkedClassInstances) {
|
---|
225 | this.numOfLinkedClassInstances = numOfLinkedClassInstances;
|
---|
226 | }
|
---|
227 |
|
---|
228 |
|
---|
229 | public final String getLinkedLiteralDatatypeURI() {
|
---|
230 | return linkedLiteralDatatypeURI;
|
---|
231 | }
|
---|
232 |
|
---|
233 |
|
---|
234 | public final void setLinkedLiteralDatatypeURI(String linkedLiteralDatatypeURI) {
|
---|
235 | this.linkedLiteralDatatypeURI = linkedLiteralDatatypeURI;
|
---|
236 | }
|
---|
237 |
|
---|
238 |
|
---|
239 | public final void setDomainClassLimitedQ(boolean domainClassLimitedQ) {
|
---|
240 | this.domainClassLimitedQ = domainClassLimitedQ;
|
---|
241 | }
|
---|
242 |
|
---|
243 |
|
---|
244 | public final void setRangeClassLimitedQ(boolean rangeClassLimitedQ) {
|
---|
245 | this.rangeClassLimitedQ = rangeClassLimitedQ;
|
---|
246 | }
|
---|
247 |
|
---|
248 |
|
---|
249 |
|
---|
250 | // private String[] propertyDomainClassURIs = null;
|
---|
251 | // private String[] propertyRangeClassURIs = null;
|
---|
252 |
|
---|
253 |
|
---|
254 |
|
---|
255 | }
|
---|