View Javadoc
1   /*
2    * Copyright 2013-2023 Medical Information Systems Research Group (https://medical.zcu.cz),
3    * Department of Computer Science and Engineering, University of West Bohemia.
4    * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5    *
6    * This file is part of Sparkle project.
7    *
8    * Sparkle is free software: you can redistribute it and/or modify
9    * it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License.
11   *
12   * Sparkle is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with Sparkle. If not, see <http://www.gnu.org/licenses/>.
19   */
20  package cz.zcu.mre.sparkle.tools.sparqlParser;
21  
22  import cz.zcu.mre.sparkle.gui.query.helpers.FieldType;
23  
24  /**
25   * Class contains design pattern "Messenger" corresponding to SPARQL triple
26   * (it's used during query loading from text file).
27   *
28   * @author Josef Kazak
29   * @author Petr Vcelak (vcelak@kiv.zcu.cz)
30   */
31  public class SparqlParserTriple {
32  
33      private final String subject;
34      private final String predicate;
35      private final String object;
36      private final FieldType subjectFieldType;
37      private final FieldType predicateFieldType;
38      private final FieldType objectFieldType;
39      private final boolean isSubTriple;
40      private final String literalLang;
41      private final String literalDataType;
42  
43      public SparqlParserTriple(final String subject, final String predicate, final String object,
44              final FieldType subjectFieldType, final FieldType predicateFieldType, final FieldType objectFieldType,
45              final boolean isSubTriple, final String literalLang, final String literalDataType) {
46          this.subject = subject;
47          this.predicate = predicate;
48          this.object = object;
49          this.subjectFieldType = subjectFieldType;
50          this.predicateFieldType = predicateFieldType;
51          this.objectFieldType = objectFieldType;
52          this.isSubTriple = isSubTriple;
53          if (literalLang != null) {
54              this.literalLang = literalLang;
55          } else {
56              this.literalLang = null;
57          }
58          if (literalDataType != null) {
59              this.literalDataType = literalDataType;
60          } else {
61              this.literalDataType = null;
62          }
63      }
64  
65      public String getSubject() {
66          return this.subject;
67      }
68  
69      public FieldType getSubjectFieldType() {
70          return this.subjectFieldType;
71      }
72  
73      public String getPredicate() {
74          return this.predicate;
75      }
76  
77      public FieldType getPredicateFieldType() {
78          return this.predicateFieldType;
79      }
80  
81      public String getObject() {
82          return this.object;
83      }
84  
85      public FieldType getObjectFieldType() {
86          return this.objectFieldType;
87      }
88  
89      public boolean isSubTriple() {
90          return this.isSubTriple;
91      }
92  
93      public String getLiteralLang() {
94          return this.literalLang;
95      }
96  
97      public String getLiteralDataType() {
98          return this.literalDataType;
99      }
100 }