1 | package org.biohackathon.SPARQLBuilder.OWL;
|
---|
2 |
|
---|
3 | import java.util.HashSet;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * 繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺ク縲√≠繧九>縺ッ繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺九i縺ョ1繧ケ繝�ャ繝励Μ繝ウ繧ッ繧定ィ倩ソー縺吶k
|
---|
7 | * @author Norio KOBAYASHI
|
---|
8 | * @since 28.01.2014
|
---|
9 | * @version 29.01.2014
|
---|
10 | */
|
---|
11 | public class InstanceLink {
|
---|
12 |
|
---|
13 | private String propertyURI = null;
|
---|
14 | private String[] linkedClassURIs = null;
|
---|
15 | private String linkedInstanceURI = null;
|
---|
16 | private Direction direction = null;
|
---|
17 |
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * 繝励Ο繝代ユ繧」URI縲√Μ繝ウ繧ッ蜈茨シ亥��峨う繝ウ繧ケ繧ソ繝ウ繧ケ縲√Μ繝ウ繧ッ縺ョ蜷代″繧剃ク弱∴繧区ァ区�蟄� |
---|
21 | * <BR>
|
---|
22 | * 繝ェ繝ウ繧ッ蜈�(蜈� 繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺ォ縺、縺�※縺ッ縲√◎繧後′螻槭@縺ヲ縺�k縺吶∋縺ヲ縺ョ繧ッ繝ゥ繧ケ繧ゆク弱∴繧� |
---|
23 | *
|
---|
24 | * @param propertyURI縲繝励Ο繝代ユ繧」縺ョURI
|
---|
25 | * @param linkedInstanceURI縲繝ェ繝ウ繧ッ縺ョ荳サ隱槭√√≠繧九>縺ッ繝ェ繝ウ繧ッ縺ョ逶ョ逧�ェ槭→縺ェ縺」縺ヲ縺�k繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺ョURI
|
---|
26 | * @param linkedClassURIs縲linkedInstanceURI縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺悟ア槭@縺ヲ縺�k縺吶∋縺ヲ縺ョ繧ッ繝ゥ繧ケ縺ョURI縺ョ驟榊�
|
---|
27 | * @param direction 繝励Ο繝代ユ繧」縺ョ蜷代″縲〕inkedClassURI縺ョ繧ッ繝ゥ繧ケ縺後Μ繝ウ繧ッ蜈医↓縺ェ縺」縺ヲ縺�k縺ィ縺阪�Direction.forward,繝ェ繝ウ繧ッ蜈�↓縺ェ縺」縺ヲ縺�k縺ィ縺阪�Direction.reverse, 縺昴l繧我ク。譁ケ縺ョ譎ゅ�Direction.both繧呈欠螳壹☆繧�
|
---|
28 | * @throws Exception
|
---|
29 | * @since 28.01.2014
|
---|
30 | */
|
---|
31 | public InstanceLink(String propertyURI, String linkedInstanceURI, String[] linkedClassURIs, Direction direction){
|
---|
32 | this.propertyURI = propertyURI;
|
---|
33 | this.linkedInstanceURI = linkedInstanceURI;
|
---|
34 | this.linkedClassURIs = linkedClassURIs;
|
---|
35 | this.direction = direction;
|
---|
36 | }
|
---|
37 |
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * linkedInstanceURI縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺悟ア槭@縺ヲ縺�k繧ッ繝ゥ繧ケ繧剃ク縺、霑ス蜉縺吶k
|
---|
41 | *
|
---|
42 | * @param classURI縲霑ス蜉縺吶klinkedInstanceURI縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ縺悟ア槭@縺ヲ縺�k繧ッ繝ゥ繧ケ縺ョURI
|
---|
43 | * @throws Exception
|
---|
44 | * @since 28.01.2014
|
---|
45 | */
|
---|
46 | public void addLinkedClassURI(String classURI){
|
---|
47 | if( linkedClassURIs == null || linkedClassURIs.length == 0 ){
|
---|
48 | linkedClassURIs = new String[]{classURI};
|
---|
49 | }else{
|
---|
50 | HashSet<String> hSet = new HashSet<String>();
|
---|
51 | for(String clsURI: linkedClassURIs){
|
---|
52 | hSet.add(clsURI);
|
---|
53 | }
|
---|
54 | hSet.add(classURI);
|
---|
55 | linkedClassURIs = hSet.toArray(new String[0]);
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * 譁�ュ怜�陦ィ險倥r蜿門セ励☆繧� |
---|
61 | *
|
---|
62 | * @since 28.01.2014
|
---|
63 | */
|
---|
64 | public String toString(){
|
---|
65 | StringBuffer sb = new StringBuffer();
|
---|
66 | sb.append(propertyURI);
|
---|
67 | if( direction == Direction.forward ){
|
---|
68 | sb.append(" --> ");
|
---|
69 | }else{
|
---|
70 | if( direction == Direction.reverse ){
|
---|
71 | sb.append(" <-- ");
|
---|
72 | }else{
|
---|
73 | sb.append(" <-> ");
|
---|
74 | }
|
---|
75 | }
|
---|
76 | sb.append(linkedInstanceURI);
|
---|
77 | sb.append(" rdf:type [");
|
---|
78 | if( linkedClassURIs != null ){
|
---|
79 | for( int i = 0; i < linkedClassURIs.length; i++ ) {
|
---|
80 | if( i != 0 ) {
|
---|
81 | sb.append(", ");
|
---|
82 | }
|
---|
83 | sb.append(linkedClassURIs[i]);
|
---|
84 | }
|
---|
85 | }
|
---|
86 | sb.append("]");
|
---|
87 | return sb.toString();
|
---|
88 | }
|
---|
89 |
|
---|
90 | public String getPropertyURI() {
|
---|
91 | return propertyURI;
|
---|
92 | }
|
---|
93 | public void setPropertyURI(String propertyURI) {
|
---|
94 | this.propertyURI = propertyURI;
|
---|
95 | }
|
---|
96 | public String[] getLinkedClassURIs() {
|
---|
97 | return linkedClassURIs;
|
---|
98 | }
|
---|
99 | public void setLinkedClassURIs(String[] linkedClassURIs) {
|
---|
100 | this.linkedClassURIs = linkedClassURIs;
|
---|
101 | }
|
---|
102 | public Direction getDirection() {
|
---|
103 | return direction;
|
---|
104 | }
|
---|
105 | public void setDirection(Direction direction) {
|
---|
106 | this.direction = direction;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public String getLinkedInstanceURI() {
|
---|
110 | return linkedInstanceURI;
|
---|
111 | }
|
---|
112 |
|
---|
113 | public void setLinkedInstanceURI(String linkedInstanceURI) {
|
---|
114 | this.linkedInstanceURI = linkedInstanceURI;
|
---|
115 | }
|
---|
116 |
|
---|
117 | // private String[] propertyDomainClassURIs = null;
|
---|
118 | // private String[] propertyRangeClassURIs = null;
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 | }
|
---|