Skip to content

Package: Constants

Constants

nameinstructionbranchcomplexitylinemethod
Constants()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
resolveVersion()
M: 11 C: 19
63%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 4
67%
M: 0 C: 1
100%
static {...}
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.owl2java;
19:
20: import cz.cvut.kbss.jopa.owl2java.exception.OWL2JavaException;
21:
22: import java.io.IOException;
23: import java.time.Duration;
24: import java.time.temporal.ChronoUnit;
25: import java.util.Properties;
26:
27: public class Constants {
28:
29: /**
30: * Annotation property marking IC axioms.
31: */
32: public static final String P_IS_INTEGRITY_CONSTRAINT_FOR =
33: "http://krizik.felk.cvut.cz/ontologies/2009/ic.owl#isIntegrityConstraintFor";
34:
35: /**
36: * Annotation property specifying the name of Java class mapped by the annotated ontological class.
37: */
38: public static final String P_CLASS_NAME = "http://krizik.felk.cvut.cz/ontologies/2009/ic.owl#javaClassName";
39:
40: /**
41: * Name of the class containing generated vocabulary.
42: */
43: public static final String VOCABULARY_CLASS = "Vocabulary";
44:
45: /**
46: * Package into which the model is generated.
47: */
48: public static final String MODEL_PACKAGE = "model";
49:
50: /**
51: * Java package name separator.
52: */
53: public static final char PACKAGE_SEPARATOR = '.';
54:
55: /**
56: * Default language for language-tagged literals.
57: */
58: public static final String LANGUAGE = "en";
59:
60: /**
61: * Name of the field representing entity identifier.
62: */
63: public static final String ID_FIELD_NAME = "id";
64:
65: /**
66: * Name of the field representing the {@link cz.cvut.kbss.jopa.vocabulary.RDFS#LABEL} property.
67: */
68: public static final String LABEL_FIELD_NAME = "name";
69:
70: /**
71: * Name of the field representing the {@link cz.cvut.kbss.jopa.vocabulary.DC.Terms#DESCRIPTION} property.
72: */
73: public static final String DESCRIPTION_FIELD_NAME = "description";
74:
75: /**
76: * Name of the field representing {@link cz.cvut.kbss.jopa.model.annotations.Types}.
77: */
78: public static final String TYPES_FIELD_NAME = "types";
79:
80: /**
81: * Name of the field representing {@link cz.cvut.kbss.jopa.model.annotations.Properties}.
82: */
83: public static final String PROPERTIES_FIELD_NAME = "properties";
84:
85: /**
86: * Timeout for resolving ontology prefix via a remote service.
87: */
88: public static final Duration PREFIX_RESOLVE_TIMEOUT = Duration.of(5, ChronoUnit.SECONDS);
89:
90: /**
91: * Tool version.
92: */
93: public static final String VERSION = resolveVersion();
94:
95:
96: private Constants() {
97: throw new AssertionError();
98: }
99:
100: private static String resolveVersion() {
101: final Properties properties = new Properties();
102: try {
103: properties.load(Constants.class.getClassLoader().getResourceAsStream("owl2java.properties"));
104:• assert properties.containsKey("cz.cvut.jopa.owl2java.version");
105: return properties.getProperty("cz.cvut.jopa.owl2java.version");
106: } catch (IOException e) {
107: throw new OWL2JavaException("Unable to load OWL2Java version from properties file.", e);
108: }
109: }
110: }