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