Merge branch 'develop' of ssh://dev.e-taxonomy.eu/var/git/cdmlib into develop
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / descriptive / owl / OwlUtil.java
1 /**
2 * Copyright (C) 2019 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.cdm.io.descriptive.owl;
10
11 import com.hp.hpl.jena.rdf.model.Model;
12 import com.hp.hpl.jena.rdf.model.ModelFactory;
13 import com.hp.hpl.jena.rdf.model.Property;
14
15 /**
16 * @author pplitzner
17 * @since Apr 15, 2019
18 *
19 */
20 public class OwlUtil {
21
22 public static final String BASE_URI = "http://cybertaxonomy.eu/";
23
24 /**
25 * resource URIs
26 */
27 public static final String RESOURCE_URI = BASE_URI+"resource/";
28 public static final String RESOURCE_NODE = RESOURCE_URI+"node/";
29 public static final String RESOURCE_REPRESENTATION = RESOURCE_URI+"representation/";
30 public static final String RESOURCE_SOURCE = RESOURCE_URI+"source/";
31 public static final String RESOURCE_REFERENCE = RESOURCE_URI+"reference/";
32 public static final String RESOURCE_FEATURE_TREE = RESOURCE_URI+"term_tree/";
33 public static final String RESOURCE_TERM_VOCABULARY = RESOURCE_URI+"term_vocabulary/";
34 public static final String RESOURCE_TERM = RESOURCE_URI+"term/";
35 public static final String RESOURCE_CHARACTER = RESOURCE_URI+"character/";
36 public static final String RESOURCE_MEDIA = RESOURCE_URI+"media/";
37
38 /**
39 * property URIs
40 */
41 public static final String PROPERTY_BASE_URI = BASE_URI+"property/";
42 public static final String PROPERTY_UUID = PROPERTY_BASE_URI+"uuid";
43 public static final String PROPERTY_URI = PROPERTY_BASE_URI+"uri";
44 public static final String PROPERTY_HAS_ROOT_NODE = PROPERTY_BASE_URI + "has_root_node";
45 public static final String PROPERTY_HAS_SUBSTRUCTURE = PROPERTY_BASE_URI+"has_sub_structure";
46 public static final String PROPERTY_HAS_REPRESENTATION = PROPERTY_BASE_URI+"has_representation";
47 public static final String PROPERTY_HAS_VOCABULARY = PROPERTY_BASE_URI+"has_vocabulary";
48 public static final String PROPERTY_HAS_TERM = PROPERTY_BASE_URI+"has_term";
49
50 public static final String PROPERTY_IS_A = PROPERTY_BASE_URI+"is_a";
51 public static final String PROPERTY_TYPE = PROPERTY_BASE_URI+"type";
52
53 /**
54 * representation properties
55 */
56 public static final String PROPERTY_LABEL = PROPERTY_BASE_URI+"label";
57 public static final String PROPERTY_LABEL_ABBREV = PROPERTY_BASE_URI+"label_abbrev";
58 public static final String PROPERTY_LABEL_PLURAL = PROPERTY_BASE_URI+"label_plural";
59 public static final String PROPERTY_DESCRIPTION = PROPERTY_BASE_URI+"description";
60 public static final String PROPERTY_LANGUAGE = PROPERTY_BASE_URI+"language";
61 public static final String PROPERTY_LANGUAGE_UUID = PROPERTY_BASE_URI+"language_uuid";
62
63 /**
64 * term properties
65 */
66 public static final String PROPERTY_TERM_INCLUDES = PROPERTY_BASE_URI+"term_includes";
67 public static final String PROPERTY_TERM_IS_GENERALIZATION_OF = PROPERTY_BASE_URI+"term_is_generalization_of";
68 public static final String PROPERTY_TERM_HAS_MEDIA = PROPERTY_BASE_URI+"term_has_media";
69 public static final String PROPERTY_TERM_HAS_SOURCE = PROPERTY_BASE_URI+"term_has_source";
70 public static final String PROPERTY_TERM_SYMBOL = PROPERTY_BASE_URI+"term_symbol";
71 public static final String PROPERTY_TERM_SYMBOL2 = PROPERTY_BASE_URI+"term_symbol2";
72 public static final String PROPERTY_TERM_ID_IN_VOCABULARY = PROPERTY_BASE_URI+"term_id_in_vocabulary";
73
74 /**
75 * feature properties
76 */
77 public static final String PROPERTY_FEATURE_IS_QUANTITATIVE = PROPERTY_BASE_URI+"feature_is_quantitative";
78 public static final String PROPERTY_FEATURE_IS_CATEGORICAL = PROPERTY_BASE_URI+"feature_is_categorical";
79 public static final String PROPERTY_FEATURE_HAS_RECOMMENDED_MEASUREMENT_UNIT = PROPERTY_BASE_URI+"feature_has_recommended_measurement_unit";
80 public static final String PROPERTY_FEATURE_HAS_RECOMMENDED_MODIFIER = PROPERTY_BASE_URI+"feature_has_recommended_modifier";
81 public static final String PROPERTY_FEATURE_HAS_RECOMMENDED_STATISTICAL_MEASURE = PROPERTY_BASE_URI+"feature_has_recommended_statistical_measure";
82 public static final String PROPERTY_FEATURE_HAS_SUPPORTED_CATEGORICAL_ENUMERATION = PROPERTY_BASE_URI+"feature_has_supported_categorical_enumeration";
83
84 /**
85 * character properties
86 */
87 public static final String PROPERTY_CHARACTER_HAS_STRUCTURE = PROPERTY_BASE_URI+"character_has_structure";
88 public static final String PROPERTY_CHARACTER_HAS_PROPERTY = PROPERTY_BASE_URI+"character_has_property";
89 public static final String PROPERTY_CHARACTER_HAS_STRUCTURE_MODIFIER = PROPERTY_BASE_URI+"character_has_structure_modifier";
90
91 /**
92 * media properties
93 */
94 public static final String PROPERTY_MEDIA_URI = PROPERTY_BASE_URI+"media_uri";
95 public static final String PROPERTY_MEDIA_TITLE = PROPERTY_BASE_URI+"media_title";
96
97 /**
98 * source properties
99 */
100 public static final String PROPERTY_SOURCE_TYPE = PROPERTY_BASE_URI+"source_type";
101 public static final String PROPERTY_SOURCE_ID_IN_SOURCE = PROPERTY_BASE_URI+"source_id_in_source";
102 public static final String PROPERTY_SOURCE_HAS_CITATION = PROPERTY_BASE_URI+"source_has_citation";
103
104 /**
105 * reference properties
106 */
107 public static final String PROPERTY_REFERENCE_TITLE = PROPERTY_BASE_URI+"reference_title";
108
109 /**
110 * types
111 */
112 public final static String NODE = "node";
113 public final static String TREE = "tree";
114 public final static String VOCABULARY = "vocabulary";
115 public final static String TERM = "term";
116 public final static String CHARACTER = "character";
117 public final static String FEATURE = "feature";
118 public final static String MEDIA = "media";
119
120 public static Property propHasSubStructure;
121 public static Property propHasRepresentation;
122 public static Property propHasRootNode;
123 public static Property propUuid;
124 public static Property propUri;
125 public static Property propLabel;
126 public static Property propLabelAbbrev;
127 public static Property propLabelPlural;
128 public static Property propLanguage;
129 public static Property propLanguageUuid;
130 public static Property propIsA;
131 public static Property propType;
132 public static Property propDescription;
133
134 public static Property propHasVocabulary;
135 public static Property propHasTerm;
136
137 public static Property propTermIsGeneralizationOf;
138 public static Property propTermIncludes;
139 public static Property propTermHasMedia;
140 public static Property propTermHasSource;
141 public static Property propTermSymbol;
142 public static Property propTermSymbol2;
143 public static Property propTermIdInVocabulary;
144
145 public static Property propFeatureIsQuantitative;
146 public static Property propFeatureIsCategorical;
147 public static Property propFeatureHasRecommendedMeasurementUnit;
148 public static Property propFeatureHasRecommendedModifierEnumeration;
149 public static Property propFeatureHasRecommendedStatisticalMeasure;
150 public static Property propFeatureHasSupportedCategoricalEnumeration;
151
152 public static Property propCharacterHasStructure;
153 public static Property propCharacterHasProperty;
154 public static Property propCharacterHasStructureModfier;
155
156 public static Property propMediaUri;
157 public static Property propMediaTitle;
158
159 public static Property propSourceType;
160 public static Property propSourceIdInSource;
161 public static Property propSourceHasCitation;
162
163 public static Property propReferenceTitle;
164
165 public static Model createModel(){
166 Model model = ModelFactory.createDefaultModel();
167
168 propHasSubStructure = model.createProperty(OwlUtil.PROPERTY_HAS_SUBSTRUCTURE);
169 propHasRepresentation = model.createProperty(OwlUtil.PROPERTY_HAS_REPRESENTATION);
170 propHasRootNode = model.createProperty(OwlUtil.PROPERTY_HAS_ROOT_NODE);
171 propUuid = model.createProperty(OwlUtil.PROPERTY_UUID);
172 propUri = model.createProperty(OwlUtil.PROPERTY_URI);
173 propLabel = model.createProperty(OwlUtil.PROPERTY_LABEL);
174 propLabelAbbrev = model.createProperty(OwlUtil.PROPERTY_LABEL_ABBREV);
175 propLabelPlural = model.createProperty(OwlUtil.PROPERTY_LABEL_PLURAL);
176 propLanguage = model.createProperty(OwlUtil.PROPERTY_LANGUAGE);
177 propLanguageUuid = model.createProperty(OwlUtil.PROPERTY_LANGUAGE_UUID);
178 propIsA = model.createProperty(OwlUtil.PROPERTY_IS_A);
179 propType = model.createProperty(OwlUtil.PROPERTY_TYPE);
180 propDescription = model.createProperty(OwlUtil.PROPERTY_DESCRIPTION);
181
182 propHasVocabulary = model.createProperty(OwlUtil.PROPERTY_HAS_VOCABULARY);
183 propHasTerm = model.createProperty(OwlUtil.PROPERTY_HAS_TERM);
184
185 // term
186 propTermIsGeneralizationOf = model.createProperty(OwlUtil.PROPERTY_TERM_IS_GENERALIZATION_OF);
187 propTermIncludes = model.createProperty(OwlUtil.PROPERTY_TERM_INCLUDES);
188 propTermHasMedia = model.createProperty(OwlUtil.PROPERTY_TERM_HAS_MEDIA);
189 propTermHasSource = model.createProperty(OwlUtil.PROPERTY_TERM_HAS_SOURCE);
190 propTermSymbol = model.createProperty(OwlUtil.PROPERTY_TERM_SYMBOL);
191 propTermSymbol2 = model.createProperty(OwlUtil.PROPERTY_TERM_SYMBOL2);
192 propTermIdInVocabulary = model.createProperty(OwlUtil.PROPERTY_TERM_ID_IN_VOCABULARY);
193
194 // feature
195 propFeatureIsQuantitative = model.createProperty(OwlUtil.PROPERTY_FEATURE_IS_QUANTITATIVE);
196 propFeatureIsCategorical = model.createProperty(OwlUtil.PROPERTY_FEATURE_IS_CATEGORICAL);
197 propFeatureHasRecommendedMeasurementUnit = model.createProperty(OwlUtil.PROPERTY_FEATURE_HAS_RECOMMENDED_MEASUREMENT_UNIT);
198 propFeatureHasRecommendedModifierEnumeration = model.createProperty(OwlUtil.PROPERTY_FEATURE_HAS_RECOMMENDED_MODIFIER);
199 propFeatureHasRecommendedStatisticalMeasure = model.createProperty(OwlUtil.PROPERTY_FEATURE_HAS_RECOMMENDED_STATISTICAL_MEASURE);
200 propFeatureHasSupportedCategoricalEnumeration = model.createProperty(OwlUtil.PROPERTY_FEATURE_HAS_SUPPORTED_CATEGORICAL_ENUMERATION);
201
202 // character
203 propCharacterHasStructure = model.createProperty(OwlUtil.PROPERTY_CHARACTER_HAS_STRUCTURE);
204 propCharacterHasProperty = model.createProperty(OwlUtil.PROPERTY_CHARACTER_HAS_PROPERTY);
205 propCharacterHasStructureModfier = model.createProperty(OwlUtil.PROPERTY_CHARACTER_HAS_STRUCTURE_MODIFIER);
206
207 // media
208 propMediaUri = model.createProperty(OwlUtil.PROPERTY_MEDIA_URI);
209 propMediaTitle = model.createProperty(OwlUtil.PROPERTY_MEDIA_TITLE);
210
211 // source
212 propSourceType = model.createProperty(OwlUtil.PROPERTY_SOURCE_TYPE);
213 propSourceIdInSource = model.createProperty(OwlUtil.PROPERTY_SOURCE_ID_IN_SOURCE);
214 propSourceHasCitation = model.createProperty(OwlUtil.PROPERTY_SOURCE_HAS_CITATION);
215
216 // reference
217 propReferenceTitle = model.createProperty(OwlUtil.PROPERTY_REFERENCE_TITLE);
218
219 return model;
220 }
221
222 }