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