Skip to content

Package: OWLAnnotationProperty

OWLAnnotationProperty

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.model.annotations;
19:
20: import cz.cvut.kbss.jopa.model.annotations.util.Property;
21:
22: import java.lang.annotation.Documented;
23: import java.lang.annotation.ElementType;
24: import java.lang.annotation.Retention;
25: import java.lang.annotation.RetentionPolicy;
26: import java.lang.annotation.Target;
27:
28: /**
29: * Marks an attribute mapped to an OWL annotation property.
30: * <p>
31: * This means that the attribute can contain a literal or a reference to another object.
32: */
33: @Documented
34: @Property
35: @Retention(RetentionPolicy.RUNTIME)
36: @Target({ElementType.FIELD,ElementType.METHOD})
37: public @interface OWLAnnotationProperty {
38: /**
39: * IRI of the annotation property
40: *
41: * @return IRI of the annotation property
42: */
43: String iri();
44:
45: /**
46: * (Optional) Whether the association should be lazily loaded or must be eagerly fetched.
47: *
48: * @return Fetch type of this property
49: */
50: FetchType fetch() default FetchType.EAGER;
51:
52: /**
53: * (Optional) Marks an attribute whose value is a lexical form of a literal value.
54: * <p>
55: * This parameter should be used on {@code String} attributes, as literal lexical form is always a string. Lexical
56: * form of a literal of any datatype can be loaded. Saving the lexical form is forbidden to prevent unintentional
57: * change of the data type, unless {@link #datatype()} is explicitly specified.
58: * <p>
59: * Note that if the value being loaded is an identifier, it will still be loaded, because it is not a literal and
60: * {@code String} is a valid identifier mapping type.
61: */
62: boolean lexicalForm() default false;
63:
64: /**
65: * (Optional) Whether the value should be stored as a <a href="https://www.w3.org/TR/rdf11-concepts/">simple
66: * literal</a>, i.e. {@code xsd:string}.
67: * <p>
68: * Note that if the value being loaded is an identifier, it will still be loaded, because it is not a literal and
69: * {@code String} is a valid identifier mapping type. However, updates will replace the original with a {@code
70: * xsd:string} value.
71: *
72: * @return Whether the mapped value is a simple literal
73: */
74: boolean simpleLiteral() default false;
75:
76: /**
77: * IRI of the datatype to use when storing values of this property.
78: * <p>
79: * If specified, the value of the attribute is treated as the lexical form of the literal (and should be a {@code String}).
80: *
81: * @return Datatype IRI
82: */
83: String datatype() default "";
84: }