From dded34cea560a10dd2f4f0a14f9a3c1ae642edf6 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Wed, 28 Aug 2019 13:57:43 +0200 Subject: [PATCH 01/26] feat: Add time value type (ongoing). --- knora-ontologies/knora-base.ttl | 31 +- .../org/knora/webapi/OntologyConstants.scala | 11 + .../valuemessages/ValueMessagesV1.scala | 54 +- .../valuemessages/ValueMessagesV2.scala | 1295 +++++++++-------- .../webapi/responders/v1/ValueUtilV1.scala | 17 +- 5 files changed, 808 insertions(+), 600 deletions(-) diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index c6005e648d..8d4192e693 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -1512,6 +1512,18 @@ +### http://www.knora.org/ontology/knora-base#valueHasIntervalStart + +:valueHasTimeStamp rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :TimeBase ; + + :objectDatatypeConstraint xsd:dateTime . + + + ### http://www.knora.org/ontology/knora-base#valueHasListNode :valueHasListNode rdf:type owl:ObjectProperty ; @@ -1523,7 +1535,6 @@ :objectClassConstraint :ListNode . - ### http://www.knora.org/ontology/knora-base#valueHasOrder :valueHasOrder rdf:type owl:DatatypeProperty ; @@ -1974,6 +1985,24 @@ rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . +:TimeBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasTimeStamp ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#IntervalValue + +:TimeValue rdf:type owl:Class ; + + rdfs:subClassOf :TimeBase , + :IntervalBase ; + + rdfs:comment "Represents a timestamp"@en . + ### http://www.knora.org/ontology/knora-base#LinkObj diff --git a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala index 0f1a74c77d..f862efedd7 100644 --- a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala +++ b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala @@ -220,6 +220,7 @@ object OntologyConstants { val ValueHasListNode: IRI = KnoraBasePrefixExpansion + "valueHasListNode" val ValueHasIntervalStart: IRI = KnoraBasePrefixExpansion + "valueHasIntervalStart" val ValueHasIntervalEnd: IRI = KnoraBasePrefixExpansion + "valueHasIntervalEnd" + val ValueHasTimeStamp: IRI = KnoraBasePrefixExpansion + "valueHasTimeStamp" val ValueHasOrder: IRI = KnoraBasePrefixExpansion + "valueHasOrder" val ValueHasRefCount: IRI = KnoraBasePrefixExpansion + "valueHasRefCount" val ValueHasComment: IRI = KnoraBasePrefixExpansion + "valueHasComment" @@ -257,6 +258,7 @@ object OntologyConstants { val IntBase: IRI = KnoraBasePrefixExpansion + "IntBase" val DecimalBase: IRI = KnoraBasePrefixExpansion + "DecimalBase" val IntervalBase: IRI = KnoraBasePrefixExpansion + "IntervalBase" + val TimeBase: IRI = KnoraBasePrefixExpansion + "TimeBase" val ColorBase: IRI = KnoraBasePrefixExpansion + "ColorBase" val TextValue: IRI = KnoraBasePrefixExpansion + "TextValue" @@ -269,6 +271,7 @@ object OntologyConstants { val GeomValue: IRI = KnoraBasePrefixExpansion + "GeomValue" val ListValue: IRI = KnoraBasePrefixExpansion + "ListValue" val IntervalValue: IRI = KnoraBasePrefixExpansion + "IntervalValue" + val TimeValue: IRI = KnoraBasePrefixExpansion + "TimeValue" val LinkValue: IRI = KnoraBasePrefixExpansion + "LinkValue" val GeonameValue: IRI = KnoraBasePrefixExpansion + "GeonameValue" val FileValue: IRI = KnoraBasePrefixExpansion + "FileValue" @@ -300,6 +303,7 @@ object OntologyConstants { GeomValue, ListValue, IntervalValue, + TimeValue, LinkValue, GeonameValue, FileValue, @@ -827,6 +831,7 @@ object OntologyConstants { val DateValue: IRI = KnoraApiV2PrefixExpansion + "DateValue" val GeomValue: IRI = KnoraApiV2PrefixExpansion + "GeomValue" val IntervalValue: IRI = KnoraApiV2PrefixExpansion + "IntervalValue" + val TimeValue: IRI = KnoraApiV2PrefixExpansion + "TimeValue" val LinkValue: IRI = KnoraApiV2PrefixExpansion + "LinkValue" val ListValue: IRI = KnoraApiV2PrefixExpansion + "ListValue" val UriValue: IRI = KnoraApiV2PrefixExpansion + "UriValue" @@ -859,6 +864,7 @@ object OntologyConstants { DateValue, GeomValue, IntervalValue, + TimeValue, LinkValue, ListValue, UriValue, @@ -946,6 +952,8 @@ object OntologyConstants { val IntervalValueHasStart: IRI = KnoraApiV2PrefixExpansion + "intervalValueHasStart" val IntervalValueHasEnd: IRI = KnoraApiV2PrefixExpansion + "intervalValueHasEnd" + val TimeValueAsTimeStamp: IRI = KnoraApiV2PrefixExpansion + "timeValueAsTimeStamp" + val BooleanValueAsBoolean: IRI = KnoraApiV2PrefixExpansion + "booleanValueAsBoolean" val ListValueAsListNode: IRI = KnoraApiV2PrefixExpansion + "listValueAsListNode" @@ -1084,6 +1092,7 @@ object OntologyConstants { KnoraBase.BooleanValue -> Xsd.Boolean, KnoraBase.UriValue -> Xsd.Uri, KnoraBase.DecimalValue -> Xsd.Decimal, + KnoraBase.TimeValue -> Xsd.DateTimeStamp, KnoraBase.DateValue -> KnoraApiV2Simple.Date, KnoraBase.ColorValue -> KnoraApiV2Simple.Color, KnoraBase.GeomValue -> KnoraApiV2Simple.Geom, @@ -1116,6 +1125,7 @@ object OntologyConstants { KnoraBase.ValueHasBoolean -> KnoraApiV2Complex.BooleanValueAsBoolean, KnoraBase.ValueHasIntervalStart -> KnoraApiV2Complex.IntervalValueHasStart, KnoraBase.ValueHasIntervalEnd -> KnoraApiV2Complex.IntervalValueHasEnd, + KnoraBase.ValueHasTimeStamp -> KnoraApiV2Complex.TimeValueAsTimeStamp, KnoraBase.ValueHasLanguage -> KnoraApiV2Complex.TextValueHasLanguage, KnoraBase.ValueHasListNode -> KnoraApiV2Complex.ListValueAsListNode, KnoraBase.ValueHasGeonameCode -> KnoraApiV2Complex.GeonameValueAsGeonameCode, @@ -1167,6 +1177,7 @@ object OntologyConstants { KnoraApiV2Complex.BooleanValueAsBoolean -> KnoraBase.ValueHasBoolean, KnoraApiV2Complex.IntervalValueHasStart -> KnoraBase.ValueHasIntervalStart, KnoraApiV2Complex.IntervalValueHasEnd -> KnoraBase.ValueHasIntervalEnd, + KnoraApiV2Complex.TimeValueAsTimeStamp -> KnoraBase.ValueHasTimeStamp, KnoraApiV2Complex.ValueAsString -> KnoraBase.ValueHasString, KnoraApiV2Complex.TextValueHasLanguage -> KnoraBase.ValueHasLanguage, KnoraApiV2Complex.ListValueAsListNode -> KnoraBase.ValueHasListNode, diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala index 4fceebfcfe..5cd38228af 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala @@ -65,6 +65,7 @@ case class CreateValueApiRequestV1(res_id: IRI, geom_value: Option[String] = None, hlist_value: Option[IRI] = None, interval_value: Option[Seq[BigDecimal]] = None, + time_value: Option[String] = None, geoname_value: Option[String] = None, comment: Option[String] = None) { @@ -81,6 +82,7 @@ case class CreateValueApiRequestV1(res_id: IRI, geom_value, hlist_value, interval_value, + time_value, geoname_value).flatten.size > 1) { throw BadRequestException(s"Different value types were submitted for property $prop") } @@ -102,6 +104,7 @@ case class CreateValueApiRequestV1(res_id: IRI, else if (geom_value.nonEmpty) OntologyConstants.KnoraBase.GeomValue else if (hlist_value.nonEmpty) OntologyConstants.KnoraBase.ListValue else if (interval_value.nonEmpty) OntologyConstants.KnoraBase.IntervalValue + else if (time_value.nonEmpty) OntologyConstants.KnoraBase.TimeValue else if (geoname_value.nonEmpty) OntologyConstants.KnoraBase.GeonameValue else throw BadRequestException("No value specified") } @@ -169,6 +172,7 @@ case class ChangeValueApiRequestV1(richtext_value: Option[CreateRichtextV1] = No geom_value: Option[String] = None, hlist_value: Option[IRI] = None, interval_value: Option[Seq[BigDecimal]] = None, + time_value: Option[String] = None, geoname_value: Option[String] = None, comment: Option[String] = None) { @@ -191,6 +195,7 @@ case class ChangeValueApiRequestV1(richtext_value: Option[CreateRichtextV1] = No else if (geom_value.nonEmpty) OntologyConstants.KnoraBase.GeomValue else if (hlist_value.nonEmpty) OntologyConstants.KnoraBase.ListValue else if (interval_value.nonEmpty) OntologyConstants.KnoraBase.IntervalValue + else if (time_value.nonEmpty) OntologyConstants.KnoraBase.TimeValue else if (geoname_value.nonEmpty) OntologyConstants.KnoraBase.GeonameValue else throw BadRequestException("No value specified") } @@ -490,7 +495,7 @@ case class ChangeFileValueRequestV1(resourceIri: IRI, file: SipiConversionReques * @param locations the updated file value(s). */ case class ChangeFileValueResponseV1(locations: Vector[LocationV1]) extends KnoraResponseV1 { - def toJsValue: JsValue = ApiValueV1JsonProtocol.changeFileValueresponseV1Format.write(this) + def toJsValue: JsValue = ApiValueV1JsonProtocol.changeFileValueResponseV1Format.write(this) } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1181,7 +1186,48 @@ case class IntervalValueV1(timeval1: BigDecimal, timeval2: BigDecimal) extends U case other => throw InconsistentTriplestoreDataException(s"Cannot compare a $valueTypeIri to a ${other.valueTypeIri}") } } +} + +/** + * Represents a timestamp value. + * + * @param timestamp an `xsd:dateTimeStamp`. + */ +case class TimeValueV1(timestamp: Instant) extends UpdateValueV1 with ApiValueV1 { + + def valueTypeIri: IRI = OntologyConstants.KnoraBase.TimeValue + def toJsValue: JsValue = JsObject( + "timestamp" -> JsString(timestamp.toString) + ) + + override def toString: String = s"$timestamp" + + /** + * Checks if a new interval value would duplicate an existing interval value. + * + * @param other another [[ValueV1]]. + * @return `true` if `other` is a duplicate of `this`. + */ + override def isDuplicateOfOtherValue(other: ApiValueV1): Boolean = { + other match { + case timeValueV1: TimeValueV1 => timeValueV1 == this + case otherValue => throw InconsistentTriplestoreDataException(s"Cannot compare a $valueTypeIri to a ${otherValue.valueTypeIri}") + } + } + + /** + * Checks if a new version of this interval value would be redundant given the current version of the value. + * + * @param currentVersion the current version of the value. + * @return `true` if this [[UpdateValueV1]] is redundant given `currentVersion`. + */ + override def isRedundant(currentVersion: ApiValueV1): Boolean = { + currentVersion match { + case timeValueV1: TimeValueV1 => timeValueV1 == this + case other => throw InconsistentTriplestoreDataException(s"Cannot compare a $valueTypeIri to a ${other.valueTypeIri}") + } + } } /** @@ -1609,11 +1655,11 @@ object ApiValueV1JsonProtocol extends SprayJsonSupport with DefaultJsonProtocol implicit val linkValueV1Format: JsonFormat[LinkValueV1] = jsonFormat4(LinkValueV1) implicit val valueVersionHistoryGetResponseV1Format: RootJsonFormat[ValueVersionHistoryGetResponseV1] = jsonFormat1(ValueVersionHistoryGetResponseV1) implicit val createRichtextV1Format: RootJsonFormat[CreateRichtextV1] = jsonFormat4(CreateRichtextV1) - implicit val createValueApiRequestV1Format: RootJsonFormat[CreateValueApiRequestV1] = jsonFormat15(CreateValueApiRequestV1) + implicit val createValueApiRequestV1Format: RootJsonFormat[CreateValueApiRequestV1] = jsonFormat16(CreateValueApiRequestV1) implicit val createValueResponseV1Format: RootJsonFormat[CreateValueResponseV1] = jsonFormat4(CreateValueResponseV1) - implicit val changeValueApiRequestV1Format: RootJsonFormat[ChangeValueApiRequestV1] = jsonFormat13(ChangeValueApiRequestV1) + implicit val changeValueApiRequestV1Format: RootJsonFormat[ChangeValueApiRequestV1] = jsonFormat14(ChangeValueApiRequestV1) implicit val changeValueResponseV1Format: RootJsonFormat[ChangeValueResponseV1] = jsonFormat4(ChangeValueResponseV1) implicit val deleteValueResponseV1Format: RootJsonFormat[DeleteValueResponseV1] = jsonFormat1(DeleteValueResponseV1) implicit val changeFileValueApiRequestV1Format: RootJsonFormat[ChangeFileValueApiRequestV1] = jsonFormat1(ChangeFileValueApiRequestV1) - implicit val changeFileValueresponseV1Format: RootJsonFormat[ChangeFileValueResponseV1] = jsonFormat1(ChangeFileValueResponseV1) + implicit val changeFileValueResponseV1Format: RootJsonFormat[ChangeFileValueResponseV1] = jsonFormat1(ChangeFileValueResponseV1) } diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala index 85af8d8047..2880ef2fc4 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala @@ -45,40 +45,40 @@ import org.knora.webapi.util.standoff.{StandoffTagUtilV2, XMLUtil} import scala.concurrent.{ExecutionContext, Future} /** - * A tagging trait for requests handled by [[org.knora.webapi.responders.v2.ValuesResponderV2]]. - */ + * A tagging trait for requests handled by [[org.knora.webapi.responders.v2.ValuesResponderV2]]. + */ sealed trait ValuesResponderRequestV2 extends KnoraRequestV2 /** - * Requests the creation of a value. - * - * @param createValue a [[CreateValueV2]] representing the value to be created. A successful response will be - * a [[CreateValueResponseV2]]. - * @param requestingUser the user making the request. - * @param apiRequestID the API request ID. - */ + * Requests the creation of a value. + * + * @param createValue a [[CreateValueV2]] representing the value to be created. A successful response will be + * a [[CreateValueResponseV2]]. + * @param requestingUser the user making the request. + * @param apiRequestID the API request ID. + */ case class CreateValueRequestV2(createValue: CreateValueV2, requestingUser: UserADM, apiRequestID: UUID) extends ValuesResponderRequestV2 /** - * Constructs [[CreateValueRequestV2]] instances based on JSON-LD input. - */ + * Constructs [[CreateValueRequestV2]] instances based on JSON-LD input. + */ object CreateValueRequestV2 extends KnoraJsonLDRequestReaderV2[CreateValueRequestV2] { /** - * Converts JSON-LD input to a [[CreateValueRequestV2]]. - * - * @param jsonLDDocument the JSON-LD input. - * @param apiRequestID the UUID of the API request. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a case class instance representing the input. - */ + * Converts JSON-LD input to a [[CreateValueRequestV2]]. + * + * @param jsonLDDocument the JSON-LD input. + * @param apiRequestID the UUID of the API request. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a case class instance representing the input. + */ override def fromJsonLD(jsonLDDocument: JsonLDDocument, apiRequestID: UUID, requestingUser: UserADM, @@ -108,14 +108,14 @@ object CreateValueRequestV2 extends KnoraJsonLDRequestReaderV2[CreateValueReques for { valueContent: ValueContentV2 <- - ValueContentV2.fromJsonLDObject( - jsonLDObject = jsonLDObject, - requestingUser = requestingUser, - responderManager = responderManager, - storeManager = storeManager, - settings = settings, - log = log - ) + ValueContentV2.fromJsonLDObject( + jsonLDObject = jsonLDObject, + requestingUser = requestingUser, + responderManager = responderManager, + storeManager = storeManager, + settings = settings, + log = log + ) maybePermissions: Option[String] = jsonLDObject.maybeStringWithValidation(OntologyConstants.KnoraApiV2Complex.HasPermissions, stringFormatter.toSparqlEncodedString) } yield CreateValueV2( @@ -135,12 +135,12 @@ object CreateValueRequestV2 extends KnoraJsonLDRequestReaderV2[CreateValueReques } /** - * Represents a successful response to a [[CreateValueRequestV2]]. - * - * @param valueIri the IRI of the value that was created. - * @param valueType the type of the value that was created. - * @param projectADM the project in which the value was created. - */ + * Represents a successful response to a [[CreateValueRequestV2]]. + * + * @param valueIri the IRI of the value that was created. + * @param valueType the type of the value that was created. + * @param projectADM the project in which the value was created. + */ case class CreateValueResponseV2(valueIri: IRI, valueType: SmartIri, projectADM: ProjectADM) extends KnoraResponseV2 with UpdateResultInProject { @@ -161,34 +161,34 @@ case class CreateValueResponseV2(valueIri: IRI, } /** - * Requests an update to a value, i.e. the creation of a new version of an existing value. - * - * @param updateValue an [[UpdateValueV2]] representing the new version of the value. A successful response will be - * an [[UpdateValueResponseV2]]. - * @param requestingUser the user making the request. - * @param apiRequestID the API request ID. - */ + * Requests an update to a value, i.e. the creation of a new version of an existing value. + * + * @param updateValue an [[UpdateValueV2]] representing the new version of the value. A successful response will be + * an [[UpdateValueResponseV2]]. + * @param requestingUser the user making the request. + * @param apiRequestID the API request ID. + */ case class UpdateValueRequestV2(updateValue: UpdateValueV2, requestingUser: UserADM, apiRequestID: UUID) extends ValuesResponderRequestV2 /** - * Constructs [[UpdateValueRequestV2]] instances based on JSON-LD input. - */ + * Constructs [[UpdateValueRequestV2]] instances based on JSON-LD input. + */ object UpdateValueRequestV2 extends KnoraJsonLDRequestReaderV2[UpdateValueRequestV2] { /** - * Converts JSON-LD input to a [[CreateValueRequestV2]]. - * - * @param jsonLDDocument the JSON-LD input. - * @param apiRequestID the UUID of the API request. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a case class instance representing the input. - */ + * Converts JSON-LD input to a [[CreateValueRequestV2]]. + * + * @param jsonLDDocument the JSON-LD input. + * @param apiRequestID the UUID of the API request. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a case class instance representing the input. + */ override def fromJsonLD(jsonLDDocument: JsonLDDocument, apiRequestID: UUID, requestingUser: UserADM, @@ -268,12 +268,12 @@ object UpdateValueRequestV2 extends KnoraJsonLDRequestReaderV2[UpdateValueReques } /** - * Represents a successful response to an [[UpdateValueRequestV2]]. - * - * @param valueIri the IRI of the value version that was created. - * @param valueType the type of the value that was updated. - * @param projectADM the project in which the value was updated. - */ + * Represents a successful response to an [[UpdateValueRequestV2]]. + * + * @param valueIri the IRI of the value version that was created. + * @param valueType the type of the value that was updated. + * @param projectADM the project in which the value was updated. + */ case class UpdateValueResponseV2(valueIri: IRI, valueType: SmartIri, projectADM: ProjectADM) extends KnoraResponseV2 with UpdateResultInProject { @@ -294,17 +294,17 @@ case class UpdateValueResponseV2(valueIri: IRI, } /** - * Requests that a value is marked as deleted. A successful response will be a [[SuccessResponseV2]]. - * - * @param resourceIri the IRI of the containing resource. - * @param resourceClassIri the IRI of the resource class. - * @param propertyIri the IRI of the property pointing to the value to be marked as deleted. - * @param valueIri the IRI of the value to be marked as deleted. - * @param valueTypeIri the IRI of the value class. - * @param deleteComment an optional comment explaining why the value is being marked as deleted. - * @param requestingUser the user making the request. - * @param apiRequestID the API request ID. - */ + * Requests that a value is marked as deleted. A successful response will be a [[SuccessResponseV2]]. + * + * @param resourceIri the IRI of the containing resource. + * @param resourceClassIri the IRI of the resource class. + * @param propertyIri the IRI of the property pointing to the value to be marked as deleted. + * @param valueIri the IRI of the value to be marked as deleted. + * @param valueTypeIri the IRI of the value class. + * @param deleteComment an optional comment explaining why the value is being marked as deleted. + * @param requestingUser the user making the request. + * @param apiRequestID the API request ID. + */ case class DeleteValueRequestV2(resourceIri: IRI, resourceClassIri: SmartIri, propertyIri: SmartIri, @@ -316,19 +316,19 @@ case class DeleteValueRequestV2(resourceIri: IRI, object DeleteValueRequestV2 extends KnoraJsonLDRequestReaderV2[DeleteValueRequestV2] { /** - * Converts JSON-LD input into a case class instance. - * - * @param jsonLDDocument the JSON-LD input. - * @param apiRequestID the UUID of the API request. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param settings the application settings. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a case class instance representing the input. - */ + * Converts JSON-LD input into a case class instance. + * + * @param jsonLDDocument the JSON-LD input. + * @param apiRequestID the UUID of the API request. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param settings the application settings. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a case class instance representing the input. + */ override def fromJsonLD(jsonLDDocument: JsonLDDocument, apiRequestID: UUID, requestingUser: UserADM, @@ -388,28 +388,28 @@ object DeleteValueRequestV2 extends KnoraJsonLDRequestReaderV2[DeleteValueReques } /** - * Requests SPARQL for creating multiple values in a new, empty resource. The resource ''must'' be a new, empty - * resource, i.e. it must have no values. This message is used only internally by Knora, and is not part of the Knora - * v1 API. All pre-update checks must already have been performed before this message is sent. Specifically, the - * sender must ensure that: - * - * - The requesting user has permission to add values to the resource. - * - Each submitted value is consistent with the `knora-base:objectClassConstraint` of the property that is supposed - * to point to it. - * - The resource class has a suitable cardinality for each submitted value. - * - All required values are provided. - * - Redundant values are not submitted. - * - Any custom permissions in values have been validated and correctly formatted. - * - The target resources of link values and standoff links exist, if they are expected to exist. - * - The list nodes referred to by list values exist. - * - * A successful response will be a [[GenerateSparqlToCreateMultipleValuesResponseV2]]. - * - * @param resourceIri the IRI of the resource in which values are to be created. - * @param values a map of property IRIs to the values to be added for each property. - * @param creationDate an xsd:dateTimeStamp that will be attached to the values. - * @param requestingUser the user that is creating the values. - */ + * Requests SPARQL for creating multiple values in a new, empty resource. The resource ''must'' be a new, empty + * resource, i.e. it must have no values. This message is used only internally by Knora, and is not part of the Knora + * v1 API. All pre-update checks must already have been performed before this message is sent. Specifically, the + * sender must ensure that: + * + * - The requesting user has permission to add values to the resource. + * - Each submitted value is consistent with the `knora-base:objectClassConstraint` of the property that is supposed + * to point to it. + * - The resource class has a suitable cardinality for each submitted value. + * - All required values are provided. + * - Redundant values are not submitted. + * - Any custom permissions in values have been validated and correctly formatted. + * - The target resources of link values and standoff links exist, if they are expected to exist. + * - The list nodes referred to by list values exist. + * + * A successful response will be a [[GenerateSparqlToCreateMultipleValuesResponseV2]]. + * + * @param resourceIri the IRI of the resource in which values are to be created. + * @param values a map of property IRIs to the values to be added for each property. + * @param creationDate an xsd:dateTimeStamp that will be attached to the values. + * @param requestingUser the user that is creating the values. + */ case class GenerateSparqlToCreateMultipleValuesRequestV2(resourceIri: IRI, values: Map[SmartIri, Seq[GenerateSparqlForValueInNewResourceV2]], creationDate: Instant, @@ -421,31 +421,31 @@ case class GenerateSparqlForValueInNewResourceV2(valueContent: ValueContentV2, permissions: String) extends IOValueV2 /** - * Represents a response to a [[GenerateSparqlToCreateMultipleValuesRequestV2]], providing a string that can be - * included in the `INSERT DATA` clause of a SPARQL update operation to create the requested values. - * - * @param insertSparql a string containing statements that must be inserted into the INSERT clause of the SPARQL - * update that will create the values. - * @param unverifiedValues a map of property IRIs to [[UnverifiedValueV2]] objects describing - * the values that should have been created. - */ + * Represents a response to a [[GenerateSparqlToCreateMultipleValuesRequestV2]], providing a string that can be + * included in the `INSERT DATA` clause of a SPARQL update operation to create the requested values. + * + * @param insertSparql a string containing statements that must be inserted into the INSERT clause of the SPARQL + * update that will create the values. + * @param unverifiedValues a map of property IRIs to [[UnverifiedValueV2]] objects describing + * the values that should have been created. + */ case class GenerateSparqlToCreateMultipleValuesResponseV2(insertSparql: String, unverifiedValues: Map[SmartIri, Seq[UnverifiedValueV2]]) /** - * The value of a Knora property in the context of some particular input or output operation. - * Any implementation of `IOValueV2` is an API operation-specific wrapper of a `ValueContentV2`. - */ + * The value of a Knora property in the context of some particular input or output operation. + * Any implementation of `IOValueV2` is an API operation-specific wrapper of a `ValueContentV2`. + */ trait IOValueV2 { def valueContent: ValueContentV2 } /** - * Provides information about the deletion of a resource or value. - * - * @param deleteDate the date when the resource or value was deleted. - * @param deleteComment the reason why the resource or value was deleted. - */ + * Provides information about the deletion of a resource or value. + * + * @param deleteDate the date when the resource or value was deleted. + * @param deleteComment the reason why the resource or value was deleted. + */ case class DeletionInfo(deleteDate: Instant, deleteComment: String) { def toJsonLDFields(targetSchema: ApiV2Schema): Map[IRI, JsonLDValue] = { @@ -467,69 +467,69 @@ case class DeletionInfo(deleteDate: Instant, } /** - * Represents a Knora value as read from the triplestore. - */ + * Represents a Knora value as read from the triplestore. + */ sealed trait ReadValueV2 extends IOValueV2 { /** - * The IRI of the value. - */ + * The IRI of the value. + */ def valueIri: IRI /** - * The user that created the value. - */ + * The user that created the value. + */ def attachedToUser: IRI /** - * The value's permissions. - */ + * The value's permissions. + */ def permissions: String /** - * The permission that the requesting user has on the value. - */ + * The permission that the requesting user has on the value. + */ def userPermission: EntityPermission /** - * The date when the value was created. - */ + * The date when the value was created. + */ def valueCreationDate: Instant /** - * The UUID shared by all the versions of this value. - */ + * The UUID shared by all the versions of this value. + */ def valueHasUUID: UUID /** - * The content of the value. - */ + * The content of the value. + */ def valueContent: ValueContentV2 /** - * The IRI of the previous version of this value. Not returned in API responses, but needed - * here for testing. - */ + * The IRI of the previous version of this value. Not returned in API responses, but needed + * here for testing. + */ def previousValueIri: Option[IRI] /** - * If the value has been marked as deleted, information about its deletion. - */ + * If the value has been marked as deleted, information about its deletion. + */ def deletionInfo: Option[DeletionInfo] /** - * Converts this value to the specified ontology schema. - * - * @param targetSchema the schema that the value should be converted to. - */ + * Converts this value to the specified ontology schema. + * + * @param targetSchema the schema that the value should be converted to. + */ def toOntologySchema(targetSchema: ApiV2Schema): ReadValueV2 /** - * Converts this value to JSON-LD. - * - * @param targetSchema the target schema. - * @param settings the application settings. - * @return a JSON-LD representation of this value. - */ + * Converts this value to JSON-LD. + * + * @param targetSchema the target schema. + * @param settings the application settings. + * @return a JSON-LD representation of this value. + */ def toJsonLD(targetSchema: ApiV2Schema, projectADM: ProjectADM, settings: SettingsImpl, schemaOptions: Set[SchemaOption]): JsonLDValue = { implicit val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance @@ -592,22 +592,22 @@ sealed trait ReadValueV2 extends IOValueV2 { } /** - * A text value, or a page of standoff markup attached to a text value, as read from the triplestore. - * - * @param valueIri the IRI of the value. - * @param attachedToUser the user that created the value. - * @param permissions the permissions that the value grants to user groups. - * @param userPermission the permission that the requesting user has on the value. - * @param valueHasUUID the UUID shared by all the versions of this value. - * @param valueContent the content of the value. - * @param valueHasMaxStandoffStartIndex if this text value has standoff markup, the highest - * `knora-base:standoffTagHasEndIndex` - * used in its standoff tags. - * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed - * here for testing. - * @param deletionInfo if this value has been marked as deleted, provides the date when it was - * deleted and the reason why it was deleted. - */ + * A text value, or a page of standoff markup attached to a text value, as read from the triplestore. + * + * @param valueIri the IRI of the value. + * @param attachedToUser the user that created the value. + * @param permissions the permissions that the value grants to user groups. + * @param userPermission the permission that the requesting user has on the value. + * @param valueHasUUID the UUID shared by all the versions of this value. + * @param valueContent the content of the value. + * @param valueHasMaxStandoffStartIndex if this text value has standoff markup, the highest + * `knora-base:standoffTagHasEndIndex` + * used in its standoff tags. + * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed + * here for testing. + * @param deletionInfo if this value has been marked as deleted, provides the date when it was + * deleted and the reason why it was deleted. + */ case class ReadTextValueV2(valueIri: IRI, attachedToUser: IRI, permissions: String, @@ -619,10 +619,10 @@ case class ReadTextValueV2(valueIri: IRI, previousValueIri: Option[IRI], deletionInfo: Option[DeletionInfo]) extends ReadValueV2 with KnoraReadV2[ReadTextValueV2] { /** - * Converts this value to the specified ontology schema. - * - * @param targetSchema the target schema. - */ + * Converts this value to the specified ontology schema. + * + * @param targetSchema the target schema. + */ override def toOntologySchema(targetSchema: ApiV2Schema): ReadTextValueV2 = { copy(valueContent = valueContent.toOntologySchema(targetSchema)) } @@ -668,21 +668,21 @@ case class ReadTextValueV2(valueIri: IRI, } /** - * A link value as read from the triplestore. - * - * @param valueIri the IRI of the value. - * @param attachedToUser the user that created the value. - * @param permissions the permissions that the value grants to user groups. - * @param userPermission the permission that the requesting user has on the value. - * @param valueHasUUID the UUID shared by all the versions of this value. - * @param valueContent the content of the value. - * @param valueHasRefCount if this is a link value, its reference count. Not returned in API responses, but needed - * here for testing. - * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed - * here for testing. - * @param deletionInfo if this value has been marked as deleted, provides the date when it was - * deleted and the reason why it was deleted. - */ + * A link value as read from the triplestore. + * + * @param valueIri the IRI of the value. + * @param attachedToUser the user that created the value. + * @param permissions the permissions that the value grants to user groups. + * @param userPermission the permission that the requesting user has on the value. + * @param valueHasUUID the UUID shared by all the versions of this value. + * @param valueContent the content of the value. + * @param valueHasRefCount if this is a link value, its reference count. Not returned in API responses, but needed + * here for testing. + * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed + * here for testing. + * @param deletionInfo if this value has been marked as deleted, provides the date when it was + * deleted and the reason why it was deleted. + */ case class ReadLinkValueV2(valueIri: IRI, attachedToUser: IRI, permissions: String, @@ -694,29 +694,29 @@ case class ReadLinkValueV2(valueIri: IRI, previousValueIri: Option[IRI] = None, deletionInfo: Option[DeletionInfo]) extends ReadValueV2 with KnoraReadV2[ReadLinkValueV2] { /** - * Converts this value to the specified ontology schema. - * - * @param targetSchema the target schema. - */ + * Converts this value to the specified ontology schema. + * + * @param targetSchema the target schema. + */ override def toOntologySchema(targetSchema: ApiV2Schema): ReadLinkValueV2 = { copy(valueContent = valueContent.toOntologySchema(targetSchema)) } } /** - * A non-text, non-link value as read from the triplestore. - * - * @param valueIri the IRI of the value. - * @param attachedToUser the user that created the value. - * @param permissions the permissions that the value grants to user groups. - * @param userPermission the permission that the requesting user has on the value. - * @param valueHasUUID the UUID shared by all the versions of this value. - * @param valueContent the content of the value. - * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed - * here for testing. - * @param deletionInfo if this value has been marked as deleted, provides the date when it was - * deleted and the reason why it was deleted. - */ + * A non-text, non-link value as read from the triplestore. + * + * @param valueIri the IRI of the value. + * @param attachedToUser the user that created the value. + * @param permissions the permissions that the value grants to user groups. + * @param userPermission the permission that the requesting user has on the value. + * @param valueHasUUID the UUID shared by all the versions of this value. + * @param valueContent the content of the value. + * @param previousValueIri the IRI of the previous version of this value. Not returned in API responses, but needed + * here for testing. + * @param deletionInfo if this value has been marked as deleted, provides the date when it was + * deleted and the reason why it was deleted. + */ case class ReadOtherValueV2(valueIri: IRI, attachedToUser: IRI, permissions: String, @@ -727,24 +727,24 @@ case class ReadOtherValueV2(valueIri: IRI, previousValueIri: Option[IRI], deletionInfo: Option[DeletionInfo]) extends ReadValueV2 with KnoraReadV2[ReadOtherValueV2] { /** - * Converts this value to the specified ontology schema. - * - * @param targetSchema the target schema. - */ + * Converts this value to the specified ontology schema. + * + * @param targetSchema the target schema. + */ override def toOntologySchema(targetSchema: ApiV2Schema): ReadOtherValueV2 = { copy(valueContent = valueContent.toOntologySchema(targetSchema)) } } /** - * Represents a Knora value to be created in an existing resource. - * - * @param resourceIri the resource the new value should be attached to. - * @param resourceClassIri the resource class that the client believes the resource belongs to. - * @param propertyIri the property of the new value. If the client wants to create a link, this must be a link value property. - * @param valueContent the content of the new value. If the client wants to create a link, this must be a [[LinkValueContentV2]]. - * @param permissions the permissions to be given to the new value. If not provided, these will be taken from defaults. - */ + * Represents a Knora value to be created in an existing resource. + * + * @param resourceIri the resource the new value should be attached to. + * @param resourceClassIri the resource class that the client believes the resource belongs to. + * @param propertyIri the property of the new value. If the client wants to create a link, this must be a link value property. + * @param valueContent the content of the new value. If the client wants to create a link, this must be a [[LinkValueContentV2]]. + * @param permissions the permissions to be given to the new value. If not provided, these will be taken from defaults. + */ case class CreateValueV2(resourceIri: IRI, resourceClassIri: SmartIri, propertyIri: SmartIri, @@ -753,41 +753,41 @@ case class CreateValueV2(resourceIri: IRI, /** - * A trait for classes representing information to be updated in a value. - */ + * A trait for classes representing information to be updated in a value. + */ trait UpdateValueV2 { /** - * The IRI of the resource containing the value. - */ + * The IRI of the resource containing the value. + */ val resourceIri: IRI /** - * The external IRI of the resource class. - */ + * The external IRI of the resource class. + */ val resourceClassIri: SmartIri /** - * The external IRI of the property pointing to the value. - */ + * The external IRI of the property pointing to the value. + */ val propertyIri: SmartIri /** - * The value IRI. - */ + * The value IRI. + */ val valueIri: IRI } /** - * A new version of a value of a Knora property to be created. - * - * @param resourceIri the resource that the current value version is attached to. - * @param resourceClassIri the resource class that the client believes the resource belongs to. - * @param propertyIri the property that the client believes points to the value. If the value is a link value, - * this must be a link value property. - * @param valueIri the IRI of the value to be updated. - * @param valueContent the content of the new version of the value. - * @param permissions the permissions to be attached to the new value version. - */ + * A new version of a value of a Knora property to be created. + * + * @param resourceIri the resource that the current value version is attached to. + * @param resourceClassIri the resource class that the client believes the resource belongs to. + * @param propertyIri the property that the client believes points to the value. If the value is a link value, + * this must be a link value property. + * @param valueIri the IRI of the value to be updated. + * @param valueContent the content of the new version of the value. + * @param permissions the permissions to be attached to the new value version. + */ case class UpdateValueContentV2(resourceIri: IRI, resourceClassIri: SmartIri, propertyIri: SmartIri, @@ -796,16 +796,16 @@ case class UpdateValueContentV2(resourceIri: IRI, permissions: Option[String] = None) extends IOValueV2 with UpdateValueV2 /** - * New permissions for a value. - * - * @param resourceIri the resource that the current value version is attached to. - * @param resourceClassIri the resource class that the client believes the resource belongs to. - * @param propertyIri the property that the client believes points to the value. If the value is a link value, - * this must be a link value property. - * @param valueIri the IRI of the value to be updated. - * @param valueType the IRI of the value type. - * @param permissions the permissions to be attached to the new value version. - */ + * New permissions for a value. + * + * @param resourceIri the resource that the current value version is attached to. + * @param resourceClassIri the resource class that the client believes the resource belongs to. + * @param propertyIri the property that the client believes points to the value. If the value is a link value, + * this must be a link value property. + * @param valueIri the IRI of the value to be updated. + * @param valueType the IRI of the value type. + * @param permissions the permissions to be attached to the new value version. + */ case class UpdateValuePermissionsV2(resourceIri: IRI, resourceClassIri: SmartIri, propertyIri: SmartIri, @@ -814,97 +814,97 @@ case class UpdateValuePermissionsV2(resourceIri: IRI, permissions: String) extends UpdateValueV2 /** - * The IRI and content of a new value or value version whose existence in the triplestore needs to be verified. - * - * @param newValueIri the IRI that was assigned to the new value. - * @param valueContent the content of the new value (unescaped, as it would be read from the triplestore). - * @param permissions the permissions of the new value. - * @param creationDate the new value's creation date. - */ + * The IRI and content of a new value or value version whose existence in the triplestore needs to be verified. + * + * @param newValueIri the IRI that was assigned to the new value. + * @param valueContent the content of the new value (unescaped, as it would be read from the triplestore). + * @param permissions the permissions of the new value. + * @param creationDate the new value's creation date. + */ case class UnverifiedValueV2(newValueIri: IRI, valueContent: ValueContentV2, permissions: String, creationDate: Instant) /** - * The content of the value of a Knora property. - */ + * The content of the value of a Knora property. + */ sealed trait ValueContentV2 extends KnoraContentV2[ValueContentV2] { protected implicit def stringFormatter: StringFormatter = StringFormatter.getGeneralInstance /** - * The IRI of the value type. - */ + * The IRI of the value type. + */ def valueType: SmartIri /** - * The string representation of this `ValueContentV2`. - */ + * The string representation of this `ValueContentV2`. + */ def valueHasString: String /** - * A comment on this `ValueContentV2`, if any. - */ + * a comment on this [[ValueContentV2]], if any. + */ def comment: Option[String] /** - * Converts this value to the specified ontology schema. - * - * @param targetSchema the target schema. - */ + * Converts this value to the specified ontology schema. + * + * @param targetSchema the target schema. + */ def toOntologySchema(targetSchema: OntologySchema): ValueContentV2 /** - * A representation of the `ValueContentV2` as a [[JsonLDValue]]. - * - * @param targetSchema the API schema to be used. - * @param settings the configuration options. - * @return a [[JsonLDValue]] that can be used to generate JSON-LD representing this value. - */ + * A representation of the `ValueContentV2` as a [[JsonLDValue]]. + * + * @param targetSchema the API schema to be used. + * @param settings the configuration options. + * @return a [[JsonLDValue]] that can be used to generate JSON-LD representing this value. + */ def toJsonLDValue(targetSchema: ApiV2Schema, projectADM: ProjectADM, settings: SettingsImpl, schemaOptions: Set[SchemaOption]): JsonLDValue /** - * Undoes the SPARQL-escaping of strings in this [[ValueContentV2]]. - * - * @return the same [[ValueContentV2]] with its strings unescaped. - */ + * Undoes the SPARQL-escaping of strings in this [[ValueContentV2]]. + * + * @return the same [[ValueContentV2]] with its strings unescaped. + */ def unescape: ValueContentV2 /** - * Returns `true` if creating this [[ValueContentV2]] as a new value would duplicate the specified other value. - * This means that if resource `R` has property `P` with value `V1`, and `V1` would duplicate `V2`, the API server - * should not add another instance of property `P` with value `V2`. It does not necessarily mean that `V1 == V2`. - * - * @param that a [[ValueContentV2]] in the same resource, as read from the triplestore. - * @return `true` if `other` would duplicate `this`. - */ + * Returns `true` if creating this [[ValueContentV2]] as a new value would duplicate the specified other value. + * This means that if resource `R` has property `P` with value `V1`, and `V1` would duplicate `V2`, the API server + * should not add another instance of property `P` with value `V2`. It does not necessarily mean that `V1 == V2`. + * + * @param that a [[ValueContentV2]] in the same resource, as read from the triplestore. + * @return `true` if `other` would duplicate `this`. + */ def wouldDuplicateOtherValue(that: ValueContentV2): Boolean /** - * Returns `true` if this [[ValueContentV2]] would be redundant as a new version of an existing value. This means - * that if resource `R` has property `P` with value `V1`, and `V2` would duplicate `V1`, we should not add `V2` - * as a new version of `V1`. It does not necessarily mean that `V1 == V2`. - * - * @param currentVersion the current version of the value, as read from the triplestore. - * @return `true` if this [[ValueContentV2]] would duplicate `currentVersion`. - */ + * Returns `true` if this [[ValueContentV2]] would be redundant as a new version of an existing value. This means + * that if resource `R` has property `P` with value `V1`, and `V2` would duplicate `V1`, we should not add `V2` + * as a new version of `V1`. It does not necessarily mean that `V1 == V2`. + * + * @param currentVersion the current version of the value, as read from the triplestore. + * @return `true` if this [[ValueContentV2]] would duplicate `currentVersion`. + */ def wouldDuplicateCurrentVersion(currentVersion: ValueContentV2): Boolean } /** - * A trait for objects that can convert JSON-LD objects into value content objects (subclasses of [[ValueContentV2]]). - * - * @tparam C a subclass of [[ValueContentV2]]. - */ + * A trait for objects that can convert JSON-LD objects into value content objects (subclasses of [[ValueContentV2]]). + * + * @tparam C a subclass of [[ValueContentV2]]. + */ trait ValueContentReaderV2[C <: ValueContentV2] { /** - * Converts a JSON-LD object to a subclass of [[ValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a subclass of [[ValueContentV2]]. - */ + * Converts a JSON-LD object to a subclass of [[ValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a subclass of [[ValueContentV2]]. + */ def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -918,20 +918,20 @@ trait ValueContentReaderV2[C <: ValueContentV2] { } /** - * Generates instances of value content classes (subclasses of [[ValueContentV2]]) from JSON-LD input. - */ + * Generates instances of value content classes (subclasses of [[ValueContentV2]]) from JSON-LD input. + */ object ValueContentV2 extends ValueContentReaderV2[ValueContentV2] { /** - * Converts a JSON-LD object to a [[ValueContentV2]]. - * - * @param jsonLDObject a JSON-LD object representing a value. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[ValueContentV2]]. - */ + * Converts a JSON-LD object to a [[ValueContentV2]]. + * + * @param jsonLDObject a JSON-LD object representing a value. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[ValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -967,6 +967,9 @@ object ValueContentV2 extends ValueContentReaderV2[ValueContentV2] { case OntologyConstants.KnoraApiV2Complex.IntervalValue => IntervalValueContentV2.fromJsonLDObject(jsonLDObject = jsonLDObject, requestingUser = requestingUser, responderManager = responderManager, storeManager = storeManager, settings = settings, log = log) + case OntologyConstants.KnoraApiV2Complex.TimeValue => + TimeValueContentV2.fromJsonLDObject(jsonLDObject = jsonLDObject, requestingUser = requestingUser, responderManager = responderManager, storeManager = storeManager, settings = settings, log = log) + case OntologyConstants.KnoraApiV2Complex.LinkValue => LinkValueContentV2.fromJsonLDObject(jsonLDObject = jsonLDObject, requestingUser = requestingUser, responderManager = responderManager, storeManager = storeManager, settings = settings, log = log) @@ -993,15 +996,15 @@ object ValueContentV2 extends ValueContentReaderV2[ValueContentV2] { } /** - * Represents a Knora date value. - * - * @param valueHasStartJDN the start of the date as JDN. - * @param valueHasEndJDN the end of the date as JDN. - * @param valueHasStartPrecision the precision of the start date. - * @param valueHasEndPrecision the precision of the end date. - * @param valueHasCalendar the calendar of the date. - * @param comment a comment on this `DateValueContentV2`, if any. - */ + * Represents a Knora date value. + * + * @param valueHasStartJDN the start of the date as JDN. + * @param valueHasEndJDN the end of the date as JDN. + * @param valueHasStartPrecision the precision of the start date. + * @param valueHasEndPrecision the precision of the end date. + * @param valueHasCalendar the calendar of the date. + * @param comment a comment on this [[DateValueContentV2]], if any. + */ case class DateValueContentV2(ontologySchema: OntologySchema, valueHasStartJDN: Int, valueHasEndJDN: Int, @@ -1101,15 +1104,15 @@ case class DateValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[DateValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[DateValueContentV2]] objects based on JSON-LD input. + */ object DateValueContentV2 extends ValueContentReaderV2[DateValueContentV2] { /** - * Parses a string representing a date range in API v2 simple format. - * - * @param dateStr the string to be parsed. - * @return a [[DateValueContentV2]] representing the date range. - */ + * Parses a string representing a date range in API v2 simple format. + * + * @param dateStr the string to be parsed. + * @return a [[DateValueContentV2]] representing the date range. + */ def parse(dateStr: String): DateValueContentV2 = { val dateRange: CalendarDateRangeV2 = CalendarDateRangeV2.parse(dateStr) val (startJDN: Int, endJDN: Int) = dateRange.toJulianDayRange @@ -1125,16 +1128,16 @@ object DateValueContentV2 extends ValueContentReaderV2[DateValueContentV2] { } /** - * Converts a JSON-LD object to a [[DateValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[DateValueContentV2]]. - */ + * Converts a JSON-LD object to a [[DateValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[DateValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1224,25 +1227,25 @@ object DateValueContentV2 extends ValueContentReaderV2[DateValueContentV2] { } /** - * Represents a [[StandoffTagV2]] for a standoff tag of a certain type (standoff tag class) that is about to be created in the triplestore. - * - * @param standoffNode the standoff node to be created. - * @param standoffTagInstanceIri the standoff node's IRI. - * @param startParentIri the IRI of the parent of the start tag. - * @param endParentIri the IRI of the parent of the end tag, if any. - */ + * Represents a [[StandoffTagV2]] for a standoff tag of a certain type (standoff tag class) that is about to be created in the triplestore. + * + * @param standoffNode the standoff node to be created. + * @param standoffTagInstanceIri the standoff node's IRI. + * @param startParentIri the IRI of the parent of the start tag. + * @param endParentIri the IRI of the parent of the end tag, if any. + */ case class CreateStandoffTagV2InTriplestore(standoffNode: StandoffTagV2, standoffTagInstanceIri: IRI, startParentIri: Option[IRI] = None, endParentIri: Option[IRI] = None) /** - * Represents a Knora text value, or a page of standoff markup that will be included in a text value. - * - * @param maybeValueHasString the string representation of this text value, if available. - * @param standoff the standoff markup attached to the text value, if any. - * @param mappingIri the IRI of the [[MappingXMLtoStandoff]] used by default with the text value, if any. - * @param mapping the [[MappingXMLtoStandoff]] used by default with the text value, if any. - * @param comment a comment on this `TextValueContentV2`, if any. - */ + * Represents a Knora text value, or a page of standoff markup that will be included in a text value. + * + * @param maybeValueHasString the string representation of this text value, if available. + * @param standoff the standoff markup attached to the text value, if any. + * @param mappingIri the IRI of the [[MappingXMLtoStandoff]] used by default with the text value, if any. + * @param mapping the [[MappingXMLtoStandoff]] used by default with the text value, if any. + * @param comment a comment on this [[TextValueContentV2]], if any. + */ case class TextValueContentV2(ontologySchema: OntologySchema, maybeValueHasString: Option[String], valueHasLanguage: Option[String] = None, @@ -1257,15 +1260,15 @@ case class TextValueContentV2(ontologySchema: OntologySchema, } /** - * Returns the IRIs of any resources that are target of standoff link tags in this text value. - */ + * Returns the IRIs of any resources that are target of standoff link tags in this text value. + */ lazy val standoffLinkTagTargetResourceIris: Set[IRI] = { standoffLinkTagIriAttributes.map(_.value) } /** - * Returns the IRI attributes representing the target IRIs of any standoff links in this text value. - */ + * Returns the IRI attributes representing the target IRIs of any standoff links in this text value. + */ lazy val standoffLinkTagIriAttributes: Set[StandoffTagIriAttributeV2] = { standoff.foldLeft(Set.empty[StandoffTagIriAttributeV2]) { case (acc, standoffTag: StandoffTagV2) => @@ -1285,15 +1288,15 @@ case class TextValueContentV2(ontologySchema: OntologySchema, override def valueHasString: String = maybeValueHasString.getOrElse(throw AssertionException("Text value has no valueHasString")) /** - * The content of the text value without standoff, suitable for returning in API responses. This removes - * INFORMATION SEPARATOR TWO, which is used only internally. - */ + * The content of the text value without standoff, suitable for returning in API responses. This removes + * INFORMATION SEPARATOR TWO, which is used only internally. + */ lazy val valueHasStringWithoutStandoff: String = valueHasString.replace(StringFormatter.INFORMATION_SEPARATOR_TWO.toString, "") /** - * The maximum start index in the standoff attached to this [[TextValueContentV2]]. This is used - * only when writing a text value to the triplestore. - */ + * The maximum start index in the standoff attached to this [[TextValueContentV2]]. This is used + * only when writing a text value to the triplestore. + */ lazy val computedMaxStandoffStartIndex: Option[Int] = if (standoff.nonEmpty) { Some(standoff.map(_.startIndex).max) } else { @@ -1371,11 +1374,11 @@ case class TextValueContentV2(ontologySchema: OntologySchema, /** - * A convenience method that creates an IRI for each [[StandoffTagV2]] and resolves internal references to standoff node Iris. - * - * @return a list of [[CreateStandoffTagV2InTriplestore]] each representing a [[StandoffTagV2]] object - * along with is standoff tag class and IRI that is going to identify it in the triplestore. - */ + * A convenience method that creates an IRI for each [[StandoffTagV2]] and resolves internal references to standoff node Iris. + * + * @return a list of [[CreateStandoffTagV2InTriplestore]] each representing a [[StandoffTagV2]] object + * along with is standoff tag class and IRI that is going to identify it in the triplestore. + */ def prepareForSparqlInsert(valueIri: IRI): Seq[CreateStandoffTagV2InTriplestore] = { if (standoff.nonEmpty) { @@ -1492,21 +1495,21 @@ case class TextValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[TextValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[TextValueContentV2]] objects based on JSON-LD input. + */ object TextValueContentV2 extends ValueContentReaderV2[TextValueContentV2] { /** - * Converts a JSON-LD object to a [[TextValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[TextValueContentV2]]. - */ + * Converts a JSON-LD object to a [[TextValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[TextValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1570,11 +1573,11 @@ object TextValueContentV2 extends ValueContentReaderV2[TextValueContentV2] { } /** - * Represents a Knora integer value. - * - * @param valueHasInteger the integer value. - * @param comment a comment on this `IntegerValueContentV2`, if any. - */ + * Represents a Knora integer value. + * + * @param valueHasInteger the integer value. + * @param comment a comment on this [[IntegerValueContentV2]], if any. + */ case class IntegerValueContentV2(ontologySchema: OntologySchema, valueHasInteger: Int, comment: Option[String] = None) extends ValueContentV2 { @@ -1620,21 +1623,21 @@ case class IntegerValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[IntegerValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[IntegerValueContentV2]] objects based on JSON-LD input. + */ object IntegerValueContentV2 extends ValueContentReaderV2[IntegerValueContentV2] { /** - * Converts a JSON-LD object to an [[IntegerValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return an [[IntegerValueContentV2]]. - */ + * Converts a JSON-LD object to an [[IntegerValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[IntegerValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1658,11 +1661,11 @@ object IntegerValueContentV2 extends ValueContentReaderV2[IntegerValueContentV2] } /** - * Represents a Knora decimal value. - * - * @param valueHasDecimal the decimal value. - * @param comment a comment on this `DecimalValueContentV2`, if any. - */ + * Represents a Knora decimal value. + * + * @param valueHasDecimal the decimal value. + * @param comment a comment on this [[DecimalValueContentV2]], if any. + */ case class DecimalValueContentV2(ontologySchema: OntologySchema, valueHasDecimal: BigDecimal, comment: Option[String] = None) extends ValueContentV2 { @@ -1712,21 +1715,21 @@ case class DecimalValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[DecimalValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[DecimalValueContentV2]] objects based on JSON-LD input. + */ object DecimalValueContentV2 extends ValueContentReaderV2[DecimalValueContentV2] { /** - * Converts a JSON-LD object to a [[DecimalValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return an [[DecimalValueContentV2]]. - */ + * Converts a JSON-LD object to a [[DecimalValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[DecimalValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1754,11 +1757,11 @@ object DecimalValueContentV2 extends ValueContentReaderV2[DecimalValueContentV2] } /** - * Represents a Boolean value. - * - * @param valueHasBoolean the Boolean value. - * @param comment a comment on this `BooleanValueContentV2`, if any. - */ + * Represents a Boolean value. + * + * @param valueHasBoolean the Boolean value. + * @param comment a comment on this [[BooleanValueContentV2]], if any. + */ case class BooleanValueContentV2(ontologySchema: OntologySchema, valueHasBoolean: Boolean, comment: Option[String] = None) extends ValueContentV2 { @@ -1801,21 +1804,21 @@ case class BooleanValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[BooleanValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[BooleanValueContentV2]] objects based on JSON-LD input. + */ object BooleanValueContentV2 extends ValueContentReaderV2[BooleanValueContentV2] { /** - * Converts a JSON-LD object to a [[BooleanValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return an [[BooleanValueContentV2]]. - */ + * Converts a JSON-LD object to a [[BooleanValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[BooleanValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1839,11 +1842,11 @@ object BooleanValueContentV2 extends ValueContentReaderV2[BooleanValueContentV2] } /** - * Represents a Knora geometry value (a 2D-shape). - * - * @param valueHasGeometry JSON representing a 2D geometrical shape. - * @param comment a comment on this `GeomValueContentV2`, if any. - */ + * Represents a Knora geometry value (a 2D-shape). + * + * @param valueHasGeometry JSON representing a 2D geometrical shape. + * @param comment a comment on this [[GeomValueContentV2]], if any. + */ case class GeomValueContentV2(ontologySchema: OntologySchema, valueHasGeometry: String, comment: Option[String] = None) extends ValueContentV2 { @@ -1895,21 +1898,21 @@ case class GeomValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[GeomValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[GeomValueContentV2]] objects based on JSON-LD input. + */ object GeomValueContentV2 extends ValueContentReaderV2[GeomValueContentV2] { /** - * Converts a JSON-LD object to a [[GeomValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return an [[GeomValueContentV2]]. - */ + * Converts a JSON-LD object to a [[GeomValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[GeomValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -1934,12 +1937,12 @@ object GeomValueContentV2 extends ValueContentReaderV2[GeomValueContentV2] { /** - * Represents a Knora time interval value. - * - * @param valueHasIntervalStart the start of the time interval. - * @param valueHasIntervalEnd the end of the time interval. - * @param comment a comment on this `IntervalValueContentV2`, if any. - */ + * Represents a Knora time interval value. + * + * @param valueHasIntervalStart the start of the time interval. + * @param valueHasIntervalEnd the end of the time interval. + * @param comment a comment on this [[IntervalValueContentV2]], if any. + */ case class IntervalValueContentV2(ontologySchema: OntologySchema, valueHasIntervalStart: BigDecimal, valueHasIntervalEnd: BigDecimal, @@ -2004,21 +2007,21 @@ case class IntervalValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[IntervalValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[IntervalValueContentV2]] objects based on JSON-LD input. + */ object IntervalValueContentV2 extends ValueContentReaderV2[IntervalValueContentV2] { /** - * Converts a JSON-LD object to an [[IntervalValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return an [[IntervalValueContentV2]]. - */ + * Converts a JSON-LD object to an [[IntervalValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[IntervalValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -2032,15 +2035,15 @@ object IntervalValueContentV2 extends ValueContentReaderV2[IntervalValueContentV implicit val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance val intervalValueHasStart: BigDecimal = jsonLDObject.requireDatatypeValueInObject( - OntologyConstants.KnoraApiV2Complex.IntervalValueHasStart, - OntologyConstants.Xsd.Decimal.toSmartIri, - stringFormatter.validateBigDecimal + key = OntologyConstants.KnoraApiV2Complex.IntervalValueHasStart, + expectedDatatype = OntologyConstants.Xsd.Decimal.toSmartIri, + validationFun = stringFormatter.validateBigDecimal ) val intervalValueHasEnd: BigDecimal = jsonLDObject.requireDatatypeValueInObject( - OntologyConstants.KnoraApiV2Complex.IntervalValueHasEnd, - OntologyConstants.Xsd.Decimal.toSmartIri, - stringFormatter.validateBigDecimal + key = OntologyConstants.KnoraApiV2Complex.IntervalValueHasEnd, + expectedDatatype = OntologyConstants.Xsd.Decimal.toSmartIri, + validationFun = stringFormatter.validateBigDecimal ) IntervalValueContentV2( @@ -2053,12 +2056,116 @@ object IntervalValueContentV2 extends ValueContentReaderV2[IntervalValueContentV } /** - * Represents a value pointing to a Knora hierarchical list node. - * - * @param valueHasListNode the IRI of the hierarchical list node pointed to. - * @param listNodeLabel the label of the hierarchical list node pointed to. - * @param comment a comment on this `HierarchicalListValueContentV2`, if any. - */ + * Represents a Knora timestamp value. + * + * @param valueHasTimeStamp the timestamp. + * @param comment a comment on this [[TimeValueContentV2]], if any. + */ +case class TimeValueContentV2(ontologySchema: OntologySchema, + valueHasTimeStamp: Instant, + comment: Option[String] = None) extends ValueContentV2 { + override def valueType: SmartIri = { + implicit val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance + OntologyConstants.KnoraBase.TimeValue.toSmartIri.toOntologySchema(ontologySchema) + } + + override lazy val valueHasString: String = s"$valueHasTimeStamp" + + override def toOntologySchema(targetSchema: OntologySchema): TimeValueContentV2 = copy(ontologySchema = targetSchema) + + override def toJsonLDValue(targetSchema: ApiV2Schema, projectADM: ProjectADM, settings: SettingsImpl, schemaOptions: Set[SchemaOption]): JsonLDValue = { + targetSchema match { + case ApiV2Simple => + JsonLDUtil.datatypeValueToJsonLDObject( + value = valueHasTimeStamp.toString, + datatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri + ) + + case ApiV2Complex => + JsonLDObject( + Map( + OntologyConstants.KnoraApiV2Complex.TimeValueAsTimeStamp -> + JsonLDUtil.datatypeValueToJsonLDObject( + value = valueHasTimeStamp.toString, + datatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri + ) + )) + } + } + + override def unescape: ValueContentV2 = { + copy(comment = comment.map(commentStr => stringFormatter.fromSparqlEncodedString(commentStr))) + } + + override def wouldDuplicateOtherValue(that: ValueContentV2): Boolean = { + that match { + case thatTimeValueContent: TimeValueContentV2 => + valueHasTimeStamp == thatTimeValueContent.valueHasTimeStamp + + case _ => throw AssertionException(s"Can't compare a <$valueType> to a <${that.valueType}>") + } + } + + override def wouldDuplicateCurrentVersion(currentVersion: ValueContentV2): Boolean = { + currentVersion match { + case thatTimeValueContent: TimeValueContentV2 => + valueHasTimeStamp == thatTimeValueContent.valueHasTimeStamp && + comment == thatTimeValueContent.comment + + case _ => throw AssertionException(s"Can't compare a <$valueType> to a <${currentVersion.valueType}>") + } + } +} + +/** + * Constructs [[TimeValueContentV2]] objects based on JSON-LD input. + */ +object TimeValueContentV2 extends ValueContentReaderV2[TimeValueContentV2] { + /** + * Converts a JSON-LD object to a [[TimeValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return an [[IntervalValueContentV2]]. + */ + override def fromJsonLDObject(jsonLDObject: JsonLDObject, + requestingUser: UserADM, + responderManager: ActorRef, + storeManager: ActorRef, + settings: SettingsImpl, + log: LoggingAdapter)(implicit timeout: Timeout, executionContext: ExecutionContext): Future[TimeValueContentV2] = { + Future(fromJsonLDObjectSync(jsonLDObject)) + } + + private def fromJsonLDObjectSync(jsonLDObject: JsonLDObject): TimeValueContentV2 = { + implicit val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance + + val valueHasTimeStamp: Instant = jsonLDObject.requireDatatypeValueInObject( + key = OntologyConstants.KnoraApiV2Complex.TimeValueAsTimeStamp, + expectedDatatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri, + validationFun = stringFormatter.xsdDateTimeStampToInstant + ) + + TimeValueContentV2( + ontologySchema = ApiV2Complex, + valueHasTimeStamp = valueHasTimeStamp, + comment = getComment(jsonLDObject) + ) + } +} + +/** + * Represents a value pointing to a Knora hierarchical list node. + * + * @param valueHasListNode the IRI of the hierarchical list node pointed to. + * @param listNodeLabel the label of the hierarchical list node pointed to. + * @param comment a comment on this [[HierarchicalListValueContentV2]], if any. + */ case class HierarchicalListValueContentV2(ontologySchema: OntologySchema, valueHasListNode: IRI, listNodeLabel: Option[String] = None, @@ -2119,21 +2226,21 @@ case class HierarchicalListValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[HierarchicalListValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[HierarchicalListValueContentV2]] objects based on JSON-LD input. + */ object HierarchicalListValueContentV2 extends ValueContentReaderV2[HierarchicalListValueContentV2] { /** - * Converts a JSON-LD object to a [[HierarchicalListValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[HierarchicalListValueContentV2]]. - */ + * Converts a JSON-LD object to a [[HierarchicalListValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[HierarchicalListValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -2162,11 +2269,11 @@ object HierarchicalListValueContentV2 extends ValueContentReaderV2[HierarchicalL /** - * Represents a Knora color value. - * - * @param valueHasColor a hexadecimal string containing the RGB color value - * @param comment a comment on this `ColorValueContentV2`, if any. - */ + * Represents a Knora color value. + * + * @param valueHasColor a hexadecimal string containing the RGB color value + * @param comment a comment on this [[ColorValueContentV2]], if any. + */ case class ColorValueContentV2(ontologySchema: OntologySchema, valueHasColor: String, comment: Option[String] = None) extends ValueContentV2 { @@ -2218,21 +2325,21 @@ case class ColorValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[ColorValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[ColorValueContentV2]] objects based on JSON-LD input. + */ object ColorValueContentV2 extends ValueContentReaderV2[ColorValueContentV2] { /** - * Converts a JSON-LD object to a [[ColorValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[ColorValueContentV2]]. - */ + * Converts a JSON-LD object to a [[ColorValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[ColorValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -2256,11 +2363,11 @@ object ColorValueContentV2 extends ValueContentReaderV2[ColorValueContentV2] { } /** - * Represents a Knora URI value. - * - * @param valueHasUri the URI value. - * @param comment a comment on this `UriValueContentV2`, if any. - */ + * Represents a Knora URI value. + * + * @param valueHasUri the URI value. + * @param comment a comment on this [[UriValueContentV2]], if any. + */ case class UriValueContentV2(ontologySchema: OntologySchema, valueHasUri: String, comment: Option[String] = None) extends ValueContentV2 { @@ -2313,21 +2420,21 @@ case class UriValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[UriValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[UriValueContentV2]] objects based on JSON-LD input. + */ object UriValueContentV2 extends ValueContentReaderV2[UriValueContentV2] { /** - * Converts a JSON-LD object to a [[UriValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[UriValueContentV2]]. - */ + * Converts a JSON-LD object to a [[UriValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[UriValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -2355,12 +2462,12 @@ object UriValueContentV2 extends ValueContentReaderV2[UriValueContentV2] { } /** - * - * Represents a Knora geoname value. - * - * @param valueHasGeonameCode the geoname code. - * @param comment a comment on this `GeonameValueContentV2`, if any. - */ + * + * Represents a Knora geoname value. + * + * @param valueHasGeonameCode the geoname code. + * @param comment a comment on this [[GeonameValueContentV2]], if any. + */ case class GeonameValueContentV2(ontologySchema: OntologySchema, valueHasGeonameCode: String, comment: Option[String] = None) extends ValueContentV2 { @@ -2412,21 +2519,21 @@ case class GeonameValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[GeonameValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[GeonameValueContentV2]] objects based on JSON-LD input. + */ object GeonameValueContentV2 extends ValueContentReaderV2[GeonameValueContentV2] { /** - * Converts a JSON-LD object to a [[GeonameValueContentV2]]. - * - * @param jsonLDObject the JSON-LD object. - * @param requestingUser the user making the request. - * @param responderManager a reference to the responder manager. - * @param storeManager a reference to the store manager. - * @param log a logging adapter. - * @param timeout a timeout for `ask` messages. - * @param executionContext an execution context for futures. - * @return a [[GeonameValueContentV2]]. - */ + * Converts a JSON-LD object to a [[GeonameValueContentV2]]. + * + * @param jsonLDObject the JSON-LD object. + * @param requestingUser the user making the request. + * @param responderManager a reference to the responder manager. + * @param storeManager a reference to the store manager. + * @param log a logging adapter. + * @param timeout a timeout for `ask` messages. + * @param executionContext an execution context for futures. + * @return a [[GeonameValueContentV2]]. + */ override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, responderManager: ActorRef, @@ -2450,20 +2557,20 @@ object GeonameValueContentV2 extends ValueContentReaderV2[GeonameValueContentV2] } /** - * Represents the basic metadata stored about any file value. - */ + * Represents the basic metadata stored about any file value. + */ case class FileValueV2(internalFilename: String, internalMimeType: String, originalFilename: String, originalMimeType: String) /** - * A trait for case classes representing different types of file values. - */ + * A trait for case classes representing different types of file values. + */ sealed trait FileValueContentV2 extends ValueContentV2 { /** - * The basic metadata about the file value. - */ + * The basic metadata about the file value. + */ def fileValue: FileValueV2 def toJsonLDValueInSimpleSchema(fileUrl: String): JsonLDObject = { @@ -2486,13 +2593,13 @@ sealed trait FileValueContentV2 extends ValueContentV2 { } /** - * Represents image file metadata. - * - * @param fileValue the basic metadata about the file value. - * @param dimX the with of the the image file corresponding to this file value in pixels. - * @param dimY the height of the the image file corresponding to this file value in pixels. - * @param comment a comment on this `StillImageFileValueContentV2`, if any. - */ + * Represents image file metadata. + * + * @param fileValue the basic metadata about the file value. + * @param dimX the with of the the image file corresponding to this file value in pixels. + * @param dimY the height of the the image file corresponding to this file value in pixels. + * @param comment a comment on this [[StillImageFileValueContentV2]], if any. + */ case class StillImageFileValueContentV2(ontologySchema: OntologySchema, fileValue: FileValueV2, dimX: Int, @@ -2551,8 +2658,8 @@ case class StillImageFileValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[StillImageFileValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[StillImageFileValueContentV2]] objects based on JSON-LD input. + */ object StillImageFileValueContentV2 extends ValueContentReaderV2[StillImageFileValueContentV2] { override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, @@ -2587,11 +2694,11 @@ object StillImageFileValueContentV2 extends ValueContentReaderV2[StillImageFileV } /** - * Represents a text file value. Please note that the file itself is managed by Sipi. - * - * @param fileValue the basic metadata about the file value. - * @param comment a comment on this `TextFileValueContentV2`, if any. - */ + * Represents a text file value. Please note that the file itself is managed by Sipi. + * + * @param fileValue the basic metadata about the file value. + * @param comment a comment on this [[TextFileValueContentV2]], if any. + */ case class TextFileValueContentV2(ontologySchema: OntologySchema, fileValue: FileValueV2, comment: Option[String] = None) extends FileValueContentV2 { @@ -2640,8 +2747,8 @@ case class TextFileValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[TextFileValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[TextFileValueContentV2]] objects based on JSON-LD input. + */ object TextFileValueContentV2 extends ValueContentReaderV2[TextFileValueContentV2] { override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, @@ -2656,16 +2763,16 @@ object TextFileValueContentV2 extends ValueContentReaderV2[TextFileValueContentV /** - * Represents a Knora link value. - * - * @param referredResourceIri the IRI of resource that this link value refers to (either the source - * of an incoming link, or the target of an outgoing link). - * @param referredResourceExists `true` if the referred resource already exists, `false` if it is being created in the - * same transaction. - * @param isIncomingLink indicates if it is an incoming link. - * @param nestedResource information about the nested resource, if given. - * @param comment a comment on the link. - */ + * Represents a Knora link value. + * + * @param referredResourceIri the IRI of resource that this link value refers to (either the source + * of an incoming link, or the target of an outgoing link). + * @param referredResourceExists `true` if the referred resource already exists, `false` if it is being created in the + * same transaction. + * @param isIncomingLink indicates if it is an incoming link. + * @param nestedResource information about the nested resource, if given. + * @param comment a comment on the link. + */ case class LinkValueContentV2(ontologySchema: OntologySchema, referredResourceIri: IRI, referredResourceExists: Boolean = true, @@ -2757,8 +2864,8 @@ case class LinkValueContentV2(ontologySchema: OntologySchema, } /** - * Constructs [[LinkValueContentV2]] objects based on JSON-LD input. - */ + * Constructs [[LinkValueContentV2]] objects based on JSON-LD input. + */ object LinkValueContentV2 extends ValueContentReaderV2[LinkValueContentV2] { override def fromJsonLDObject(jsonLDObject: JsonLDObject, requestingUser: UserADM, diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala index f85bb0a467..684095eb11 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala @@ -520,7 +520,7 @@ class ValueUtilV1(private val settings: SettingsImpl) { * Converts a [[ValueProps]] into an [[IntervalValueV1]]. * * @param valueProps a [[ValueProps]] representing the SPARQL query results to be converted. - * @return a [[IntervalValueV1]]. + * @return an [[IntervalValueV1]]. */ private def makeIntervalValue(valueProps: ValueProps, responderManager: ActorRef, userProfile: UserADM)(implicit timeout: Timeout, executionContext: ExecutionContext): Future[ApiValueV1] = { val predicates = valueProps.literalData @@ -531,6 +531,21 @@ class ValueUtilV1(private val settings: SettingsImpl) { )) } + /** + * Converts a [[ValueProps]] into a [[TimeValueV1]]. + * + * @param valueProps a [[ValueProps]] representing the SPARQL query results to be converted. + * @return a [[TimeValueV1]]. + */ + private def makeTimeValue(valueProps: ValueProps, responderManager: ActorRef, userProfile: UserADM)(implicit timeout: Timeout, executionContext: ExecutionContext): Future[ApiValueV1] = { + val predicates = valueProps.literalData + val timeStampStr = predicates(OntologyConstants.KnoraBase.ValueHasTimeStamp).literals.head + + Future(TimeValueV1( + timestamp = stringFormatter.xsdDateTimeStampToInstant(timeStampStr, throw InconsistentTriplestoreDataException(s"Can't parse timestamp: $timeStampStr")) + )) + } + /** * Creates a [[TextValueWithStandoffV1]] from the given string and the standoff nodes. * From e6699e455d8f7bbda69af64ce9a3be3397bfd13e Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Wed, 28 Aug 2019 15:02:29 +0200 Subject: [PATCH 02/26] feat: Add time value type (ongoing). --- .../resourcemessages/ResourceMessagesV1.scala | 3 +++ .../valuemessages/ValueMessagesV1.scala | 8 +++---- .../webapi/responders/v1/ValueUtilV1.scala | 3 ++- .../webapi/routing/v1/ResourcesRouteV1.scala | 9 +++++++ .../knora/webapi/util/StringFormatter.scala | 24 ------------------- .../sparql/v1/addValueVersion.scala.txt | 6 +++++ ...teInsertStatementsForCreateValue.scala.txt | 6 +++++ ...eInsertStatementsForValueContent.scala.txt | 6 +++++ 8 files changed, 36 insertions(+), 29 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala index 406c4e2b00..ea84e466ac 100755 --- a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala @@ -90,6 +90,7 @@ case class CreateResourceValueV1(richtext_value: Option[CreateRichtextV1] = None geom_value: Option[String] = None, hlist_value: Option[IRI] = None, interval_value: Option[Seq[BigDecimal]] = None, + time_value: Option[String] = None, geoname_value: Option[String] = None, comment: Option[String] = None) { @@ -107,6 +108,7 @@ case class CreateResourceValueV1(richtext_value: Option[CreateRichtextV1] = None geom_value, hlist_value, interval_value, + time_value, geoname_value).flatten.size > 1) { throw BadRequestException(s"Different value types were submitted for the same property") } @@ -128,6 +130,7 @@ case class CreateResourceValueV1(richtext_value: Option[CreateRichtextV1] = None else if (geom_value.nonEmpty) OntologyConstants.KnoraBase.GeomValue else if (hlist_value.nonEmpty) OntologyConstants.KnoraBase.ListValue else if (interval_value.nonEmpty) OntologyConstants.KnoraBase.IntervalValue + else if (time_value.nonEmpty) OntologyConstants.KnoraBase.TimeValue else if (geoname_value.nonEmpty) OntologyConstants.KnoraBase.GeonameValue else throw BadRequestException("No value specified") } diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala index 5cd38228af..a4013878ef 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala @@ -1191,17 +1191,17 @@ case class IntervalValueV1(timeval1: BigDecimal, timeval2: BigDecimal) extends U /** * Represents a timestamp value. * - * @param timestamp an `xsd:dateTimeStamp`. + * @param timeStamp an `xsd:dateTimeStamp`. */ -case class TimeValueV1(timestamp: Instant) extends UpdateValueV1 with ApiValueV1 { +case class TimeValueV1(timeStamp: Instant) extends UpdateValueV1 with ApiValueV1 { def valueTypeIri: IRI = OntologyConstants.KnoraBase.TimeValue def toJsValue: JsValue = JsObject( - "timestamp" -> JsString(timestamp.toString) + "timestamp" -> JsString(timeStamp.toString) ) - override def toString: String = s"$timestamp" + override def toString: String = s"$timeStamp" /** * Checks if a new interval value would duplicate an existing interval value. diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala index 684095eb11..05d32cc5b0 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala @@ -65,6 +65,7 @@ class ValueUtilV1(private val settings: SettingsImpl) { case OntologyConstants.KnoraBase.GeonameValue => makeGeonameValue(valueProps, responderManager, userProfile) case OntologyConstants.KnoraBase.ListValue => makeListValue(valueProps, responderManager, userProfile) case OntologyConstants.KnoraBase.IntervalValue => makeIntervalValue(valueProps, responderManager, userProfile) + case OntologyConstants.KnoraBase.TimeValue => makeTimeValue(valueProps, responderManager, userProfile) case OntologyConstants.KnoraBase.StillImageFileValue => makeStillImageValue(valueProps, projectShortcode, responderManager, userProfile) case OntologyConstants.KnoraBase.TextFileValue => makeTextFileValue(valueProps, projectShortcode, responderManager, userProfile) case OntologyConstants.KnoraBase.LinkValue => makeLinkValue(valueProps, responderManager, userProfile) @@ -542,7 +543,7 @@ class ValueUtilV1(private val settings: SettingsImpl) { val timeStampStr = predicates(OntologyConstants.KnoraBase.ValueHasTimeStamp).literals.head Future(TimeValueV1( - timestamp = stringFormatter.xsdDateTimeStampToInstant(timeStampStr, throw InconsistentTriplestoreDataException(s"Can't parse timestamp: $timeStampStr")) + timeStamp = stringFormatter.xsdDateTimeStampToInstant(timeStampStr, throw InconsistentTriplestoreDataException(s"Can't parse timestamp: $timeStampStr")) )) } diff --git a/webapi/src/main/scala/org/knora/webapi/routing/v1/ResourcesRouteV1.scala b/webapi/src/main/scala/org/knora/webapi/routing/v1/ResourcesRouteV1.scala index 7986068949..5dfcbddac7 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/v1/ResourcesRouteV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/v1/ResourcesRouteV1.scala @@ -203,6 +203,11 @@ class ResourcesRouteV1(routeData: KnoraRouteData) extends KnoraRoute(routeData) if (timeVals.length != 2) throw BadRequestException("parameters for interval_value invalid") Future(CreateValueV1WithComment(IntervalValueV1(timeVals.head, timeVals(1)), givenValue.comment)) + case OntologyConstants.KnoraBase.TimeValue => + val timeValStr: String = givenValue.time_value.get + val timeStamp: Instant = stringFormatter.xsdDateTimeStampToInstant(timeValStr, throw BadRequestException(s"Invalid timestamp: $timeValStr")) + Future(CreateValueV1WithComment(TimeValueV1(timeStamp), givenValue.comment)) + case OntologyConstants.KnoraBase.GeonameValue => Future(CreateValueV1WithComment(GeonameValueV1(givenValue.geoname_value.get), givenValue.comment)) @@ -887,6 +892,10 @@ class ResourcesRouteV1(routeData: KnoraRouteData) extends KnoraRoute(routeData) throw BadRequestException(s"Invalid interval value in element '${node.label}: '$elementValue'") } + case "time_value" => + val timeStamp: Instant = stringFormatter.xsdDateTimeStampToInstant(elementValue, throw BadRequestException(s"Invalid timestamp in element '${node.label}': $elementValue")) + CreateResourceValueV1(time_value = Some(timeStamp.toString)) + case "geoname_value" => CreateResourceValueV1(geoname_value = Some(elementValue)) case other => throw BadRequestException(s"Invalid 'knoraType' in element '${node.label}': '$other'") diff --git a/webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala b/webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala index 21fd3fdd76..faf2aa94a0 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala @@ -35,8 +35,6 @@ import akka.util.Timeout import com.google.gwt.safehtml.shared.UriUtils._ import org.apache.commons.lang3.StringUtils import org.apache.commons.validator.routines.UrlValidator -import org.joda.time.DateTime -import org.joda.time.format.DateTimeFormat import org.knora.webapi._ import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectADM import org.knora.webapi.messages.store.triplestoremessages.{SparqlAskRequest, SparqlAskResponse} @@ -742,9 +740,6 @@ class StringFormatter private(val maybeSettings: Option[SettingsImpl] = None, ma PrecisionSeparator + """(?!00)[0-9]{1,2})?)?( BC| AD| BCE| CE)?)?$""").r // day 2 - // The expected format of a datetime. - private val dateTimeFormat = "yyyy-MM-dd'T'HH:mm:ss" - // Characters that are escaped in strings that will be used in SPARQL. private val SparqlEscapeInput = Array( "\\", @@ -1617,25 +1612,6 @@ class StringFormatter private(val maybeSettings: Option[SettingsImpl] = None, ma } } - /** - * Checks that a string represents a valid datetime. - * - * @param s the string to be checked. - * @param errorFun a function that throws an exception. It will be called if the string does not represent - * a valid datetime. - * @return the same string. - */ - def validateDateTime(s: String, errorFun: => Nothing): String = { - // check if a string corresponds to the expected format `dateTimeFormat` - - try { - val formatter = DateTimeFormat.forPattern(dateTimeFormat) - DateTime.parse(s, formatter).toString(formatter) - } catch { - case _: Exception => errorFun // value could not be converted to a valid DateTime using the specified format - } - } - /** * Returns `true` if a string is an IRI. * diff --git a/webapi/src/main/twirl/queries/sparql/v1/addValueVersion.scala.txt b/webapi/src/main/twirl/queries/sparql/v1/addValueVersion.scala.txt index 33e68f2b66..b536453c32 100644 --- a/webapi/src/main/twirl/queries/sparql/v1/addValueVersion.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v1/addValueVersion.scala.txt @@ -249,6 +249,12 @@ DELETE { } + case timeValue: TimeValueV1 => { + + ?newValue knora-base:valueHasTimeStamp "@timeValue.timeStamp"^^xsd:dateTime . + + } + case geonameValue: GeonameValueV1 => { ?newValue knora-base:valueHasGeonameCode """@geonameValue.geonameCode""" . diff --git a/webapi/src/main/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt b/webapi/src/main/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt index 4919542b67..c64e606243 100644 --- a/webapi/src/main/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt @@ -205,6 +205,12 @@ } + case timeValue: TimeValueV1 => { + + <@newValueIri> knora-base:valueHasTimeStamp "@timeValue.timeStamp"^^xsd:dateTime . + + } + case geonameValue: GeonameValueV1 => { <@newValueIri> knora-base:valueHasGeonameCode """@geonameValue.geonameCode""" . diff --git a/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt b/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt index 99b4072e0a..b53fd3dadf 100644 --- a/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt @@ -181,6 +181,12 @@ } + case timeValue: TimeValueV2 => { + + <@newValueIri> knora-base:valueHasTimeStamp "@timeValue.valueHasTimeStamp"^^xsd:dateTime . + + } + case geonameValue: GeonameValueContentV2 => { <@newValueIri> knora-base:valueHasGeonameCode """@geonameValue.valueHasGeonameCode""" . From 259f1e8f65e0f5f310ee0d538643c9951ac5ef1f Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Wed, 28 Aug 2019 18:11:53 +0200 Subject: [PATCH 03/26] feat: Support time values (ongoing). --- knora-ontologies/knora-base.ttl | 4 +- knora-ontologies/salsah-gui.ttl | 7 ++ .../_test_data/ontologies/anything-onto.ttl | 25 +++- webapi/src/main/resources/knoraXmlImport.xsd | 14 +++ .../org/knora/webapi/OntologyConstants.scala | 1 + .../resourcemessages/ResourceMessagesV1.scala | 3 +- .../webapi/responders/v1/ValueUtilV1.scala | 22 ++-- .../types/GravsearchTypeInspectionUtil.scala | 2 + .../webapi/routing/v1/ValuesRouteV1.scala | 17 ++- .../webapi/util/ConstructResponseUtilV2.scala | 7 ++ ...eInsertStatementsForValueContent.scala.txt | 2 +- .../src/main/twirl/xsd/v1/xmlImport.scala.xml | 6 + .../webapi/e2e/v1/ResourcesV1R2RSpec.scala | 8 ++ .../knora/webapi/e2e/v1/ValuesV1R2RSpec.scala | 36 ++++++ .../responders/v1/ValuesResponderV1Spec.scala | 41 ++++++- .../responders/v2/ValuesResponderV2Spec.scala | 111 ++++++++++++++++++ 16 files changed, 284 insertions(+), 22 deletions(-) diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index 8d4192e693..ebf3e997ef 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -1998,8 +1998,8 @@ :TimeValue rdf:type owl:Class ; - rdfs:subClassOf :TimeBase , - :IntervalBase ; + rdfs:subClassOf :Value , + :TimeBase ; rdfs:comment "Represents a timestamp"@en . diff --git a/knora-ontologies/salsah-gui.ttl b/knora-ontologies/salsah-gui.ttl index 6c183c0f51..8e5bde0478 100644 --- a/knora-ontologies/salsah-gui.ttl +++ b/knora-ontologies/salsah-gui.ttl @@ -141,6 +141,13 @@ +### http://www.knora.org/ontology/salsah-gui#TimeStamp + +:TimeStamp rdf:type :Guielement , + owl:NamedIndividual . + + + ### http://www.knora.org/ontology/salsah-gui#List :List rdf:type :Guielement , diff --git a/webapi/_test_data/ontologies/anything-onto.ttl b/webapi/_test_data/ontologies/anything-onto.ttl index 33912bfda7..fe8dc10e62 100644 --- a/webapi/_test_data/ontologies/anything-onto.ttl +++ b/webapi/_test_data/ontologies/anything-onto.ttl @@ -233,6 +233,23 @@ +:hasTimeStamp rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:hasValue ; + + rdfs:label "Zeitstempel"@de , + "Horodatage"@fr , + "Marca temporale"@it , + "Timestamp"@en ; + + knora-base:subjectClassConstraint :Thing ; + + knora-base:objectClassConstraint knora-base:TimeValue ; + + salsah-gui:guiElement salsah-gui:TimeStamp . + + + :hasColor rdf:type owl:ObjectProperty ; rdfs:subPropertyOf knora-base:hasValue ; @@ -546,7 +563,13 @@ owl:onProperty :hasGeoname ; owl:minCardinality "0"^^xsd:nonNegativeInteger ; salsah-gui:guiOrder "12"^^xsd:nonNegativeInteger - ] ; + ], + [ + rdf:type owl:Restriction ; + owl:onProperty :hasTimeStamp ; + owl:minCardinality "0"^^xsd:nonNegativeInteger ; + salsah-gui:guiOrder "13"^^xsd:nonNegativeInteger + ] ; knora-base:resourceIcon "thing.png" ; diff --git a/webapi/src/main/resources/knoraXmlImport.xsd b/webapi/src/main/resources/knoraXmlImport.xsd index 41a792b7d4..2c128f5ff3 100644 --- a/webapi/src/main/resources/knoraXmlImport.xsd +++ b/webapi/src/main/resources/knoraXmlImport.xsd @@ -195,6 +195,20 @@ + + + + + + + + + + + + + + diff --git a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala index f862efedd7..2fdf574375 100644 --- a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala +++ b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala @@ -652,6 +652,7 @@ object OntologyConstants { val Checkbox: IRI = SalsahGuiPrefixExpansion + "Checkbox" val Richtext: IRI = SalsahGuiPrefixExpansion + "Richtext" val Interval: IRI = SalsahGuiPrefixExpansion + "Interval" + val TimeStamp: IRI = SalsahGuiPrefixExpansion + "TimeStamp" val Geonames: IRI = SalsahGuiPrefixExpansion + "Geonames" val Fileupload: IRI = SalsahGuiPrefixExpansion + "Fileupload" diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala index ea84e466ac..4c01346de4 100755 --- a/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala @@ -770,6 +770,7 @@ object SalsahGuiConversions { OntologyConstants.SalsahGui.Checkbox -> "checkbox", OntologyConstants.SalsahGui.Richtext -> "richtext", OntologyConstants.SalsahGui.Interval -> "interval", + OntologyConstants.SalsahGui.TimeStamp -> "timestamp", OntologyConstants.SalsahGui.Geonames -> "geoname", OntologyConstants.SalsahGui.Fileupload -> "fileupload" ) @@ -1144,7 +1145,7 @@ object ResourceV1JsonProtocol extends SprayJsonSupport with DefaultJsonProtocol } } - implicit val createResourceValueV1Format: RootJsonFormat[CreateResourceValueV1] = jsonFormat14(CreateResourceValueV1) + implicit val createResourceValueV1Format: RootJsonFormat[CreateResourceValueV1] = jsonFormat15(CreateResourceValueV1) implicit val createResourceApiRequestV1Format: RootJsonFormat[CreateResourceApiRequestV1] = jsonFormat5(CreateResourceApiRequestV1) implicit val ChangeResourceLabelApiRequestV1Format: RootJsonFormat[ChangeResourceLabelApiRequestV1] = jsonFormat1(ChangeResourceLabelApiRequestV1) implicit val resourceInfoResponseV1Format: RootJsonFormat[ResourceInfoResponseV1] = jsonFormat2(ResourceInfoResponseV1) diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala index 05d32cc5b0..12dd692565 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala @@ -305,19 +305,19 @@ class ValueUtilV1(private val settings: SettingsImpl) { calendar = Some(Map(LiteralValueType.StringValue -> julianDayCountValue.calendar)) ) - case textValue: TextValueV1 => basicObjectResponse + case _: TextValueV1 => basicObjectResponse - case linkValue: LinkV1 => basicObjectResponse + case _: LinkV1 => basicObjectResponse - case stillImageFileValue: StillImageFileValueV1 => basicObjectResponse // TODO: implement this. + case _: StillImageFileValueV1 => basicObjectResponse // TODO: implement this. - case textFileValue: TextFileValueV1 => basicObjectResponse + case _: TextFileValueV1 => basicObjectResponse - case hlistValue: HierarchicalListValueV1 => basicObjectResponse + case _: HierarchicalListValueV1 => basicObjectResponse - case colorValue: ColorValueV1 => basicObjectResponse + case _: ColorValueV1 => basicObjectResponse - case geomValue: GeomValueV1 => basicObjectResponse + case _: GeomValueV1 => basicObjectResponse case intervalValue: IntervalValueV1 => basicObjectResponse.copy( @@ -325,11 +325,13 @@ class ValueUtilV1(private val settings: SettingsImpl) { timeval2 = Some(Map(LiteralValueType.DecimalValue -> intervalValue.timeval2)) ) - case geonameValue: GeonameValueV1 => basicObjectResponse + case _: TimeValueV1 => basicObjectResponse - case booleanValue: BooleanValueV1 => basicObjectResponse + case _: GeonameValueV1 => basicObjectResponse - case uriValue: UriValueV1 => basicObjectResponse + case _: BooleanValueV1 => basicObjectResponse + + case _: UriValueV1 => basicObjectResponse case other => throw new Exception(s"Resource creation response format not implemented for value type ${other.valueTypeIri}") // TODO: implement remaining types. } diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/types/GravsearchTypeInspectionUtil.scala b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/types/GravsearchTypeInspectionUtil.scala index d95a146ff3..5252f614e6 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/types/GravsearchTypeInspectionUtil.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/types/GravsearchTypeInspectionUtil.scala @@ -77,6 +77,7 @@ object GravsearchTypeInspectionUtil { OntologyConstants.Xsd.Integer, OntologyConstants.Xsd.Decimal, OntologyConstants.Xsd.Uri, + OntologyConstants.Xsd.DateTimeStamp, OntologyConstants.KnoraApiV2Simple.Resource, OntologyConstants.KnoraApiV2Simple.Date, OntologyConstants.KnoraApiV2Simple.Geom, @@ -99,6 +100,7 @@ object GravsearchTypeInspectionUtil { OntologyConstants.KnoraApiV2Complex.GeonameValue, OntologyConstants.KnoraApiV2Complex.ColorValue, OntologyConstants.KnoraApiV2Complex.IntervalValue, + OntologyConstants.KnoraApiV2Complex.TimeValue, OntologyConstants.KnoraApiV2Complex.FileValue, OntologyConstants.KnoraApiV2Complex.KnoraProject ) diff --git a/webapi/src/main/scala/org/knora/webapi/routing/v1/ValuesRouteV1.scala b/webapi/src/main/scala/org/knora/webapi/routing/v1/ValuesRouteV1.scala index e18a8625f5..56a3779fa0 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/v1/ValuesRouteV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/v1/ValuesRouteV1.scala @@ -20,15 +20,16 @@ package org.knora.webapi.routing.v1 import java.io.File +import java.time.Instant import java.util.UUID -import akka.pattern._ import akka.http.scaladsl.model.Multipart import akka.http.scaladsl.model.Multipart.BodyPart import akka.http.scaladsl.server.Directives._ import akka.http.scaladsl.server.Route import akka.http.scaladsl.server.directives.FileInfo import akka.http.scaladsl.util.FastFuture +import akka.pattern._ import akka.stream.ActorMaterializer import akka.stream.scaladsl.FileIO import org.knora.webapi._ @@ -172,7 +173,11 @@ class ValuesRouteV1(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit if (timeVals.length != 2) throw BadRequestException("parameters for interval_value invalid") - Future(IntervalValueV1(timeVals(0), timeVals(1)), apiRequest.comment) + Future(IntervalValueV1(timeVals.head, timeVals(1)), apiRequest.comment) + + case OntologyConstants.KnoraBase.TimeValue => + val timeStamp: Instant = stringFormatter.xsdDateTimeStampToInstant(apiRequest.time_value.get, throw BadRequestException(s"Invalid timestamp: ${apiRequest.time_value.get}")) + Future(TimeValueV1(timeStamp), apiRequest.comment) case OntologyConstants.KnoraBase.GeonameValue => Future(GeonameValueV1(apiRequest.geom_value.get), apiRequest.comment) @@ -274,7 +279,11 @@ class ValuesRouteV1(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit if (timeVals.length != 2) throw BadRequestException("parameters for interval_value invalid") - Future(IntervalValueV1(timeVals(0), timeVals(1)), apiRequest.comment) + Future(IntervalValueV1(timeVals.head, timeVals(1)), apiRequest.comment) + + case OntologyConstants.KnoraBase.TimeValue => + val timeStamp: Instant = stringFormatter.xsdDateTimeStampToInstant(apiRequest.time_value.get, throw BadRequestException(s"Invalid timestamp: ${apiRequest.time_value.get}")) + Future(TimeValueV1(timeStamp), apiRequest.comment) case OntologyConstants.KnoraBase.GeonameValue => Future(GeonameValueV1(apiRequest.geom_value.get), apiRequest.comment) @@ -409,7 +418,7 @@ class ValuesRouteV1(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit val requestMessageFuture = for { userADM <- getUserADM(requestContext) request <- apiRequest match { - case ChangeValueApiRequestV1(_, _, _, _, _, _, _, _, _, _, _, _, Some(comment)) => FastFuture.successful(makeChangeCommentRequestMessage(valueIriStr = valueIriStr, comment = Some(comment), userADM = userADM)) + case ChangeValueApiRequestV1(_, _, _, _, _, _, _, _, _, _, _, _, _, Some(comment)) => FastFuture.successful(makeChangeCommentRequestMessage(valueIriStr = valueIriStr, comment = Some(comment), userADM = userADM)) case _ => makeAddValueVersionRequestMessage(valueIriStr = valueIriStr, apiRequest = apiRequest, userADM = userADM) } } yield request diff --git a/webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala b/webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala index dbf1d9ae21..381d503565 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala @@ -1019,6 +1019,13 @@ object ConstructResponseUtilV2 { comment = valueCommentOption )) + case OntologyConstants.KnoraBase.TimeValue => + FastFuture.successful(TimeValueContentV2( + ontologySchema = InternalSchema, + valueHasTimeStamp = valueObject.requireDateTimeObject(OntologyConstants.KnoraBase.ValueHasTimeStamp.toSmartIri), + comment = valueCommentOption + )) + case OntologyConstants.KnoraBase.LinkValue => makeLinkValueContentV2( valueObject = valueObject, diff --git a/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt b/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt index b53fd3dadf..d89c7326f1 100644 --- a/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt @@ -181,7 +181,7 @@ } - case timeValue: TimeValueV2 => { + case timeValue: TimeValueContentV2 => { <@newValueIri> knora-base:valueHasTimeStamp "@timeValue.valueHasTimeStamp"^^xsd:dateTime . diff --git a/webapi/src/main/twirl/xsd/v1/xmlImport.scala.xml b/webapi/src/main/twirl/xsd/v1/xmlImport.scala.xml index d8af12335a..69bbef120d 100644 --- a/webapi/src/main/twirl/xsd/v1/xmlImport.scala.xml +++ b/webapi/src/main/twirl/xsd/v1/xmlImport.scala.xml @@ -215,6 +215,12 @@ } + case OntologyConstants.KnoraBase.TimeValue => { + + type="@{knoraXmlImportNamespacePrefixLabel}:timeValueType" + + } + case OntologyConstants.KnoraBase.GeonameValue => { type="@{knoraXmlImportNamespacePrefixLabel}:geonameValueType" diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v1/ResourcesV1R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v1/ResourcesV1R2RSpec.scala index 8c73968dcb..eeb4b6f5be 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v1/ResourcesV1R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v1/ResourcesV1R2RSpec.scala @@ -451,6 +451,7 @@ class ResourcesV1R2RSpec extends R2RSpec { | "http://www.knora.org/ontology/0001/anything#hasColor": [{"color_value":"#4169E1"}], | "http://www.knora.org/ontology/0001/anything#hasListItem": [{"hlist_value":"http://rdfh.ch/lists/0001/treeList10"}], | "http://www.knora.org/ontology/0001/anything#hasInterval": [{"interval_value": [1000000000000000.0000000000000001, 1000000000000000.0000000000000002]}], + | "http://www.knora.org/ontology/0001/anything#hasTimeStamp": [{"time_value": "2019-08-28T15:13:10.968318Z"}], | "http://www.knora.org/ontology/0001/anything#hasBoolean": [{"boolean_value":true}] | } |} @@ -1723,6 +1724,13 @@ class ResourcesV1R2RSpec extends R2RSpec { |This is a test in thing $i. """.stripMargin) + maybeAppendValue(random = random, + xmlStringBuilder = xmlStringBuilder, + value = + s""" + |2019-08-28T15:13:10.968318Z + """.stripMargin) + maybeAppendValue(random = random, xmlStringBuilder = xmlStringBuilder, value = diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v1/ValuesV1R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v1/ValuesV1R2RSpec.scala index 8633b3c109..b900362f84 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v1/ValuesV1R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v1/ValuesV1R2RSpec.scala @@ -48,6 +48,7 @@ class ValuesV1R2RSpec extends R2RSpec { implicit def default(implicit system: ActorSystem): RouteTestTimeout = RouteTestTimeout(settings.defaultTimeout) private val integerValueIri = new MutableTestIri + private val timeValueIri = new MutableTestIri private val textValueIri = new MutableTestIri private val linkValueIri = new MutableTestIri private val textValueWithLangIri = new MutableTestIri @@ -106,6 +107,41 @@ class ValuesV1R2RSpec extends R2RSpec { } } + "add a time value to a resource" in { + val params = + """ + |{ + | "res_id": "http://rdfh.ch/0001/a-thing", + | "prop": "http://www.knora.org/ontology/0001/anything#hasTimeStamp", + | "time_value": "2019-08-28T14:40:17.215927Z" + |} + """.stripMargin + + Post("/v1/values", HttpEntity(ContentTypes.`application/json`, params)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, testPass)) ~> valuesPath ~> check { + assert(status == StatusCodes.OK, response.toString) + val responseJson: Map[String, JsValue] = responseAs[String].parseJson.asJsObject.fields + val valueIri: IRI = responseJson("id").asInstanceOf[JsString].value + timeValueIri.set(valueIri) + } + } + + "change a time value" in { + val params = + """ + |{ + | "res_id": "http://rdfh.ch/0001/a-thing", + | "prop": "http://www.knora.org/ontology/0001/anything#hasTimeStamp", + | "time_value": "2019-08-28T14:45:37.756142Z" + |} + """.stripMargin + + Put(s"/v1/values/${URLEncoder.encode(timeValueIri.get, "UTF-8")}", HttpEntity(ContentTypes.`application/json`, params)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, testPass)) ~> valuesPath ~> check { + assert(status == StatusCodes.OK, response.toString) + val responseJson: Map[String, JsValue] = responseAs[String].parseJson.asJsObject.fields + val valueIri: IRI = responseJson("id").asInstanceOf[JsString].value + timeValueIri.set(valueIri) + } + } "get a link value" in { Get(s"/v1/links/${URLEncoder.encode("http://rdfh.ch/0001/contained-thing-1", "UTF-8")}/${URLEncoder.encode("http://www.knora.org/ontology/0001/anything#isPartOfOtherThing", "UTF-8")}/${URLEncoder.encode("http://rdfh.ch/0001/containing-thing", "UTF-8")}") ~> addCredentials(BasicHttpCredentials(anythingUserEmail, testPass)) ~> valuesPath ~> check { diff --git a/webapi/src/test/scala/org/knora/webapi/responders/v1/ValuesResponderV1Spec.scala b/webapi/src/test/scala/org/knora/webapi/responders/v1/ValuesResponderV1Spec.scala index cca085518d..87a6d581f5 100644 --- a/webapi/src/test/scala/org/knora/webapi/responders/v1/ValuesResponderV1Spec.scala +++ b/webapi/src/test/scala/org/knora/webapi/responders/v1/ValuesResponderV1Spec.scala @@ -19,6 +19,7 @@ package org.knora.webapi.responders.v1 +import java.time.Instant import java.util.UUID import akka.actor.{ActorRef, Props} @@ -48,9 +49,6 @@ object ValuesResponderV1Spec { akka.stdout-loglevel = "DEBUG" """.stripMargin) - private val incunabulaProjectIri = INCUNABULA_PROJECT_IRI - private val anythingProjectIri = ANYTHING_PROJECT_IRI - private val zeitglöckleinIri = "http://rdfh.ch/0803/c5058f3a" private val miscResourceIri = "http://rdfh.ch/0803/miscResource" private val aThingIri = "http://rdfh.ch/0001/a-thing" @@ -88,6 +86,7 @@ class ValuesResponderV1Spec extends CoreSpec(ValuesResponderV1Spec.config) with private val secondValueIriWithResourceRef = new MutableTestIri private val standoffLinkValueIri = new MutableTestIri private val currentSeqnumValueIri = new MutableTestIri + private val currentTimeValueIri = new MutableTestIri private val currentPubdateValueIri = new MutableTestIri private val linkObjLinkValueIri = new MutableTestIri private val currentColorValueIri = new MutableTestIri @@ -1233,6 +1232,42 @@ class ValuesResponderV1Spec extends CoreSpec(ValuesResponderV1Spec.config) with } } + "add a new timestamp value" in { + + val timeStamp = Instant.parse("2019-08-28T15:13:10.968318Z") + + responderManager ! CreateValueRequestV1( + resourceIri = "http://rdfh.ch/0001/a-thing", + propertyIri = "http://www.knora.org/ontology/0001/anything#hasTimeStamp", + value = TimeValueV1(timeStamp), + userProfile = anythingUser, + apiRequestID = UUID.randomUUID + ) + + expectMsgPF(timeout) { + case CreateValueResponseV1(newValue: TimeValueV1, _, newValueIri: IRI, _) => + currentTimeValueIri.set(newValueIri) + newValue should ===(TimeValueV1(timeStamp)) + } + } + + "change an existing timestamp value" in { + + val timeStamp = Instant.parse("2019-08-28T15:55:22.213394Z") + + responderManager ! ChangeValueRequestV1( + value = TimeValueV1(timeStamp), + userProfile = anythingUser, + valueIri = currentTimeValueIri.get, + apiRequestID = UUID.randomUUID + ) + + expectMsgPF(timeout) { + case ChangeValueResponseV1(newValue: TimeValueV1, _, newValueIri: IRI, _) => + newValue should ===(TimeValueV1(timeStamp)) + } + } + "add a new Date value (pubdate of a book)" in { // great resource to verify that expected conversion result from and to JDC is correct: diff --git a/webapi/src/test/scala/org/knora/webapi/responders/v2/ValuesResponderV2Spec.scala b/webapi/src/test/scala/org/knora/webapi/responders/v2/ValuesResponderV2Spec.scala index 3839fda06a..29d14125ae 100644 --- a/webapi/src/test/scala/org/knora/webapi/responders/v2/ValuesResponderV2Spec.scala +++ b/webapi/src/test/scala/org/knora/webapi/responders/v2/ValuesResponderV2Spec.scala @@ -80,6 +80,7 @@ class ValuesResponderV2Spec extends CoreSpec() with ImplicitSender { private val lobComment1Iri = new MutableTestIri private val lobComment2Iri = new MutableTestIri private val decimalValueIri = new MutableTestIri + private val timeValueIri = new MutableTestIri private val dateValueIri = new MutableTestIri private val booleanValueIri = new MutableTestIri private val geometryValueIri = new MutableTestIri @@ -803,6 +804,49 @@ class ValuesResponderV2Spec extends CoreSpec() with ImplicitSender { } } + "create a time value" in { + // Add the value. + + val resourceIri: IRI = aThingIri + val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri + val valueHasTimeStamp = Instant.parse("2019-08-28T15:59:12.725007Z") + val maybeResourceLastModDate: Option[Instant] = getResourceLastModificationDate(resourceIri, anythingUser1) + + responderManager ! CreateValueRequestV2( + CreateValueV2( + resourceIri = resourceIri, + resourceClassIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing".toSmartIri, + propertyIri = propertyIri, + valueContent = TimeValueContentV2( + ontologySchema = ApiV2Complex, + valueHasTimeStamp = valueHasTimeStamp + ) + ), + requestingUser = anythingUser1, + apiRequestID = UUID.randomUUID + ) + + expectMsgPF(timeout) { + case createValueResponse: CreateValueResponseV2 => timeValueIri.set(createValueResponse.valueIri) + } + + // Read the value back to check that it was added correctly. + + val valueFromTriplestore = getValue( + resourceIri = resourceIri, + maybePreviousLastModDate = maybeResourceLastModDate, + propertyIriForGravsearch = propertyIri, + propertyIriInResult = propertyIri, + expectedValueIri = timeValueIri.get, + requestingUser = anythingUser1 + ) + + valueFromTriplestore.valueContent match { + case savedValue: TimeValueContentV2 => savedValue.valueHasTimeStamp should ===(valueHasTimeStamp) + case _ => throw AssertionException(s"Expected time value, got $valueFromTriplestore") + } + } + "create a date value" in { // Add the value. @@ -2606,6 +2650,73 @@ class ValuesResponderV2Spec extends CoreSpec() with ImplicitSender { } } + "update a time value" in { + val resourceIri: IRI = aThingIri + val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri + val valueHasTimeStamp = Instant.parse("2019-08-28T16:01:46.952237Z") + val maybeResourceLastModDate: Option[Instant] = getResourceLastModificationDate(resourceIri, anythingUser1) + + responderManager ! UpdateValueRequestV2( + UpdateValueContentV2( + resourceIri = resourceIri, + resourceClassIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing".toSmartIri, + propertyIri = propertyIri, + valueIri = timeValueIri.get, + valueContent = TimeValueContentV2( + ontologySchema = ApiV2Complex, + valueHasTimeStamp = valueHasTimeStamp + ) + ), + requestingUser = anythingUser1, + apiRequestID = UUID.randomUUID + ) + + expectMsgPF(timeout) { + case updateValueResponse: UpdateValueResponseV2 => timeValueIri.set(updateValueResponse.valueIri) + } + + // Read the value back to check that it was added correctly. + + val valueFromTriplestore = getValue( + resourceIri = resourceIri, + maybePreviousLastModDate = maybeResourceLastModDate, + propertyIriForGravsearch = propertyIri, + propertyIriInResult = propertyIri, + expectedValueIri = timeValueIri.get, + requestingUser = anythingUser1 + ) + + valueFromTriplestore.valueContent match { + case savedValue: TimeValueContentV2 => savedValue.valueHasTimeStamp should ===(valueHasTimeStamp) + case _ => throw AssertionException(s"Expected time value, got $valueFromTriplestore") + } + } + + "not update a time value without changing it" in { + val resourceIri: IRI = aThingIri + val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri + val valueHasTimeStamp = Instant.parse("2019-08-28T16:01:46.952237Z") + + responderManager ! UpdateValueRequestV2( + UpdateValueContentV2( + resourceIri = resourceIri, + resourceClassIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing".toSmartIri, + propertyIri = propertyIri, + valueIri = timeValueIri.get, + valueContent = TimeValueContentV2( + ontologySchema = ApiV2Complex, + valueHasTimeStamp = valueHasTimeStamp + ) + ), + requestingUser = anythingUser1, + apiRequestID = UUID.randomUUID + ) + + expectMsgPF(timeout) { + case msg: akka.actor.Status.Failure => msg.cause.isInstanceOf[DuplicateValueException] should ===(true) + } + } + "update a date value" in { val resourceIri: IRI = aThingIri val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasDate".toSmartIri From d6bfea7adcdc085fc48575bde81a7dc62a19255d Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Thu, 29 Aug 2019 15:49:40 +0200 Subject: [PATCH 04/26] feat(knora-ontologies): Add StandoffTimeTag. - Update OntologyV2R2RSpec. - Update RDF4J. --- knora-ontologies/knora-base.ttl | 10 + project/Dependencies.scala | 2 +- .../org/knora/webapi/OntologyConstants.scala | 1 + ...BaseToApiV2SimpleTransformationRules.scala | 3 + .../standoffmessages/StandoffMessagesV2.scala | 32 + .../util/standoff/StandoffTagUtilV2.scala | 41 + .../knoraApiOntologyWithValueObjects.jsonld | 219 ++ .../knoraApiOntologyWithValueObjects.rdf | 2966 +++++++++-------- .../knoraApiOntologyWithValueObjects.ttl | 121 + .../ontologyR2RV2/salsahGuiOntology.jsonld | 7 + .../ontologyR2RV2/salsahGuiOntology.rdf | 3 + .../ontologyR2RV2/salsahGuiOntology.ttl | 2 + .../webapi/e2e/v2/OntologyV2R2RSpec.scala | 1 + 13 files changed, 2012 insertions(+), 1396 deletions(-) diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index ebf3e997ef..92ae525cb5 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -2426,6 +2426,16 @@ rdfs:comment "Represents an interval in a TextValue"@en . +### http://www.knora.org/ontology/knora-base#StandoffTimeTag + +:StandoffTimeTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :TimeBase ; + + rdfs:comment "Represents a timestamp in a TextValue"@en . + + ### http://www.knora.org/ontology/knora-base#StandoffBooleanTag :StandoffBooleanTag rdf:type owl:Class ; diff --git a/project/Dependencies.scala b/project/Dependencies.scala index fa52633805..ef7e759505 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -121,7 +121,7 @@ object Dependencies { val xmlunitCore = "org.xmlunit" % "xmlunit-core" % "2.1.1" // other - val rdf4jRuntime = "org.eclipse.rdf4j" % "rdf4j-runtime" % "2.3.2" + val rdf4jRuntime = "org.eclipse.rdf4j" % "rdf4j-runtime" % "3.0.0" val scallop = "org.rogach" %% "scallop" % "3.2.0" val gwtServlet = "com.google.gwt" % "gwt-servlet" % "2.8.0" val saxonHE = "net.sf.saxon" % "Saxon-HE" % "9.9.0-2" diff --git a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala index 6560319cae..de388d37f5 100644 --- a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala +++ b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala @@ -377,6 +377,7 @@ object OntologyConstants { val StandoffIntegerTag: IRI = KnoraBasePrefixExpansion + "StandoffIntegerTag" val StandoffDecimalTag: IRI = KnoraBasePrefixExpansion + "StandoffDecimalTag" val StandoffIntervalTag: IRI = KnoraBasePrefixExpansion + "StandoffIntervalTag" + val StandoffTimeTag: IRI = KnoraBasePrefixExpansion + "StandoffTimeTag" val StandoffBooleanTag: IRI = KnoraBasePrefixExpansion + "StandoffBooleanTag" val StandoffLinkTag: IRI = KnoraBasePrefixExpansion + "StandoffLinkTag" val StandoffUriTag: IRI = KnoraBasePrefixExpansion + "StandoffUriTag" diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala index 5fd50ae9ac..8081734ff1 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala @@ -438,6 +438,7 @@ object KnoraBaseToApiV2SimpleTransformationRules extends OntologyTransformationR OntologyConstants.KnoraBase.ValueHasUri, OntologyConstants.KnoraBase.ValueHasIntervalStart, OntologyConstants.KnoraBase.ValueHasIntervalEnd, + OntologyConstants.KnoraBase.ValueHasTimeStamp, OntologyConstants.KnoraBase.ValueHasListNode, OntologyConstants.KnoraBase.Duration, OntologyConstants.KnoraBase.DimX, @@ -473,6 +474,7 @@ object KnoraBaseToApiV2SimpleTransformationRules extends OntologyTransformationR OntologyConstants.KnoraBase.IntBase, OntologyConstants.KnoraBase.DecimalBase, OntologyConstants.KnoraBase.IntervalBase, + OntologyConstants.KnoraBase.TimeBase, OntologyConstants.KnoraBase.ColorBase, OntologyConstants.KnoraBase.Value, OntologyConstants.KnoraBase.TextValue, @@ -485,6 +487,7 @@ object KnoraBaseToApiV2SimpleTransformationRules extends OntologyTransformationR OntologyConstants.KnoraBase.GeomValue, OntologyConstants.KnoraBase.ListValue, OntologyConstants.KnoraBase.IntervalValue, + OntologyConstants.KnoraBase.TimeValue, OntologyConstants.KnoraBase.LinkValue, OntologyConstants.KnoraBase.GeonameValue, OntologyConstants.KnoraBase.FileValue, diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala index 8dd60395a4..b644d8be35 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala @@ -19,6 +19,7 @@ package org.knora.webapi.messages.v2.responder.standoffmessages +import java.time.Instant import java.util.UUID import akka.actor.ActorRef @@ -307,6 +308,8 @@ object StandoffDataTypeClasses extends Enumeration { val StandoffIntervalTag: Value = Value(OntologyConstants.KnoraBase.StandoffIntervalTag) + val StandoffTimeTag: Value = Value(OntologyConstants.KnoraBase.StandoffTimeTag) + val StandoffBooleanTag: Value = Value(OntologyConstants.KnoraBase.StandoffBooleanTag) val StandoffInternalReferenceTag: Value = Value(OntologyConstants.KnoraBase.StandoffInternalReferenceTag) @@ -364,6 +367,11 @@ object StandoffProperties { OntologyConstants.KnoraBase.ValueHasIntervalEnd ) + // represents the standoff properties defined on the time standoff tag + val timeProperties: Set[IRI] = Set( + OntologyConstants.KnoraBase.ValueHasTimeStamp + ) + // represents the standoff properties defined on the boolean standoff tag val booleanProperties: Set[IRI] = Set(OntologyConstants.KnoraBase.ValueHasBoolean) @@ -561,6 +569,30 @@ case class StandoffTagBooleanAttributeV2(standoffPropertyIri: SmartIri, value: B } } +/** + * Represents a standoff tag attribute of type xsd:dateTimeStamp. + * + * @param standoffPropertyIri the IRI of the standoff property + * @param value the value of the standoff property. + */ +case class StandoffTagTimeAttributeV2(standoffPropertyIri: SmartIri, value: Instant) extends StandoffTagAttributeV2 { + + def stringValue: String = value.toString + + def rdfValue: String = value.toString + + override def toOntologySchema(targetSchema: OntologySchema): StandoffTagAttributeV2 = { + copy(standoffPropertyIri = standoffPropertyIri.toOntologySchema(targetSchema)) + } + + override def toJsonLD: (IRI, JsonLDValue) = { + standoffPropertyIri.toString -> JsonLDUtil.datatypeValueToJsonLDObject( + value = value.toString, + datatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri + ) + } +} + /** * Represents any subclass of a `knora-base:StandoffTag`. * diff --git a/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala b/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala index 9d8847c80b..a032416160 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala @@ -19,6 +19,7 @@ package org.knora.webapi.util.standoff +import java.time.Instant import java.util.UUID import akka.actor.ActorRef @@ -132,6 +133,9 @@ object StandoffTagUtilV2 { case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.Boolean))) => StandoffTagBooleanAttributeV2(standoffPropertyIri = standoffTagPropIri, value = stringFormatter.validateBoolean(attr.value, throw BadRequestException(s"Invalid boolean attribute: '${attr.value}'"))) + case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.DateTime))) => + StandoffTagTimeAttributeV2(standoffPropertyIri = standoffTagPropIri, value = stringFormatter.xsdDateTimeStampToInstant(attr.value, throw BadRequestException(s"Invalid timestamp attribute: '${attr.value}'"))) + case None => throw InconsistentTriplestoreDataException(s"did not find ${OntologyConstants.KnoraBase.ObjectDatatypeConstraint} for $standoffTagPropIri") case other => throw InconsistentTriplestoreDataException(s"triplestore returned unknown ${OntologyConstants.KnoraBase.ObjectDatatypeConstraint} '$other' for $standoffTagPropIri") @@ -578,6 +582,30 @@ object StandoffTagUtilV2 { attributes = attributesV2 ++ List(intervalStart, intervalEnd) ) + case Some(StandoffDataTypeClasses.StandoffTimeTag) => + + val timeStampString: String = getDataTypeAttribute(standoffDefFromMapping, StandoffDataTypeClasses.StandoffTimeTag, standoffNodeFromXML) + val timeStamp: Instant = stringFormatter.xsdDateTimeStampToInstant(timeStampString, throw BadRequestException(s"Invalid timestamp: $timeStampString")) + val timeStampAttr = StandoffTagTimeAttributeV2(standoffPropertyIri = OntologyConstants.KnoraBase.ValueHasTimeStamp.toSmartIri, value = timeStamp) + + val classSpecificProps = cardinalities -- StandoffProperties.systemProperties.map(_.toSmartIri) -- StandoffProperties.timeProperties.map(_.toSmartIri) + + val attributesV2: Seq[StandoffTagAttributeV2] = createAttributes(standoffDefFromMapping, classSpecificProps, existingXMLIDs, standoffNodeFromXML, standoffEntities.standoffPropertyInfoMap) + + StandoffTagV2( + dataType = Some(StandoffDataTypeClasses.StandoffTimeTag), + standoffTagClassIri = standoffBaseTagV2.standoffTagClassIri, + startPosition = standoffBaseTagV2.startPosition, + endPosition = standoffBaseTagV2.endPosition, + uuid = standoffBaseTagV2.uuid, + originalXMLID = standoffBaseTagV2.originalXMLID, + startIndex = standoffBaseTagV2.startIndex, + endIndex = standoffBaseTagV2.endIndex, + startParentIndex = standoffBaseTagV2.startParentIndex, + endParentIndex = standoffBaseTagV2.endParentIndex, + attributes = attributesV2 :+ timeStampAttr + ) + case Some(StandoffDataTypeClasses.StandoffDateTag) => val dateString: String = getDataTypeAttribute(standoffDefFromMapping, StandoffDataTypeClasses.StandoffDateTag, standoffNodeFromXML) @@ -806,6 +834,10 @@ object StandoffTagUtilV2 { case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.Boolean))) => StandoffTagBooleanAttributeV2(standoffPropertyIri = propSmartIri, value = value.toBoolean) + case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.DateTime))) => + val timeStamp = stringFormatter.xsdDateTimeStampToInstant(value, throw DataConversionException(s"Couldn't parse timestamp: $value")) + StandoffTagTimeAttributeV2(standoffPropertyIri = propSmartIri, value = timeStamp) + case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.Uri))) => StandoffTagUriAttributeV2(standoffPropertyIri = propSmartIri, value = value) @@ -956,6 +988,15 @@ object StandoffTagUtilV2 { convertStandoffAttributeTags(xmlItemForStandoffClass.attributes, conventionalAttributes) :+ StandoffTagAttribute(key = dataTypeAttrName, value = intervalString, xmlNamespace = None) + case Some(StandoffDataTypeClasses.StandoffTimeTag) => + val dataTypeAttrName = xmlItemForStandoffClass.tagItem.mapping.dataType.getOrElse(throw NotFoundException(s"data type attribute not found in mapping for ${xmlItemForStandoffClass.tagname}")).dataTypeXMLAttribute + + val timeString = standoffTagV2.attributes.find(_.standoffPropertyIri.toString == OntologyConstants.KnoraBase.ValueHasTimeStamp).get.stringValue + + val conventionalAttributes = standoffTagV2.attributes.filterNot(attr => StandoffProperties.timeProperties.contains(attr.standoffPropertyIri.toString)) + + convertStandoffAttributeTags(xmlItemForStandoffClass.attributes, conventionalAttributes) :+ StandoffTagAttribute(key = dataTypeAttrName, value = timeString, xmlNamespace = None) + case Some(StandoffDataTypeClasses.StandoffDateTag) => // create one attribute from date properties val dataTypeAttrName = xmlItemForStandoffClass.tagItem.mapping.dataType.getOrElse(throw NotFoundException(s"data type attribute not found in mapping for ${xmlItemForStandoffClass.tagname}")).dataTypeXMLAttribute diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld index d9c729eb64..88147005de 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld @@ -4148,6 +4148,93 @@ "@id" : "knora-api:standoffTagHasUUID" } } ] + }, { + "@id" : "knora-api:StandoffTimeTag", + "@type" : "owl:Class", + "knora-api:isStandoffClass" : true, + "rdfs:comment" : "Represents a timestamp in a TextValue", + "rdfs:subClassOf" : [ { + "@id" : "knora-api:StandoffDataTypeTag" + }, { + "@id" : "knora-api:TimeBase" + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasEnd" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasEndIndex" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasEndParent" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasEndParentIndex" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasOriginalXMLID" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasStart" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasStartIndex" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasStartParent" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasStartParentIndex" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:standoffTagHasUUID" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:timeValueAsTimeStamp" + } + } ] }, { "@id" : "knora-api:StandoffUriTag", "@type" : "owl:Class", @@ -4887,6 +4974,126 @@ "@id" : "knora-api:versionArkUrl" } } ] + }, { + "@id" : "knora-api:TimeBase", + "@type" : "owl:Class", + "rdfs:subClassOf" : [ { + "@id" : "knora-api:ValueBase" + }, { + "@type" : "owl:Restriction", + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:timeValueAsTimeStamp" + } + } ] + }, { + "@id" : "knora-api:TimeValue", + "@type" : "owl:Class", + "knora-api:isValueClass" : true, + "rdfs:comment" : "Represents a timestamp", + "rdfs:subClassOf" : [ { + "@id" : "knora-api:TimeBase" + }, { + "@id" : "knora-api:Value" + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:arkUrl" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:attachedToUser" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:deleteComment" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:deleteDate" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:deletedBy" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:hasPermissions" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:isDeleted" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:timeValueAsTimeStamp" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:userHasPermission" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:valueAsString" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:valueCreationDate" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:maxCardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:valueHasComment" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:valueHasUUID" + } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "owl:cardinality" : 1, + "owl:onProperty" : { + "@id" : "knora-api:versionArkUrl" + } + } ] }, { "@id" : "knora-api:UriBase", "@type" : "owl:Class", @@ -6595,6 +6802,18 @@ "rdfs:subPropertyOf" : { "@id" : "knora-api:valueHas" } + }, { + "@id" : "knora-api:timeValueAsTimeStamp", + "@type" : "owl:DatatypeProperty", + "knora-api:objectType" : { + "@id" : "xsd:dateTimeStamp" + }, + "knora-api:subjectType" : { + "@id" : "knora-api:TimeBase" + }, + "rdfs:subPropertyOf" : { + "@id" : "knora-api:valueHas" + } }, { "@id" : "knora-api:uriValueAsUri", "@type" : "owl:DatatypeProperty", diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf index 3a52f6fe11..8333f9f321 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf @@ -18,50 +18,50 @@ A generic class for representing annotations Annotation - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + true Represents something in the world, or an abstract thing Resource - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + true 1 @@ -72,7 +72,7 @@ - + true 1 @@ -83,7 +83,7 @@ - + true 1 @@ -94,7 +94,7 @@ - + true 1 @@ -105,7 +105,7 @@ - + true 1 @@ -115,7 +115,7 @@ - + true 1 @@ -125,7 +125,7 @@ - + true 1 @@ -135,7 +135,7 @@ - + 1 @@ -150,7 +150,7 @@ - + true 0 @@ -165,7 +165,7 @@ - + true 1 @@ -174,7 +174,7 @@ - + true 0 @@ -189,7 +189,7 @@ - + true 0 @@ -204,7 +204,7 @@ - + 1 @@ -218,7 +218,7 @@ - + 1 @@ -231,7 +231,7 @@ - + true 1 @@ -241,7 +241,7 @@ - + true 1 @@ -250,7 +250,7 @@ - + true 1 @@ -261,7 +261,7 @@ - + true 1 @@ -272,7 +272,7 @@ - + true 1 @@ -283,7 +283,7 @@ - + true 1 @@ -292,53 +292,53 @@ true Represents an audio file - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + true - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + true 1 - + true 1 - + 1 @@ -350,22 +350,22 @@ - + true 1 - + true 1 - + true 1 - + true 1 @@ -378,7 +378,7 @@ - + true 1 @@ -391,22 +391,22 @@ - + true 1 - + true 1 - + true 1 - + true 1 @@ -417,7 +417,7 @@ - + true 1 @@ -428,7 +428,7 @@ - + true 1 @@ -440,7 +440,7 @@ - + true 1 @@ -452,7 +452,7 @@ - + true 1 @@ -462,85 +462,85 @@ Represents a file containing audio data Representation (Audio) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + true A resource that can store a file Representation - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -555,62 +555,62 @@ - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + - + 1 @@ -627,105 +627,105 @@ Represents a boolean value - - - - - - - - - - - - - - + + + + + + + + + + + + + + true The base class of classes representing Knora values - - - - - - - - - - - - - + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -733,7 +733,7 @@ - + 1 @@ -752,87 +752,87 @@ Represents a color in HTML format, e.g. "#33eeff" - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -841,93 +841,93 @@ true This represents some 3D-object with mesh data, point cloud, etc. - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -937,61 +937,61 @@ Represents a file containg 3D data Representation (3D) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -1006,69 +1006,69 @@ - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - - - - - - - - - + + + + + + + + + - + 1 @@ -1080,7 +1080,7 @@ - + 1 @@ -1092,7 +1092,7 @@ - + 1 @@ -1104,7 +1104,7 @@ - + 1 @@ -1116,7 +1116,7 @@ - + 1 @@ -1128,7 +1128,7 @@ - + 1 @@ -1140,7 +1140,7 @@ - + 1 @@ -1152,7 +1152,7 @@ - + 1 @@ -1164,7 +1164,7 @@ - + 1 @@ -1181,135 +1181,135 @@ Represents a Knora date value - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1317,7 +1317,7 @@ - + 1 @@ -1336,87 +1336,87 @@ Represents an arbitrary-precision decimal value - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1424,93 +1424,93 @@ true - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1519,61 +1519,61 @@ true Representation (Document) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -1588,125 +1588,125 @@ - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 - + 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1716,110 +1716,110 @@ A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see. A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see. - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 0 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1828,47 +1828,47 @@ true Represents a geometrical objects as JSON string - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -1880,42 +1880,42 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1923,47 +1923,47 @@ true - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -1975,42 +1975,42 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2018,7 +2018,7 @@ - + 1 @@ -2037,97 +2037,97 @@ Represents an integer value - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - - + + - + 1 @@ -2139,7 +2139,7 @@ - + 1 @@ -2156,93 +2156,93 @@ Represents a time interval, e.g. in an audio recording - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2254,72 +2254,72 @@ Represents a generic link object Link Object - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 0 - + true 0 - + 1 @@ -2334,7 +2334,7 @@ - + 1 @@ -2349,47 +2349,47 @@ - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2399,60 +2399,60 @@ A reification node that describes direct links between resources - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -2464,7 +2464,7 @@ - + 1 @@ -2476,7 +2476,7 @@ - + 1 @@ -2488,7 +2488,7 @@ - + 1 @@ -2500,103 +2500,103 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 Represents a flat or hierarchical list - - + + - + 1 - + 1 true - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -2608,32 +2608,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2642,72 +2642,72 @@ true Represents a moving image file - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -2719,7 +2719,7 @@ - + 1 @@ -2731,7 +2731,7 @@ - + 1 @@ -2743,7 +2743,7 @@ - + 1 @@ -2755,32 +2755,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2790,66 +2790,66 @@ A resource containing moving image data Representation (Movie) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + 1 @@ -2864,47 +2864,47 @@ - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -2916,65 +2916,65 @@ Represents a geometric region of a resource. The geometry is represented currently as JSON string. Region - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -2990,11 +2990,11 @@ - + 1 - + 1 @@ -3009,32 +3009,32 @@ - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + 1 @@ -3049,7 +3049,7 @@ - + 1 @@ -3064,67 +3064,67 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -3138,121 +3138,121 @@ - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 0 - + 1 - + 0 - + 0 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 @@ -3261,39 +3261,39 @@ Represents a boolean in a TextValue - - - - - - - - - - - + + + + + + + + + + + true Represents a knora-base value type in a TextValue - - - - - - - - - - + + + + + + + + + + - + true 1 - + true 1 @@ -3303,7 +3303,7 @@ - + true 1 @@ -3313,7 +3313,7 @@ - + true 1 @@ -3323,7 +3323,7 @@ - + true 1 @@ -3335,7 +3335,7 @@ - + true 1 @@ -3345,7 +3345,7 @@ - + true 1 @@ -3355,7 +3355,7 @@ - + true 1 @@ -3365,7 +3365,7 @@ - + true 1 @@ -3376,7 +3376,7 @@ - + true 1 @@ -3388,7 +3388,7 @@ - + true 1 @@ -3403,69 +3403,69 @@ Represents a color in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3473,63 +3473,63 @@ true Represents a standoff markup tag - - - - - - - - - - + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3539,117 +3539,117 @@ Represents a date in a TextValue - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3659,69 +3659,69 @@ Represents a decimal (floating point) value in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3731,69 +3731,69 @@ Represents an integer value in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3803,39 +3803,39 @@ Represents an internal reference in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -3844,32 +3844,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3879,75 +3879,75 @@ Represents an interval in a TextValue - - - - - - - - - - - - + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -3956,39 +3956,39 @@ true Represents a reference to a Knora resource in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -3997,148 +3997,230 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 + + true + Represents a timestamp in a TextValue + + + + + + + + + + + + + + + + + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + + + + + true Represents an arbitrary URI in a TextValue - - - - - - - - - - - + + + + + + + + + + + - + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -4155,71 +4237,71 @@ true A file containing a two-dimensional still image - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -4231,7 +4313,7 @@ - + 1 @@ -4243,7 +4325,7 @@ - + 1 @@ -4255,32 +4337,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -4290,81 +4372,81 @@ A resource that can contain a two-dimensional still image file Representation (Image) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + 1 @@ -4379,32 +4461,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -4413,93 +4495,93 @@ true A text file such as plain Unicode text, LaTeX, TEI/XML, etc. - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -4509,81 +4591,81 @@ A resource containing a text file Representation (Text) - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + 1 @@ -4598,32 +4680,32 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -4631,63 +4713,63 @@ true - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -4699,7 +4781,7 @@ - + 1 @@ -4711,7 +4793,7 @@ - + 1 @@ -4723,7 +4805,7 @@ - + 1 @@ -4735,7 +4817,7 @@ - + 1 @@ -4747,7 +4829,7 @@ - + 1 @@ -4759,7 +4841,7 @@ - + 0 @@ -4771,37 +4853,131 @@ - + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + 1 + + + + true + Represents a timestamp + + + + + + + + + + + + + + + + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + + true + 1 + + + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 @@ -4810,140 +4986,140 @@ Represents a URI - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 - + 1 @@ -4952,110 +5128,110 @@ a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML. a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML. - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl index 5b71c60c08..c943d583d4 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl @@ -2898,6 +2898,66 @@ knora-api:standoffTagHasLink a owl:ObjectProperty; knora-api:objectType knora-api:Resource; knora-api:subjectType knora-api:StandoffLinkTag . +knora-api:StandoffTimeTag a owl:Class; + knora-api:isStandoffClass true; + rdfs:comment "Represents a timestamp in a TextValue"; + rdfs:subClassOf knora-api:StandoffDataTypeTag, knora-api:TimeBase, [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:standoffTagHasEnd + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasEndIndex + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasEndParent + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasEndParentIndex + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasOriginalXMLID + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:standoffTagHasStart + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:standoffTagHasStartIndex + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasStartParent + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:standoffTagHasStartParentIndex + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:standoffTagHasUUID + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:timeValueAsTimeStamp + ] . + +knora-api:TimeBase a owl:Class; + rdfs:subClassOf knora-api:ValueBase, [ a owl:Restriction; + owl:cardinality 1; + owl:onProperty knora-api:timeValueAsTimeStamp + ] . + +knora-api:timeValueAsTimeStamp a owl:DatatypeProperty; + knora-api:objectType xsd:dateTimeStamp; + knora-api:subjectType knora-api:TimeBase; + rdfs:subPropertyOf knora-api:valueHas . + knora-api:StandoffUriTag a owl:Class; knora-api:isStandoffClass true; rdfs:comment "Represents an arbitrary URI in a TextValue"; @@ -3420,6 +3480,67 @@ knora-api:textValueHasStandoff a owl:ObjectProperty; rdfs:label "text value has standoff"; rdfs:subPropertyOf knora-api:valueHas . +knora-api:TimeValue a owl:Class; + knora-api:isValueClass true; + rdfs:comment "Represents a timestamp"; + rdfs:subClassOf knora-api:TimeBase, knora-api:Value, [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:arkUrl + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:attachedToUser + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:deleteComment + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:deleteDate + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:deletedBy + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:hasPermissions + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:isDeleted + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:timeValueAsTimeStamp + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:userHasPermission + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:valueAsString + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:valueCreationDate + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:valueHasComment + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:valueHasUUID + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:cardinality 1; + owl:onProperty knora-api:versionArkUrl + ] . + knora-api:UriValue a owl:Class; knora-api:isValueClass true; rdfs:comment "Represents a URI"; diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.jsonld b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.jsonld index acee0308aa..afaa2bf696 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.jsonld +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.jsonld @@ -123,6 +123,13 @@ }, { "@id" : "owl:NamedIndividual" } ] + }, { + "@id" : "salsah-gui:TimeStamp", + "rdf:type" : [ { + "@id" : "salsah-gui:Guielement" + }, { + "@id" : "owl:NamedIndividual" + } ] }, { "@id" : "salsah-gui:guiAttribute", "@type" : "owl:DatatypeProperty", diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.rdf b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.rdf index 3bf89bf705..be34b9cfbb 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.rdf +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.rdf @@ -84,6 +84,9 @@ + + + diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.ttl b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.ttl index 50151618a9..d755429361 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.ttl +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.ttl @@ -54,6 +54,8 @@ salsah-gui:Textarea a salsah-gui:Guielement, owl:NamedIndividual; salsah-gui:guiAttributeDefinition "cols:integer", "rows:integer", "width:percent", "wrap:string(soft|hard)" . +salsah-gui:TimeStamp a salsah-gui:Guielement, owl:NamedIndividual . + salsah-gui:guiAttribute a owl:DatatypeProperty; knora-api:objectType xsd:string . diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala index 5c613421be..a8fcf932d4 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala @@ -497,6 +497,7 @@ class OntologyV2R2RSpec extends R2RSpec { "http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasName".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasOtherListItem".toSmartIri, + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri, "http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval".toSmartIri, "http://www.w3.org/2000/01/rdf-schema#label".toSmartIri, "http://api.knora.org/ontology/knora-api/v2#versionDate".toSmartIri, From 52825e32a039ef28cf3fcfb16e5a45007be89cc9 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Thu, 29 Aug 2019 17:20:42 +0200 Subject: [PATCH 05/26] test(ontology-responder): Fix OntologyResponderV2Spec. --- .../org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala b/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala index 88bea1bfce..7c032b74cf 100644 --- a/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala +++ b/webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala @@ -2090,6 +2090,7 @@ class OntologyResponderV2Spec extends CoreSpec() with ImplicitSender { "http://0.0.0.0:3333/ontology/0001/anything/v2#hasColor", "http://0.0.0.0:3333/ontology/0001/anything/v2#hasThingPicture", "http://0.0.0.0:3333/ontology/0001/anything/v2#hasInterval", + "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp", "http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem", "http://0.0.0.0:3333/ontology/0001/anything/v2#isPartOfOtherThingValue", "http://0.0.0.0:3333/ontology/0001/anything/v2#hasUri" From 79afa386205fa8ac8eeec1fb9fe90c3aa3d7b742 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 30 Aug 2019 12:23:17 +0200 Subject: [PATCH 06/26] fix(store): Replace deprecated class. --- .../webapi/store/triplestore/embedded/JenaTDBActor.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/store/triplestore/embedded/JenaTDBActor.scala b/webapi/src/main/scala/org/knora/webapi/store/triplestore/embedded/JenaTDBActor.scala index 5d69f328c5..8af9c252f4 100644 --- a/webapi/src/main/scala/org/knora/webapi/store/triplestore/embedded/JenaTDBActor.scala +++ b/webapi/src/main/scala/org/knora/webapi/store/triplestore/embedded/JenaTDBActor.scala @@ -438,7 +438,7 @@ class JenaTDBActor extends Actor with ActorLogging { // Lucene, on disk //val indexDirectory: Directory = new SimpleFSDirectory(new File(luceneIndexPath.getAbsolutePath)) - val indexDirectory: Directory = new RAMDirectory() + val indexDirectory: Directory = new ByteBuffersDirectory() TextDatasetFactory.createLucene(ds, indexDirectory, entDef, null) } else { @@ -449,7 +449,7 @@ class JenaTDBActor extends Actor with ActorLogging { val ds = TDBFactory.createDataset() // Lucene, in memory. - val indexDirectory: Directory = new RAMDirectory() + val indexDirectory: Directory = new ByteBuffersDirectory() TextDatasetFactory.createLucene(ds, indexDirectory, entDef, null) } From 212cae1ae2ef35ea94c132eb1daa44848c4df388 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 30 Aug 2019 12:54:19 +0200 Subject: [PATCH 07/26] test: Add anything:Thing resources with time values for testing. --- webapi/_test_data/all_data/anything-data.ttl | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/webapi/_test_data/all_data/anything-data.ttl b/webapi/_test_data/all_data/anything-data.ttl index 8307990433..d5233c6133 100644 --- a/webapi/_test_data/all_data/anything-data.ttl +++ b/webapi/_test_data/all_data/anything-data.ttl @@ -520,6 +520,44 @@ knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; knora-base:creationDate "2016-03-02T15:05:10Z"^^xsd:dateTime . + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with a timestamp"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-08-30T10:45:40Z"^^xsd:dateTime ; + anything:hasTimeStamp . + + a knora-base:TimeValue; + knora-base:valueHasUUID "OBsgI4gkQx67aLeaMjOYEg"^^xsd:string; + knora-base:isDeleted false; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:valueCreationDate "2019-08-30T10:45:47.173572Z"^^xsd:dateTime; + knora-base:valueHasTimeStamp "2019-08-30T10:45:26.365863Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2019-08-30T10:45:26.365863Z"; + knora-base:attachedToUser . + + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "Another thing with a timestamp"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2016-03-02T15:05:10Z"^^xsd:dateTime ; + anything:hasTimeStamp . + + a knora-base:TimeValue; + knora-base:valueHasUUID "9br5Xy7TTWi6I0uMBOCIfw"^^xsd:string; + knora-base:isDeleted false; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:valueCreationDate "2019-08-30T10:47:23.420867Z"^^xsd:dateTime; + knora-base:valueHasTimeStamp "2019-08-30T10:47:20.684093Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2019-08-30T10:47:20.684093Z"; + knora-base:attachedToUser . + a anything:ThingPicture; knora-base:isDeleted false; knora-base:attachedToUser ; From 58729bef1580af9738c0b18bacc944a24028de9b Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 30 Aug 2019 14:21:34 +0200 Subject: [PATCH 08/26] feat(api-v1): Support time values in extended search. - Fix code that searches for decimal values. --- .../responders/v1/SearchResponderV1.scala | 14 ++++ .../sparql/v1/searchExtendedGraphDB.scala.txt | 64 ++++++++++++++++--- .../v1/searchExtendedStandard.scala.txt | 64 ++++++++++++++++--- .../knora/webapi/e2e/v1/SearchV1R2RSpec.scala | 18 +++++- 4 files changed, 141 insertions(+), 19 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v1/SearchResponderV1.scala b/webapi/src/main/scala/org/knora/webapi/responders/v1/SearchResponderV1.scala index b7cd38e69e..27e426ae9f 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v1/SearchResponderV1.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v1/SearchResponderV1.scala @@ -99,6 +99,15 @@ class SearchResponderV1(responderData: ResponderData) extends Responder(responde SearchComparisonOperatorV1.EQ, SearchComparisonOperatorV1.NOT_EQ, SearchComparisonOperatorV1.EXISTS + ), + OntologyConstants.KnoraBase.TimeValue -> Set( + SearchComparisonOperatorV1.EQ, + SearchComparisonOperatorV1.NOT_EQ, + SearchComparisonOperatorV1.GT, + SearchComparisonOperatorV1.GT_EQ, + SearchComparisonOperatorV1.LT, + SearchComparisonOperatorV1.LT_EQ, + SearchComparisonOperatorV1.EXISTS ) ) @@ -447,6 +456,11 @@ class SearchResponderV1(responderData: ResponderData) extends Responder(responde val searchString = stringFormatter.validateBigDecimal(searchval, throw BadRequestException(s"Given searchval is not a decimal number: $searchval")).toString searchParamWithoutValue.copy(searchValue = Some(searchString)) + case OntologyConstants.KnoraBase.TimeValue => + // check if string is an integer + val searchString = stringFormatter.xsdDateTimeStampToInstant(searchval, throw BadRequestException(s"Given searchval is not a timestamp: $searchval")).toString + searchParamWithoutValue.copy(searchValue = Some(searchString)) + case OntologyConstants.KnoraBase.Resource => // check if string is a valid IRI val searchString = stringFormatter.validateAndEscapeIri(searchval, throw BadRequestException(s"Given searchval is not a valid IRI: $searchval")) diff --git a/webapi/src/main/twirl/queries/sparql/v1/searchExtendedGraphDB.scala.txt b/webapi/src/main/twirl/queries/sparql/v1/searchExtendedGraphDB.scala.txt index 93552a46b2..e5c6d2f9df 100644 --- a/webapi/src/main/twirl/queries/sparql/v1/searchExtendedGraphDB.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v1/searchExtendedGraphDB.scala.txt @@ -194,7 +194,15 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasDecimal @searchCriterion.searchValue . + ?valueObject@index knora-base:valueHasDecimal "@searchCriterion.searchValue"^^xsd:decimal . + + BIND('@searchCriterion.searchValue' AS ?literal@index) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp "@searchCriterion.searchValue"^^xsd:dateTime . BIND('@searchCriterion.searchValue' AS ?literal@index) @@ -309,7 +317,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index != @searchCriterion.searchValue) + FILTER (?literal@index != "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index != "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -354,7 +370,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index > searchCriterion.searchValue ) + FILTER (?literal@index > "@searchCriterion.searchValue"^^xsd:decimal ) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index > "@searchCriterion.searchValue"^^xsd:dateTime ) } @@ -390,7 +414,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index >= @searchCriterion.searchValue) + FILTER (?literal@index >= "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index >= "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -434,9 +466,17 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasInteger ?literal@index . + ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index < @searchCriterion.searchValue) + FILTER (?literal@index < "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index < "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -470,9 +510,17 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasInteger ?literal@index . + ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index <= @searchCriterion.searchValue) + FILTER (?literal@index <= "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index <= "@searchCriterion.searchValue"^^xsd:dateTime) } diff --git a/webapi/src/main/twirl/queries/sparql/v1/searchExtendedStandard.scala.txt b/webapi/src/main/twirl/queries/sparql/v1/searchExtendedStandard.scala.txt index 3895d8b470..9b82d1733d 100644 --- a/webapi/src/main/twirl/queries/sparql/v1/searchExtendedStandard.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v1/searchExtendedStandard.scala.txt @@ -203,7 +203,15 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasDecimal @searchCriterion.searchValue . + ?valueObject@index knora-base:valueHasDecimal "@searchCriterion.searchValue"^^xsd:decimal . + + BIND('@searchCriterion.searchValue' AS ?literal@index) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp "@searchCriterion.searchValue"^^xsd:dateTime . BIND('@searchCriterion.searchValue' AS ?literal@index) @@ -295,7 +303,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index != @searchCriterion.searchValue) + FILTER (?literal@index != "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index != "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -340,7 +356,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index > searchCriterion.searchValue ) + FILTER (?literal@index > "@searchCriterion.searchValue"^^xsd:decimal ) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index > "@searchCriterion.searchValue"^^xsd:dateTime ) } @@ -376,7 +400,15 @@ WHERE { ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index >= @searchCriterion.searchValue) + FILTER (?literal@index >= "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index >= "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -410,9 +442,17 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasInteger ?literal@index . + ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index < @searchCriterion.searchValue) + FILTER (?literal@index < "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index < "@searchCriterion.searchValue"^^xsd:dateTime) } @@ -446,9 +486,17 @@ WHERE { case "http://www.knora.org/ontology/knora-base#DecimalValue" => { - ?valueObject@index knora-base:valueHasInteger ?literal@index . + ?valueObject@index knora-base:valueHasDecimal ?literal@index . - FILTER (?literal@index <= @searchCriterion.searchValue) + FILTER (?literal@index <= "@searchCriterion.searchValue"^^xsd:decimal) + + } + + case "http://www.knora.org/ontology/knora-base#TimeValue" => { + + ?valueObject@index knora-base:valueHasTimeStamp ?literal@index . + + FILTER (?literal@index <= "@searchCriterion.searchValue"^^xsd:dateTime) } diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala index c7d186c770..0d3a1f4587 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala @@ -132,7 +132,6 @@ class SearchV1R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - // this is the negation of the query condition above, hence the size of the result set must be 19 (total of incunabula:book) minus 4 (number of results from query below) checkNumberOfHits(responseAs[String], 15) } @@ -148,7 +147,6 @@ class SearchV1R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - // this is the negation of the query condition above, hence the size of the result set must be 19 (total of incunabula:book) minus 15 (number of results from query above) checkNumberOfHits(responseAs[String], 4) } @@ -164,7 +162,6 @@ class SearchV1R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - // this is the negation of the query condition above, hence the size of the result set must be 19 (total of incunabula:book) minus 18 (number of results from query below) checkNumberOfHits(responseAs[String], 1) } @@ -278,6 +275,21 @@ class SearchV1R2RSpec extends R2RSpec { } + "perform an extended search for an anything:Thing with a timestamp" in { + + val props = "&property_id=http%3A%2F%2Fwww.knora.org%2Fontology%2F0001%2Fanything%23hasTimeStamp&compop=GT&searchval=2019-08-30T10%3A45%3A26.365863Z" + val filter = "&show_nrows=25&start_at=0&filter_by_restype=http%3A%2F%2Fwww.knora.org%2Fontology%2F0001%2Fanything%23Thing" + + Get("/v1/search/?searchtype=extended" + props + filter) ~> searchPath ~> check { + + assert(status == StatusCodes.OK, response.toString) + + checkNumberOfHits(responseAs[String], 1) + + } + + } + } } \ No newline at end of file From 4b7a01fe9b55c4a6478d9aaf4eb674a822cc352c Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 30 Aug 2019 15:50:12 +0200 Subject: [PATCH 09/26] feat(api-v2): Support time values in Gravsearch. --- .../prequery/AbstractPrequeryGenerator.scala | 19 +++++- .../sparql/v2/isOntologyUsed.scala.txt | 2 +- .../searchR2RV2/ThingWithTimeStamp.jsonld | 58 ++++++++++++++++++ .../webapi/e2e/v2/SearchRouteV2R2RSpec.scala | 60 +++++++++++++++++++ 4 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 webapi/src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala index af836d99c0..8a351ac791 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala @@ -533,6 +533,7 @@ abstract class AbstractPrequeryGenerator(typeInspectionResult: GravsearchTypeIns OntologyConstants.KnoraApiV2Complex.TextValue -> OntologyConstants.KnoraBase.ValueHasString, OntologyConstants.KnoraApiV2Complex.IntValue -> OntologyConstants.KnoraBase.ValueHasInteger, OntologyConstants.KnoraApiV2Complex.DecimalValue -> OntologyConstants.KnoraBase.ValueHasDecimal, + OntologyConstants.KnoraApiV2Complex.TimeValue -> OntologyConstants.KnoraBase.ValueHasTimeStamp, OntologyConstants.KnoraApiV2Complex.BooleanValue -> OntologyConstants.KnoraBase.ValueHasBoolean, OntologyConstants.KnoraApiV2Complex.DateValue -> OntologyConstants.KnoraBase.ValueHasStartJDN, OntologyConstants.KnoraApiV2Complex.ColorValue -> OntologyConstants.KnoraBase.ValueHasColor, @@ -709,9 +710,15 @@ abstract class AbstractPrequeryGenerator(typeInspectionResult: GravsearchTypeIns Seq.empty[StatementPattern] } + // We use xsd:dateTimeStamp in Gravsearch, but xsd:dateTime in the triplestore. + val transformedXsdLiteral = if (literal.datatype.toString == OntologyConstants.Xsd.DateTimeStamp) { + literal.copy(datatype = OntologyConstants.Xsd.DateTime.toSmartIri) + } else { + literal + } TransformedFilterPattern( - Some(CompareExpression(valueObjectLiteralVar, comparisonOperator, literal)), // compares the provided literal to the value object's literal value + Some(CompareExpression(valueObjectLiteralVar, comparisonOperator, transformedXsdLiteral)), // compares the provided literal to the value object's literal value statementToAddForValueHas ) @@ -925,6 +932,16 @@ abstract class AbstractPrequeryGenerator(typeInspectionResult: GravsearchTypeIns valueHasProperty = OntologyConstants.KnoraBase.ValueHasDecimal ) + case OntologyConstants.Xsd.DateTimeStamp => + + handleLiteralQueryVar( + queryVar = queryVar, + comparisonOperator = compareExpression.operator, + literalValueExpression = compareExpression.rightArg, + xsdType = Set(OntologyConstants.Xsd.DateTimeStamp), + valueHasProperty = OntologyConstants.KnoraBase.ValueHasTimeStamp + ) + case OntologyConstants.Xsd.Boolean => handleLiteralQueryVar( diff --git a/webapi/src/main/twirl/queries/sparql/v2/isOntologyUsed.scala.txt b/webapi/src/main/twirl/queries/sparql/v2/isOntologyUsed.scala.txt index 1fda26ba67..09f25ffa18 100644 --- a/webapi/src/main/twirl/queries/sparql/v2/isOntologyUsed.scala.txt +++ b/webapi/src/main/twirl/queries/sparql/v2/isOntologyUsed.scala.txt @@ -125,4 +125,4 @@ WHERE { } } -LIMIT 50 +LIMIT 60 diff --git a/webapi/src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld b/webapi/src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld new file mode 100644 index 0000000000..3181baa387 --- /dev/null +++ b/webapi/src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld @@ -0,0 +1,58 @@ +{ + "@id" : "http://rdfh.ch/0001/GIi77e3NS76UyJH3uL6DrQ", + "@type" : "anything:Thing", + "anything:hasTimeStamp" : { + "@id" : "http://rdfh.ch/0001/GIi77e3NS76UyJH3uL6DrQ/values/9br5Xy7TTWi6I0uMBOCIfw", + "@type" : "knora-api:TimeValue", + "knora-api:arkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/GIi77e3NS76UyJH3uL6DrQ4/9br5Xy7TTWi6I0uMBOCIfwB" + }, + "knora-api:attachedToUser" : { + "@id" : "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ" + }, + "knora-api:hasPermissions" : "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser", + "knora-api:timeValueAsTimeStamp" : { + "@type" : "xsd:dateTimeStamp", + "@value" : "2019-08-30T10:47:20.684093Z" + }, + "knora-api:userHasPermission" : "M", + "knora-api:valueCreationDate" : { + "@type" : "xsd:dateTimeStamp", + "@value" : "2019-08-30T10:47:23.420867Z" + }, + "knora-api:valueHasUUID" : "9br5Xy7TTWi6I0uMBOCIfw", + "knora-api:versionArkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/GIi77e3NS76UyJH3uL6DrQ4/9br5Xy7TTWi6I0uMBOCIfwB.20190830T104723420867Z" + } + }, + "knora-api:arkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/GIi77e3NS76UyJH3uL6DrQ4" + }, + "knora-api:attachedToProject" : { + "@id" : "http://rdfh.ch/projects/0001" + }, + "knora-api:attachedToUser" : { + "@id" : "http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q" + }, + "knora-api:creationDate" : { + "@type" : "xsd:dateTimeStamp", + "@value" : "2016-03-02T15:05:10Z" + }, + "knora-api:hasPermissions" : "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser", + "knora-api:userHasPermission" : "CR", + "knora-api:versionArkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/GIi77e3NS76UyJH3uL6DrQ4.20160302T150510Z" + }, + "rdfs:label" : "Another thing with a timestamp", + "@context" : { + "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + "xsd" : "http://www.w3.org/2001/XMLSchema#", + "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + } +} \ No newline at end of file diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala index 8ed57562c3..b5eb41c72b 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala @@ -205,6 +205,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasDate ?date . @@ -242,6 +246,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasDate ?date . @@ -1707,6 +1715,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -1750,6 +1762,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -4422,6 +4438,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -5313,6 +5333,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasDate ?date . @@ -5348,6 +5372,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasDate ?date . @@ -5383,6 +5411,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | ?thing anything:hasDecimal ?decimal . | @@ -6512,6 +6544,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { | | ?thing a anything:Thing . | + | FILTER NOT EXISTS { + | ?thing anything:hasTimeStamp ?timeStamp . + | } + | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -7889,5 +7925,29 @@ class SearchRouteV2R2RSpec extends R2RSpec { xmlDiff.hasDifferences should be(false) } } + + "search for an anything:Thing with a time value (using the simple schema)" in { + val gravsearchQuery = + s""" + |PREFIX knora-api: + |PREFIX anything: + | + |CONSTRUCT { + | ?thing knora-api:isMainResource true . + | ?thing anything:hasTimeStamp ?timeStamp . + |} WHERE { + | ?thing a anything:Thing . + | ?thing anything:hasTimeStamp ?timeStamp . + | FILTER(?timeStamp > "2019-08-30T10:45:26.365863Z"^^xsd:dateTimeStamp) + |} + """.stripMargin + + Post("/v2/searchextended", HttpEntity(SparqlQueryConstants.`application/sparql-query`, gravsearchQuery)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> searchPath ~> check { + val searchResponseStr = responseAs[String] + assert(status == StatusCodes.OK, searchResponseStr) + val expectedAnswerJSONLD = readOrWriteTextFile(searchResponseStr, new File("src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld"), writeTestDataFiles) + compareJSONLDForResourcesResponse(expectedJSONLD = expectedAnswerJSONLD, receivedJSONLD = searchResponseStr) + } + } } } From 6d32e2d1e9120505ba4d7de6947aee02bdd72fcc Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 30 Aug 2019 17:07:07 +0200 Subject: [PATCH 10/26] feat(upgrade): Add upgrade plugin. --- knora-ontologies/knora-base.ttl | 2 +- .../pr1403/knora-ontologies/knora-admin.ttl | 781 +++++ .../pr1403/knora-ontologies/knora-base.ttl | 2749 +++++++++++++++++ .../pr1403/knora-ontologies/salsah-gui.ttl | 244 ++ .../pr1403/knora-ontologies/standoff-onto.ttl | 356 +++ upgrade/plugins/pr1403/update.py | 27 + upgrade/updatelib/rdftools.py | 3 - .../main/scala/org/knora/webapi/package.scala | 2 +- 8 files changed, 4159 insertions(+), 5 deletions(-) create mode 100644 upgrade/plugins/pr1403/knora-ontologies/knora-admin.ttl create mode 100644 upgrade/plugins/pr1403/knora-ontologies/knora-base.ttl create mode 100644 upgrade/plugins/pr1403/knora-ontologies/salsah-gui.ttl create mode 100644 upgrade/plugins/pr1403/knora-ontologies/standoff-onto.ttl create mode 100644 upgrade/plugins/pr1403/update.py diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index 92ae525cb5..0c1b954689 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -33,7 +33,7 @@ :attachedToProject knora-admin:SystemProject ; - :ontologyVersion "PR 1372" . + :ontologyVersion "PR 1403" . diff --git a/upgrade/plugins/pr1403/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1403/knora-ontologies/knora-admin.ttl new file mode 100644 index 0000000000..3bf3c8988d --- /dev/null +++ b/upgrade/plugins/pr1403/knora-ontologies/knora-admin.ttl @@ -0,0 +1,781 @@ +# Copyright © 2015-2019 the contributors (see Contributors.md). +# +# This file is part of Knora. +# +# Knora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Knora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Knora. If not, see . + +@prefix : . +@prefix knora-base: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xml: . +@prefix xsd: . +@prefix foaf: . +@prefix dcterms: . +@base . + + rdf:type owl:Ontology ; + + rdfs:label "The Knora admin ontology"@en ; + + knora-base:attachedToProject :SystemProject . + + +################################################################# +# +# Object Properties +# +################################################################# + + + +### http://www.knora.org/ontology/knora-admin#belongsToInstitution + +:belongsToInstitution rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates which Institution a project belongs to."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectClassConstraint :Institution . + + + +### http://www.knora.org/ontology/knora-admin#belongsToProject + +:belongsToProject rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates which project a group belongs to."@en ; + + knora-base:subjectClassConstraint :UserGroup ; + + knora-base:objectClassConstraint :knoraProject . + + + +### http://www.knora.org/ontology/knora-admin#currentproject + +:currentproject rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectClassConstraint :knoraProject . + + + +### http://www.knora.org/ontology/knora-admin#isInGroup + +:isInGroup rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The given user is part of the given group."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectClassConstraint :UserGroup . + + + +### http://www.knora.org/ontology/knora-admin#isInProject + +:isInProject rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The given user is part of the given project."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectClassConstraint :knoraProject . + + + +### http://www.knora.org/ontology/knora-admin#isAdminForProject + +:isInProjectAdminGroup rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The given user is part of the given project's ProjectAdmin group."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectClassConstraint :knoraProject . + + + +################################################################# +# +# Datatype properties +# +################################################################# + + +### http://www.knora.org/ontology/knora-admin#address + +:address rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + knora-base:objectDatatypeConstraint xsd:string ; + + rdfs:comment "The address of a person or an institution"@en . + + +### http://www.knora.org/ontology/knora-admin#groupName + +:groupName rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The group's name."@en ; + + knora-base:subjectClassConstraint :UserGroup ; + + knora-base:objectDatatypeConstraint xsd:string ; + + rdfs:subPropertyOf . + + + +### http://www.knora.org/ontology/knora-admin#groupDescription + +:groupDescription rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "A description of a user group"@en ; + + knora-base:subjectClassConstraint :UserGroup ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled + +:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Exists and is true if users can add themselves to the project or group."@en ; + + # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. + + knora-base:objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-admin#institutionName + +:institutionName rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The institutions's name."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :Institution ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#institutionDescription + +:institutionDescription rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "A description of an institution."@en ; + + knora-base:subjectClassConstraint :Institution ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#institutionWebsite + +:institutionWebsite rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The URL of a web site."@en ; + + knora-base:subjectClassConstraint :Institution ; + + knora-base:objectDatatypeConstraint xsd:anyURI . + + + +### http://www.knora.org/ontology/knora-admin#isActiveUser + +:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-admin#givenName + +:givenName rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The user's given name."@en ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#familyName + +:familyName rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The user's family name."@en ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#password + +:password rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "An encrypted credential for access"@en ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#phone + +:phone rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The phone number of a person, institution, etc."@en ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#preferredLanguage + +:preferredLanguage rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The ISO 639-1 code of the user's preferred language."@en ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#projectDescription + +:projectDescription rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "A description of a Knora project."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#projectKeyword + +:projectKeyword rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "A keyword describing a project."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#projectLongname + +:projectLongname rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The longname of a Knora project."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#projectLogo + +:projectLogo rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The path to the projects's logo."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize + +:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark + +:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The path to the restricted view watermark."@en ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-admin#projectShortname + +:projectShortname rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The unique shortname of a Knora project."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#projectShortcode + +:projectShortcode rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The unique short code of a Knora project."@en ; + + rdfs:subPropertyOf ; + + knora-base:subjectClassConstraint :knoraProject ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#username + +:username rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The username and login name of a user."@en ; + + knora-base:subjectClassConstraint :User ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#email + +:email rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The email address and login name of a user."@en ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-admin#status + +:status rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)."@en ; + + knora-base:objectDatatypeConstraint xsd:boolean . + + + +################################################################# +# +# Classes +# +################################################################# + + + +### http://www.knora.org/ontology/knora-admin#Institution + +:Institution rdf:type owl:Class ; + + rdfs:subClassOf foaf:Organization , + [ rdf:type owl:Restriction ; + owl:onProperty :institutionName ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :institutionDescription ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :institutionWebsite ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :phone ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :address ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :email ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "An institution that has data in Knora."@en . + + + +### http://www.knora.org/ontology/knora-admin#User + +:User rdf:type owl:Class ; + + rdfs:subClassOf foaf:Person , + [ rdf:type owl:Restriction ; + owl:onProperty :username ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :email ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :familyName ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :givenName ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :password ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :preferredLanguage ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :status ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isInProject ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isInGroup ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isInSystemAdminGroup ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a Knora user."@en . + + + +### http://www.knora.org/ontology/knora-admin#UserGroup + +:UserGroup rdf:type owl:Class ; + + rdfs:subClassOf foaf:Group , + [ rdf:type owl:Restriction ; + owl:onProperty :groupName ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :groupDescription ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :status ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :belongsToProject ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSelfJoinEnabled ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "A group of Knora users."@en . + + + + +### http://www.knora.org/ontology/knora-admin#knoraProject + +:knoraProject rdf:type owl:Class ; + + rdfs:subClassOf foaf:Project , + [ rdf:type owl:Restriction ; + owl:onProperty :projectShortname ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectShortcode ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectLongname ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectDescription ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectKeyword ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectLogo ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectRestrictedViewSize ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :projectRestrictedViewWatermark ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :belongsToInstitution ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :status ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasSelfJoinEnabled ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a project that uses Knora."@en . + + + + +################################################################# +# +# Individuals +# +################################################################# + +### http://www.knora.org/ontology/knora-admin#UnknownUser +:UnknownUser rdf:type :UserGroup ; + :groupName "UnknownUser" ; + :status "true"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#KnownUser +:KnownUser rdf:type :UserGroup ; + :groupName "KnownUser" ; + :status "true"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#Creator +:Creator rdf:type :UserGroup ; + :groupName "Creator" ; + :status "true"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#ProjectMember +:ProjectMember rdf:type :UserGroup ; + :groupName "ProjectMember" ; + :status "true"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#ProjectAdmin +:ProjectAdmin rdf:type :UserGroup ; + :groupName "ProjectAdmin" ; + :status "true"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#SystemAdmin +:SystemAdmin rdf:type :UserGroup ; + :groupName "SystemAdmin" ; + :belongsToProject :SystemProject ; + :status "true"^^xsd:boolean ; + :hasSelfJoinEnabled "false"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#SystemUser +:SystemUser rdf:type :User ; + rdfs:comment "A built-in system user."@en ; + :username "system"; + :email "system@localhost" ; + :givenName "Knora" ; + :familyName "System" ; + :password "-" ; + :status "true"^^xsd:boolean ; + :preferredLanguage "en" ; + :isInSystemAdminGroup "false"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#AnonymousUser +:AnonymousUser rdf:type :User ; + rdfs:comment "A built-in anonymous user."@en ; + :username "anonymous" ; + :email "anonymous@localhost" ; + :givenName "Knora" ; + :familyName "Anonymous" ; + :password "-" ; + :status "true"^^xsd:boolean ; + :preferredLanguage "en" ; + :isInSystemAdminGroup "false"^^xsd:boolean . + +### http://www.knora.org/ontology/knora-admin#SystemProject +:SystemProject rdf:type :knoraProject ; + rdfs:comment "A built-in project representing the Knora System."@en ; + :projectShortname "SystemProject" ; + :projectShortcode "FFFF" ; + :projectLongname "Knora System Project" ; + :projectDescription "Knora System Project"@en ; + :status "true"^^xsd:boolean ; + :hasSelfJoinEnabled "false"^^xsd:boolean . + + +### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject +:DefaultSharedOntologiesProject rdf:type :knoraProject ; + rdfs:comment "The default project for shared ontologies."@en ; + :projectShortname "DefaultSharedOntologiesProject" ; + :projectShortcode "0000" ; + :projectLongname "Knora Default Shared Ontologies Project" ; + :projectDescription "Knora Shared Ontologies Project"@en ; + :status "true"^^xsd:boolean ; + :hasSelfJoinEnabled "false"^^xsd:boolean . + +# +## +### Permission Class Properties +## +# +### http://www.knora.org/ontology/knora-admin#forProject + +:forProject rdf:type rdf:Property ; + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + rdfs:comment "Permission property pointing to a knoraProject."@en ; + knora-base:subjectClassConstraint :Permission ; + knora-base:objectClassConstraint :knoraProject . + +### http://www.knora.org/ontology/knora-admin#forGroup +:forGroup rdf:type rdf:Property ; + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + rdfs:comment "Permission property pointing to a UserGroup."@en ; + knora-base:subjectClassConstraint :Permission ; + knora-base:objectClassConstraint :UserGroup . + +### http://www.knora.org/ontology/knora-admin#forResourceClass +:forResourceClass rdf:type rdf:Property ; + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + rdfs:comment "Permission property pointing to a resource class."@en ; + knora-base:subjectClassConstraint :Permission . + +### http://www.knora.org/ontology/knora-admin#forProperty +:forProperty rdf:type rdf:Property ; + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + rdfs:comment "Permission property pointing to a resource property."@en ; + knora-base:subjectClassConstraint :Permission . + + +# +## +### Permission Class and Sub-Classes +## +# +### http://www.knora.org/ontology/knora-admin#Permission +:Permission rdf:type owl:Class ; + rdfs:comment "Base Permission class."@en. + + +### http://www.knora.org/ontology/knora-admin#AdministrativePermission +:AdministrativePermission rdf:type owl:Class ; + rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; + rdfs:subClassOf :Permission . + +### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission +:DefaultObjectAccessPermission rdf:type owl:Class ; + rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; + rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1403/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1403/knora-ontologies/knora-base.ttl new file mode 100644 index 0000000000..0c1b954689 --- /dev/null +++ b/upgrade/plugins/pr1403/knora-ontologies/knora-base.ttl @@ -0,0 +1,2749 @@ +# Copyright © 2015-2019 the contributors (see Contributors.md). +# +# This file is part of Knora. +# +# Knora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Knora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Knora. If not, see . + +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xml: . +@prefix xsd: . +@prefix foaf: . +@prefix dcterms: . +@prefix salsah-gui: . +@prefix knora-admin: . +@base . + + rdf:type owl:Ontology ; + + rdfs:label "The Knora base ontology"@en ; + + :attachedToProject knora-admin:SystemProject ; + + :ontologyVersion "PR 1403" . + + + +################################################################# +# +# Properties +# +################################################################# + + + +### http://www.knora.org/ontology/knora-base#ontologyVersion + +:ontologyVersion rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; + + :subjectClassConstraint owl:Ontology ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#isMainResource + +# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API + +:isMainResource rdf:type owl:DatatypeProperty ; + + rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en; + + :subjectClassConstraint :Resource ; + + :objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted + +:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; + + rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . + + + +### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint + +:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; + + rdfs:comment "Specifies the type required as the object of a datatype property"@en . + + + +### http://www.knora.org/ontology/knora-base#resourceIcon + +:resourceIcon rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint owl:Class ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#resourceProperty + +:resourceProperty rdf:type owl:ObjectProperty ; + + rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; + + :subjectClassConstraint :Resource . + + + +### http://www.knora.org/ontology/knora-base#subjectClassConstraint + +:subjectClassConstraint rdf:type owl:ObjectProperty ; + + rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . + + + +### http://www.knora.org/ontology/knora-base#objectClassConstraint + +:objectClassConstraint rdf:type owl:ObjectProperty ; + + rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . + + + +### http://www.knora.org/ontology/knora-base#isEditable + +:isEditable rdf:type owl:AnnotationProperty ; + + :objectDatatypeConstraint xsd:boolean ; + + rdfs:label "is editable"@en ; + + rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . + + + +### http://www.knora.org/ontology/knora-base#canBeInstantiated + +:canBeInstantiated rdf:type owl:AnnotationProperty ; + + :subjectClassConstraint owl:Class ; + + :objectDatatypeConstraint xsd:boolean ; + + rdfs:label "can be instantiated"@en ; + + rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . + + + +### http://www.knora.org/ontology/knora-base#attachedToProject + +:attachedToProject rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "attached to project"@en ; + + rdfs:comment "Connects something to a project"@en ; + + :objectClassConstraint knora-admin:knoraProject . + + + +### http://www.knora.org/ontology/knora-base#attachedToUser + +:attachedToUser rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "attached to user"@en ; + + rdfs:comment "Connects something to a user"@en ; + + :objectClassConstraint knora-admin:User . + + +### http://www.knora.org/ontology/knora-base#hasColor + +:hasColor rdf:type owl:ObjectProperty ; + + rdfs:label "Farbe"@de , + "Color"@en , + "Couleur"@fr , + "Colore"@it ; + + rdfs:comment """Specifies the color of a region."""@en ; + + salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; + + :objectClassConstraint :ColorValue ; + + :subjectClassConstraint :Region ; + + rdfs:subPropertyOf :hasValue ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Colorpicker . + + + +### http://www.knora.org/ontology/knora-base#hasComment + +:hasComment rdf:type owl:ObjectProperty ; + + rdfs:label "Kommentar"@de , + "Comment"@en , + "Commentaire"@fr , + "Commento"@it ; + + rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; + + :subjectClassConstraint :Resource ; + + :objectClassConstraint :TextValue ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Richtext ; + + rdfs:subPropertyOf :hasValue . + + + +### http://www.knora.org/ontology/knora-base#hasExtResValue + +:hasExtResValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat externen Wert"@de , + "has external Value"@en , + "a valeur externe"@fr , + "ha valore esterno"@it ; + + :objectClassConstraint :ExternalResValue ; + + :subjectClassConstraint :ExternalResource ; + + rdfs:subPropertyOf :hasValue . + + +### http://www.knora.org/ontology/knora-base#hasFileValue + +:hasFileValue rdf:type owl:ObjectProperty ; + + :objectClassConstraint :FileValue ; + + rdfs:label "hat Datei"@de , + "has file"@en , + "a fichier"@fr , + "ha file"@it ; + + rdfs:comment "Connects a Representation to a file"@en ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + :subjectClassConstraint :Representation ; + + rdfs:subPropertyOf :hasValue . + + + +### http://www.knora.org/ontology/knora-base#hasStillImageFileValue + +:hasStillImageFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Bilddatei"@de , + "has image file"@en , + "a fichier d'image"@fr , + "ha file imagine"@it ; + + rdfs:comment "Connects a Representation to an image file"@en ; + + :objectClassConstraint :StillImageFileValue ; + + :subjectClassConstraint :StillImageRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue + +:hasMovingImageFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Filmdatei"@de , + "has movie file"@en , + "a fichier de film"@fr , + "ha file film"@it ; + + rdfs:comment "Connects a Representation to a movie file"@en ; + + :objectClassConstraint :MovingImageFileValue ; + + :subjectClassConstraint :MovingImageRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasAudioFileValue + +:hasAudioFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Audiodatei"@de , + "has audio file"@en , + "a fichier d'audio"@fr , + "ha file audio"@it ; + + rdfs:comment "Connects a Representation to an audio file"@en ; + + :objectClassConstraint :AudioFileValue ; + + :subjectClassConstraint :AudioRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasDDDFileValue + +:hasDDDFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat 3D-Datei"@de , + "has 3D-file"@en , + "a ficher de 3D"@fr , + "ha file 3D"@it ; + + rdfs:comment "Connects a Representation to a 3D-file"@en ; + + :objectClassConstraint :DDDFileValue ; + + :subjectClassConstraint :DDDRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasTextFileValue + +:hasTextFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Textdatei"@de , + "has text file"@en , + "a fichier de texte"@fr , + "ha file testo"@it ; + + rdfs:comment "Connects a Representation to a text file"@en ; + + :objectClassConstraint :TextFileValue ; + + :subjectClassConstraint :TextRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasDocumentFileValue + +:hasDocumentFileValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Dokument"@de , + "has document"@en , + "a document"@fr , + "ha documento"@it ; + + rdfs:comment "Connects a Representation to a document"@en ; + + :objectClassConstraint :DocumentFileValue ; + + :subjectClassConstraint :DocumentRepresentation ; + + :isEditable true ; + + salsah-gui:guiElement salsah-gui:Fileupload ; + + rdfs:subPropertyOf :hasFileValue . + + + +### http://www.knora.org/ontology/knora-base#hasGeometry + +:hasGeometry rdf:type owl:ObjectProperty ; + + rdfs:label "Geometrie"@de , + "Geometry"@en , + "Géometrie"@fr , + "Geometria"@it ; + + rdfs:comment """Represents a geometrical shape."""@en ; + + rdfs:subPropertyOf :hasValue ; + + salsah-gui:guiElement salsah-gui:Geometry ; + + :isEditable true ; + + :objectClassConstraint :GeomValue ; + + :subjectClassConstraint :Region . + + + +### http://www.knora.org/ontology/knora-base#hasLinkTo + +:hasLinkTo rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :resourceProperty ; + + rdfs:label "hat Link zu"@de , + "has Link to"@en , + "a lien vers"@fr , + "ha Link verso"@it ; + + rdfs:comment "Represents a direct connection between two resources"@en ; + + :isEditable true ; + + :objectClassConstraint :Resource ; + + :subjectClassConstraint :Resource . + + + +### http://www.knora.org/ontology/knora-base#hasLinkToValue + +:hasLinkToValue rdf:type owl:ObjectProperty ; + + rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; + + rdfs:label "hat Link zu"@de , + "has Link to"@en , + "a lien vers"@fr , + "ha Link verso"@it ; + + rdfs:comment "Represents a direct connection between two resources"@en ; + + :isEditable true ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Resource ; + + rdfs:subPropertyOf :hasValue . + + + +### http://www.knora.org/ontology/knora-base#hasRepresentation + +:hasRepresentation rdf:type owl:ObjectProperty ; + + rdfs:label "hat Repräsentation"@de , + "has Representation"@en , + "a Répresentation"@fr , + "ha Rappresentazione"@it ; + + rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; + + :objectClassConstraint :Representation ; + + :subjectClassConstraint :Resource ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkTo . + + + +### http://www.knora.org/ontology/knora-base#hasRepresentationValue + +:hasRepresentationValue rdf:type owl:ObjectProperty ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Resource ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkToValue . + + + + +### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo + +:hasStandoffLinkTo rdf:type owl:ObjectProperty ; + + rdfs:label "hat Standoff Link zu"@de , + "has Standoff Link to"@en , + "a standoff lien vers"@fr , + "ha standoff link verso"@it ; + + rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , + "Represents a link in standoff markup from one resource to another."@en ; + + :objectClassConstraint :Resource ; + + :subjectClassConstraint :Resource ; + + rdfs:subPropertyOf :hasLinkTo . + + + +### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue + +:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; + + rdfs:label "hat Standoff Link zu"@de , + "has Standoff Link to"@en , + "a standoff lien vers"@fr , + "ha standoff link verso"@it ; + + rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , + "Represents a link in standoff markup from one resource to another."@en ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Resource ; + + rdfs:subPropertyOf :hasLinkToValue . + + + +### http://www.knora.org/ontology/knora-base#standoffTagHasLink + +:standoffTagHasLink rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectClassConstraint :Resource ; + + :subjectClassConstraint :StandoffLinkTag . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference + +:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectClassConstraint :StandoffTag ; + + :subjectClassConstraint :StandoffInternalReferenceTag . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasStart + +:standoffTagHasStart rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectDatatypeConstraint xsd:integer . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasEnd + +:standoffTagHasEnd rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectDatatypeConstraint xsd:integer . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex + +:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectDatatypeConstraint xsd:integer . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex + +:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor + +:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectClassConstraint :StandoffTag . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent + +:standoffTagHasStartParent rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; + + :subjectClassConstraint :StandoffTag ; + + :objectClassConstraint :StandoffTag . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent + +:standoffTagHasEndParent rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectClassConstraint :StandoffTag . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasUUID + +:standoffTagHasUUID rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :StandoffTag ; + + :objectDatatypeConstraint xsd:string . + + +:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :Value ; + + :objectDatatypeConstraint xsd:integer . + + +### http://www.knora.org/ontology/knora-base#hasSubListNode + +:hasSubListNode rdf:type owl:ObjectProperty ; + + rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectClassConstraint :ListNode ; + + :subjectClassConstraint :ListNode . + + +### http://www.knora.org/ontology/knora-base#hasValue + +:hasValue rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :resourceProperty ; + + :subjectClassConstraint :Resource ; + + :objectClassConstraint :Value . + + +### http://www.knora.org/ontology/knora-base#isAnnotationOf + +:isAnnotationOf rdf:type owl:ObjectProperty ; + + rdfs:label "ist Annotation von"@de , + "is Annotation of"@en , + "est Annotation de"@fr , + "è Annotation di"@it ; + + :subjectClassConstraint :Annotation ; + + :objectClassConstraint :Resource ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkTo . + + + +### http://www.knora.org/ontology/knora-base#isAnnotationOfValue + +:isAnnotationOfValue rdf:type owl:ObjectProperty ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Annotation ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkToValue . + + + +### http://www.knora.org/ontology/knora-base#isPartOf + +:isPartOf rdf:type owl:ObjectProperty ; + + rdfs:label "ist Teil von"@de , + "is part of"@en , + "fait partie de"@fr , + "fa parte di"@it ; + + rdfs:comment "Indicates that this resource is part of another resource"@en ; + + :subjectClassConstraint :Resource ; + + :objectClassConstraint :Resource ; + + rdfs:subPropertyOf :hasLinkTo . + + + +### http://www.knora.org/ontology/knora-base#isPartOfValue + +:isPartOfValue rdf:type owl:ObjectProperty ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Resource ; + + rdfs:subPropertyOf :hasLinkToValue . + + + +### http://www.knora.org/ontology/knora-base#isRegionOf + +:isRegionOf rdf:type owl:ObjectProperty ; + + rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; + + rdfs:label "is Region von"@de , + "is region of"@en , + "est région de"@fr , + "è regione di"@it ; + + :subjectClassConstraint :Region ; + + :objectClassConstraint :Representation ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkTo . + + + +### http://www.knora.org/ontology/knora-base#isRegionOfValue + +:isRegionOfValue rdf:type owl:ObjectProperty ; + + rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; + + rdfs:label "is Region von"@de , + "is region of"@en , + "est région de"@fr , + "è regione di"@it ; + + :objectClassConstraint :LinkValue ; + + :subjectClassConstraint :Region ; + + :isEditable true ; + + rdfs:subPropertyOf :hasLinkToValue . + + + +### http://www.knora.org/ontology/knora-base#previousValue + +:previousValue rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :valueHas ; + + rdfs:comment "Points to the previous verson of a value"@en ; + + :subjectClassConstraint :Value ; + + :objectClassConstraint :Value . + + + +### http://www.knora.org/ontology/knora-base#seqnum + +:seqnum rdf:type owl:ObjectProperty ; + + :objectClassConstraint :IntValue ; + + rdfs:subPropertyOf :hasValue ; + + rdfs:label "Sequenznummer"@de , + "Sequence number"@en , + "Numéro de séquence"@fr , + "Numero di sequenza"@it ; + + rdfs:comment "Indicates the position of a resource within a sequence"@en . + + +### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID + +:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectDatatypeConstraint xsd:string ; + + :subjectClassConstraint :StandoffTag . + + + +### http://www.knora.org/ontology/knora-base#valueHasStandoff + +:valueHasStandoff rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :valueHas ; + + :objectClassConstraint :StandoffTag ; + + :subjectClassConstraint :TextValue . + + +### http://www.knora.org/ontology/knora-base#valueHasLanguage + +:valueHasLanguage rdf:type owl:DatatypeProperty ; + + :objectDatatypeConstraint xsd:string ; + + :subjectClassConstraint :TextValue . + + +### http://www.knora.org/ontology/knora-base#valueHasMapping + +:valueHasMapping rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :valueHas ; + + :objectClassConstraint :XMLToStandoffMapping ; + + :subjectClassConstraint :TextValue . + + +### http://www.knora.org/ontology/knora-base#hasMappingElement + +:hasMappingElement rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "mapping element"@en ; + + rdfs:comment """Represents an element in a mapping"""@en ; + + :subjectClassConstraint :XMLToStandoffMapping ; + + :objectClassConstraint :MappingElement . + + +### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname + +:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "name of the XML tag"@en ; + + rdfs:comment """name of the XML tag"""@en ; + + :subjectClassConstraint :MappingElement ; + + :objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace + +:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "namespace of the XML tag"@en ; + + rdfs:comment """namespace of the XML tag"""@en ; + + :subjectClassConstraint :MappingComponent ; + + :objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-base#mappingHasXMLClass + +:mappingHasXMLClass rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "class of the XML tag"@en ; + + rdfs:comment """class of the XML tag"""@en ; + + :subjectClassConstraint :MappingElement ; + + :objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass + +:mappingHasStandoffClass rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "IRI of the standoff class"@en ; + + rdfs:comment """IRI of the standoff class"""@en ; + + :subjectClassConstraint :MappingComponent ; + + :objectClassConstraint owl:Class . + + +### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute + +:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "name of the XML attribute"@en ; + + rdfs:comment """name of the XML attribute"""@en ; + + :subjectClassConstraint :MappingElement ; + + :objectClassConstraint :MappingXMLAttribute . + + +### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename + +:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "name of the XML attribute"@en ; + + rdfs:comment """name of the XML attribute"""@en ; + + :subjectClassConstraint :MappingComponent ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty + +:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "IRI of the standoff property"@en ; + + rdfs:comment """IRI of the standoff property"""@en ; + + :subjectClassConstraint :MappingXMLAttribute . + + +### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass + +:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "datatype of the XML tag"@en ; + + rdfs:comment """datatype of the XML tag"""@en ; + + :subjectClassConstraint :MappingElement ; + + :objectClassConstraint :MappingStandoffDataTypeClass . + + +### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator + +:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "indicates if the element requires a separator in the text"@en ; + + rdfs:comment """indicates if the element requires a separator in the text"""@en ; + + :subjectClassConstraint :MappingElement ; + + :objectDatatypeConstraint xsd:boolean . + + +### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation + +:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:label "default XSL Transformation"@en ; + + rdfs:comment """default XSL Transformation for this mapping"""@en ; + + :subjectClassConstraint :XMLToStandoffMapping ; + + :objectClassConstraint :XSLTransformation . + + +### http://www.knora.org/ontology/knora-base#deletedBy + +:deletedBy rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates who deleted a resource or value"@en ; + + # No :subjectClassConstraint, because this can be used with :Resource or :Value. + + :objectClassConstraint knora-admin:User . + + +################################################################# +# +# Datatype properties +# +################################################################# + + +### http://www.knora.org/ontology/knora-base#creationDate + +:creationDate rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates when a resource was created"@en ; + + :subjectClassConstraint :Resource ; + + :objectDatatypeConstraint xsd:dateTime . + + + +### http://www.knora.org/ontology/knora-base#deleteDate + +:deleteDate rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Indicates when a resource or value was deleted"@en ; + + # No :subjectClassConstraint, because this can be used with :Resource or :Value. + + :objectDatatypeConstraint xsd:dateTime . + + +### http://www.knora.org/ontology/knora-base#dimX + +:dimX rdf:type owl:DatatypeProperty ; + + :subjectClassConstraint :FileValue ; + + rdfs:subPropertyOf :valueHas ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#dimY + +:dimY rdf:type owl:DatatypeProperty ; + + :subjectClassConstraint :FileValue ; + + rdfs:subPropertyOf :valueHas ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#duration + +:duration rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :FileValue ; + + :objectDatatypeConstraint xsd:decimal . + + + +### http://www.knora.org/ontology/knora-base#extResAccessInfo + +:extResAccessInfo rdf:type owl:DatatypeProperty ; + + rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :ExternalResValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#extResId + +:extResId rdf:type owl:DatatypeProperty ; + + rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :ExternalResValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#extResProvider + +:extResProvider rdf:type owl:DatatypeProperty ; + + rdfs:comment "The name of the external provider of the resource"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :ExternalResValue ; + + :objectDatatypeConstraint xsd:string . + + + + +### http://www.knora.org/ontology/knora-base#fps + +:fps rdf:type owl:DatatypeProperty ; + + rdfs:label "Frames per second"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :MovingImageFileValue ; + + :objectDatatypeConstraint xsd:decimal . + + + +### http://www.knora.org/ontology/knora-base#internalFilename + +:internalFilename rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :FileValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#internalMimeType + +:internalMimeType rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :FileValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#isDeleted + +:isDeleted rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + rdfs:comment "Exists and is true if the resource has been deleted"@en ; + + # No :subjectClassConstraint, because this can be used with :Resource or :Value. + + :objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-base#isRootNode + +:isRootNode rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :ListNode ; + + :objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-base#hasRootNode + +:hasRootNode rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :ListNode ; + + :objectDatatypeConstraint :ListNode . + + + + +### http://www.knora.org/ontology/knora-base#lastModificationDate + +:lastModificationDate rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectDatatypeConstraint xsd:dateTime . + + + +### http://www.knora.org/ontology/knora-base#listNodePosition + +:listNodePosition rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :ListNode ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#listNodeName + +:listNodeName rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :subjectClassConstraint :ListNode ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#originalFilename + +:originalFilename rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :FileValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#originalMimeType + +:originalMimeType rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :FileValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasComment + +:valueHasComment rdf:type owl:DatatypeProperty ; + + rdfs:comment "A comment on a value"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :Value ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#deleteComment + +:deleteComment rdf:type owl:DatatypeProperty ; + + rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + # No :subjectClassConstraint, because this can be used with :Resource or :Value. + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueCreationDate + +:valueCreationDate rdf:type owl:DatatypeProperty ; + + :subjectClassConstraint :Value ; + + rdfs:subPropertyOf :valueHas ; + + :objectDatatypeConstraint xsd:dateTime . + + + +### http://www.knora.org/ontology/knora-base#valueHas + +:valueHas rdf:type rdf:Property ; + + :subjectClassConstraint :ValueBase ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . + + + +### http://www.knora.org/ontology/knora-base#valueHasUUID + +:valueHasUUID rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + rdfs:comment "The UUID of a value"@en ; + + :subjectClassConstraint :Value ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasCalendar + +:valueHasCalendar rdf:type owl:DatatypeProperty ; + + rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DateBase ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasColor + +:valueHasColor rdf:type owl:DatatypeProperty ; + + rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :ColorBase ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasEndJDN + +:valueHasEndJDN rdf:type owl:DatatypeProperty ; + + rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DateBase ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#valueHasEndPrecision + +:valueHasEndPrecision rdf:type owl:DatatypeProperty ; + + rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DateBase ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasDecimal + +:valueHasDecimal rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DecimalBase ; + + :objectDatatypeConstraint xsd:decimal . + + + +### http://www.knora.org/ontology/knora-base#valueHasGeometry + +:valueHasGeometry rdf:type owl:DatatypeProperty ; + + rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :GeomValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasGeonameCode + +:valueHasGeonameCode rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :GeonameValue ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasInteger + +:valueHasInteger rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :IntBase ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#valueHasBoolean + +:valueHasBoolean rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :BooleanBase ; + + :objectDatatypeConstraint xsd:boolean . + + + +### http://www.knora.org/ontology/knora-base#valueHasUri + +:valueHasUri rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :UriBase ; + + :objectDatatypeConstraint xsd:anyURI . + + + +### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd + +:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :IntervalBase ; + + :objectDatatypeConstraint xsd:decimal . + + + +### http://www.knora.org/ontology/knora-base#valueHasIntervalStart + +:valueHasIntervalStart rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :IntervalBase ; + + :objectDatatypeConstraint xsd:decimal . + + + +### http://www.knora.org/ontology/knora-base#valueHasIntervalStart + +:valueHasTimeStamp rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :TimeBase ; + + :objectDatatypeConstraint xsd:dateTime . + + + +### http://www.knora.org/ontology/knora-base#valueHasListNode + +:valueHasListNode rdf:type owl:ObjectProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :ListValue ; + + :objectClassConstraint :ListNode . + + +### http://www.knora.org/ontology/knora-base#valueHasOrder + +:valueHasOrder rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :Value ; + + :objectDatatypeConstraint xsd:integer . + + +### http://www.knora.org/ontology/knora-base#valueHasRefCount + +:valueHasRefCount rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :LinkValue ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#valueHasStartJDN + +:valueHasStartJDN rdf:type owl:DatatypeProperty ; + + rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DateBase ; + + :objectDatatypeConstraint xsd:integer . + + + +### http://www.knora.org/ontology/knora-base#valueHasStartPrecision + +:valueHasStartPrecision rdf:type owl:DatatypeProperty ; + + rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; + + rdfs:subPropertyOf :valueHas ; + + :subjectClassConstraint :DateBase ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#valueHasString + +:valueHasString rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :valueHas ; + + rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; + + :subjectClassConstraint :Value ; + + :objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/knora-base#hasPermissions + +:hasPermissions rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; + + :objectDatatypeConstraint xsd:string . + + + +################################################################# +# +# Classes +# +################################################################# + + +### http://www.knora.org/ontology/knora-base#Annotation + +:Annotation rdf:type owl:Class ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasComment ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isAnnotationOf ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isAnnotationOfValue ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Annotation"@de , + "Annotation"@en , + "Annotation"@fr , + "Annotation"@it ; + + :canBeInstantiated true ; + + rdfs:comment "A generic class for representing annotations"@en . + + + +### http://www.knora.org/ontology/knora-base#AudioFileValue + +:AudioFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue , + [ rdf:type owl:Restriction ; + owl:onProperty :duration ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents an audio file"@en . + + + +### http://www.knora.org/ontology/knora-base#AudioRepresentation + +:AudioRepresentation rdf:type owl:Class ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasAudioFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation (Audio)"@de , + "Representation (Audio)"@en , + "Répresentation (Audio)"@fr , + "Rappresentazione (Audio)"@it ; + + rdfs:comment "Represents a file containing audio data"@en . + + +### http://www.knora.org/ontology/knora-base#ColorBase + +:ColorBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasColor ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#ColorValue + +:ColorValue rdf:type owl:Class ; + + rdfs:subClassOf :Value, :ColorBase ; + + rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . + + + +### http://www.knora.org/ontology/knora-base#DDDFileValue + +:DDDFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue ; + + rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . + + + +### http://www.knora.org/ontology/knora-base#DDDRepresentation + +:DDDRepresentation rdf:type owl:Class ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasDDDFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation (3D)"@de , + "Representation (3D)"@en , + "Répresentation (3D)"@fr , + "Rappresentazione (3D)"@it ; + + rdfs:comment "Represents a file containg 3D data"@en . + + +### http://www.knora.org/ontology/knora-base#DateBase + +:DateBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasCalendar ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasEndPrecision ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasEndJDN ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasStartPrecision ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasStartJDN ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#DateValue + +:DateValue rdf:type owl:Class ; + + rdfs:subClassOf :Value, :DateBase ; + + rdfs:comment "Represents a Knora date value"@en . + + + +### http://www.knora.org/ontology/knora-base#DocumentFileValue + +:DocumentFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue . + + + +### http://www.knora.org/ontology/knora-base#DocumentRepresentation + +:DocumentRepresentation rdf:type owl:Class ; + + rdfs:label "Repräsentation (Dokument)"@de , + "Representation (Document)"@en , + "Répresentation (Document)"@fr , + "Rappresentazione (Documento)"@it ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasDocumentFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#ExternalResValue + +:ExternalResValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :extResId ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :extResProvider ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :extResAccessInfo ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#ExternalResource + +:ExternalResource rdf:type owl:Class ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasExtResValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Externe Ressource"@de , + "External Resource"@en , + "Ressource Externe"@fr , + "Risorsa esterna"@it ; + + rdfs:comment "Represents a proxy for an object stored by an external provider"@en . + + + +### http://www.knora.org/ontology/knora-base#FileValue + +:FileValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :originalMimeType ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :internalFilename ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :internalMimeType ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :originalFilename ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#DecimalBase + +:DecimalBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasDecimal ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#DecimalValue + +:DecimalValue rdf:type owl:Class ; + + rdfs:subClassOf :Value, :DecimalBase ; + + rdfs:comment "Represents an arbitrary-precision decimal value"@en . + + + +### http://www.knora.org/ontology/knora-base#GeomValue + +:GeomValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasGeometry ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a geometrical objects as JSON string"@en . + + + +### http://www.knora.org/ontology/knora-base#GeonameValue + +:GeonameValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasGeonameCode ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#IntBase + +:IntBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasInteger ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#IntValue + +:IntValue rdf:type owl:Class ; + + rdfs:subClassOf :Value, :IntBase ; + + rdfs:comment "Represents an integer value"@en . + +### http://www.knora.org/ontology/knora-base#BooleanBase + +:BooleanBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasBoolean ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#BooleanValue + +:BooleanValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + :BooleanBase ; + + rdfs:comment "Represents a boolean value"@en . + + + +### http://www.knora.org/ontology/knora-base#UriBase + +:UriBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasUri ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + +### http://www.knora.org/ontology/knora-base#UriValue + +:UriValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + :UriBase ; + + rdfs:comment "Represents a URI"@en . + +### http://www.knora.org/ontology/knora-base#IntervalBase + +:IntervalBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasIntervalEnd ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasIntervalStart ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#IntervalValue + +:IntervalValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + :IntervalBase ; + + rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . + + +:TimeBase rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasTimeStamp ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + +### http://www.knora.org/ontology/knora-base#IntervalValue + +:TimeValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + :TimeBase ; + + rdfs:comment "Represents a timestamp"@en . + + +### http://www.knora.org/ontology/knora-base#LinkObj + +:LinkObj rdf:type owl:Class ; + + rdfs:label "Verknüpfungsobjekt"@de , + "Link Object"@en , + "Objet de lien"@fr , + "Oggetto di connessione"@it ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasComment ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasLinkTo ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasLinkToValue ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] ; + + :resourceIcon "link.gif"^^xsd:string ; + + :canBeInstantiated true ; + + rdfs:comment "Verknüpfung mehrerer Resourcen"@de , + "Represents a generic link object"@en . + + + +### http://www.knora.org/ontology/knora-base#LinkValue + +:LinkValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + rdf:Statement , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasRefCount ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty rdf:subject ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty rdf:predicate ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty rdf:object ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "A reification node that describes direct links between resources"@en . + + + +### http://www.knora.org/ontology/knora-base#ListNode + +:ListNode rdf:type owl:Class ; + + rdfs:subClassOf [ rdf:type owl:Restriction ; + owl:onProperty :hasSubListNode ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :listNodePosition ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :listNodeName ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isRootNode ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasRootNode ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :attachedToProject ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty rdfs:label ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ]; + + rdfs:comment "Represents a flat or hierarchical list"@en . + + + +### http://www.knora.org/ontology/knora-base#ListValue + +:ListValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasListNode ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#MovingImageFileValue + +:MovingImageFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue , + [ rdf:type owl:Restriction ; + owl:onProperty :dimX ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :dimY ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :fps ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :duration ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a moving image file"@en . + + + +### http://www.knora.org/ontology/knora-base#MovingImageRepresentation + +:MovingImageRepresentation rdf:type owl:Class ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasMovingImageFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation (Video)"@de , + "Representation (Movie)"@en , + "Répresentation (Film)"@fr , + "Rappresentazione (Film)"@it ; + + rdfs:comment "A resource containing moving image data"@en . + + + +### http://www.knora.org/ontology/knora-base#Region + +:Region rdf:type owl:Class ; + + rdfs:label "Region"@de , + "Region"@en , + "Région"@fr , + "Regione"@it ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasColor ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isRegionOf ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasGeometry ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isRegionOfValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasComment ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] ; + + :resourceIcon "region.gif"^^xsd:string ; + + :canBeInstantiated true ; + + rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . + + + +### http://www.knora.org/ontology/knora-base#Representation + +:Representation rdf:type owl:Class ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation"@de , + "Representation"@en , + "Répresentation"@fr , + "Rappresentazione"@it ; + + rdfs:comment "A resource that can store a file"@en . + + + +### http://www.knora.org/ontology/knora-base#Resource + +:Resource rdf:type owl:Class ; + + rdfs:subClassOf [ rdf:type owl:Restriction ; + owl:onProperty rdfs:label ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isDeleted ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasStandoffLinkTo ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasStandoffLinkToValue ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :attachedToUser ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :attachedToProject ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasPermissions ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :creationDate ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :lastModificationDate ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deleteDate ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deletedBy ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deleteComment ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Ressource"@de , + "Resource"@en , + "Ressource"@fr , + "Risorsa"@it ; + + rdfs:comment "Represents something in the world, or an abstract thing"@en . + + +################################################################# +# +# Generic Standoff Tag +# +################################################################# + + +:standoffParentClassConstraint rdf:type owl:ObjectProperty . + + +### http://www.knora.org/ontology/knora-base#StandoffTag + +:StandoffTag rdf:type owl:Class ; + + rdfs:subClassOf [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasStart ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasEnd ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasUUID ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasOriginalXMLID ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasStartIndex ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasEndIndex ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasStartParent ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasEndParent ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffParentClassConstraint; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a standoff markup tag"@en . + + + +################################################################# +# +# Abstract Standoff Data Type Tag +# +################################################################# + +### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag + +:StandoffDataTypeTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffTag ; + + rdfs:comment "Represents a knora-base value type in a TextValue"@en . + + +################################################################# +# +# Standoff Data Type Tags that can be instantiated +# +################################################################# + + +### http://www.knora.org/ontology/knora-base#StandoffLinkTag + +:StandoffLinkTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffTag , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasLink ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffUriTag + +:StandoffUriTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag , + :UriBase ; + + rdfs:comment "Represents an arbitrary URI in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffDateTag + +:StandoffDateTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :DateBase ; + + rdfs:comment "Represents a date in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffColorTag + +:StandoffColorTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :ColorBase ; + + rdfs:comment "Represents a color in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffIntegerTag + +:StandoffIntegerTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :IntBase ; + + rdfs:comment "Represents an integer value in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffDecimalTag + +:StandoffDecimalTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :DecimalBase ; + + rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffIntervalTag + +:StandoffIntervalTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :IntervalBase ; + + rdfs:comment "Represents an interval in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffTimeTag + +:StandoffTimeTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :TimeBase ; + + rdfs:comment "Represents a timestamp in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffBooleanTag + +:StandoffBooleanTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :BooleanBase ; + + rdfs:comment "Represents a boolean in a TextValue"@en . + + +### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag + +:StandoffInternalReferenceTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffDataTypeTag, + :ValueBase, + [ rdf:type owl:Restriction ; + owl:onProperty :standoffTagHasInternalReference ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents an internal reference in a TextValue"@en . + + + +### http://www.knora.org/ontology/knora-base#StillImageFileValue + +:StillImageFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue , + [ rdf:type owl:Restriction ; + owl:onProperty :dimY ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :dimX ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "A file containing a two-dimensional still image"@en . + + + +### http://www.knora.org/ontology/knora-base#StillImageRepresentation + +:StillImageRepresentation rdf:type owl:Class ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasStillImageFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation (Bild)"@de , + "Representation (Image)"@en , + "Répresentation (Image)"@fr , + "Rappresentazione (Imagine)"@it ; + + rdfs:comment "A resource that can contain a two-dimensional still image file"@en . + + + +### http://www.knora.org/ontology/knora-base#TextFileValue + +:TextFileValue rdf:type owl:Class ; + + rdfs:subClassOf :FileValue ; + + rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . + + + +### http://www.knora.org/ontology/knora-base#TextRepresentation + +:TextRepresentation rdf:type owl:Class ; + + rdfs:subClassOf :Representation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasTextFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Repräsentation (Text)"@de , + "Representation (Text)"@en , + "Répresentation (Texte)"@fr , + "Rappresentazione (testo)"@it ; + + rdfs:comment "A resource containing a text file"@en . + + +### http://www.knora.org/ontology/knora-base#ForbiddenResource + +:ForbiddenResource rdf:type owl:Class ; + + rdfs:subClassOf :Resource , + [ rdf:type owl:Restriction ; + owl:onProperty :hasComment ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ]; + + rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; + + rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . + +### http://www.knora.org/ontology/knora-base#XSLTransformation + +:XSLTransformation rdf:type owl:Class ; + + rdfs:subClassOf :TextRepresentation , + [ rdf:type owl:Restriction ; + owl:onProperty :hasTextFileValue ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; + + rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . + + +### http://www.knora.org/ontology/knora-base#MappingComponent + +:MappingComponent rdf:type owl:Class ; + + rdfs:label "Component of a mapping"@en ; + + rdfs:comment "Component of a mapping" . + + +### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass + +:MappingStandoffDataTypeClass rdf:type owl:Class ; + + rdfs:subClassOf :MappingComponent , + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLAttributename ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasStandoffClass ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ]; + + rdfs:label "Mapping from XML attributes to standoff properties"@en ; + + rdfs:comment "Mapping from XML attributes to standoff properties" . + + +### http://www.knora.org/ontology/knora-base#MappingXMLAttribute + +:MappingXMLAttribute rdf:type owl:Class ; + + rdfs:subClassOf :MappingComponent , + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLAttributename ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLNamespace ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasStandoffProperty ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ]; + + rdfs:label "Mapping from XML attributes to standoff properties"@en ; + + rdfs:comment "Mapping from XML attributes to standoff properties" . + + +### http://www.knora.org/ontology/knora-base#MappingElement + +:MappingElement rdf:type owl:Class ; + + rdfs:subClassOf :MappingComponent , + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLTagname ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLNamespace ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLClass ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasStandoffClass ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasXMLAttribute ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasStandoffDataTypeClass ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :mappingElementRequiresSeparator ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ]; + + rdfs:label "Mapping from XML to standoff entities"@en ; + + rdfs:comment "Mapping from XML to standoff entities" . + +### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping + +:XMLToStandoffMapping rdf:type owl:Class ; + + rdfs:subClassOf + [ rdf:type owl:Restriction ; + owl:onProperty :hasMappingElement ; + owl:minCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :mappingHasDefaultXSLTransformation ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:label "Mapping from XML to standoff entities"@en ; + + rdfs:comment "Mapping from XML to standoff entities" . + +### http://www.knora.org/ontology/knora-base#TextValue + +:TextValue rdf:type owl:Class ; + + rdfs:subClassOf :Value , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasStandoff ; + owl:minCardinality "0"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasMaxStandoffStartIndex ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasLanguage ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ], + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasMapping ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] . + + + +### http://www.knora.org/ontology/knora-base#ValueBase + +:ValueBase rdf:type owl:Class . + + +### http://www.knora.org/ontology/knora-base#Value + +:Value rdf:type owl:Class ; + + rdfs:subClassOf :ValueBase, + [ rdf:type owl:Restriction ; + owl:onProperty :valueCreationDate ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :attachedToUser ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :hasPermissions ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasOrder ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasComment ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :isDeleted ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deleteDate ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deletedBy ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :deleteComment ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :previousValue ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasString ; + owl:cardinality "1"^^xsd:nonNegativeInteger + ] , + [ rdf:type owl:Restriction ; + owl:onProperty :valueHasUUID ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + + rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1403/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1403/knora-ontologies/salsah-gui.ttl new file mode 100644 index 0000000000..8e5bde0478 --- /dev/null +++ b/upgrade/plugins/pr1403/knora-ontologies/salsah-gui.ttl @@ -0,0 +1,244 @@ +# Copyright © 2015-2019 the contributors (see Contributors.md). +# +# This file is part of Knora. +# +# Knora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Knora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Knora. If not, see . + +@prefix : . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@prefix knora-base: . +@prefix knora-admin: . +@base . + + rdf:type owl:Ontology ; + + rdfs:label "The salsah-gui ontology"@en ; + + knora-base:attachedToProject knora-admin:SystemProject . + + +################################################################# +# +# Properties +# +################################################################# + + +### http://www.knora.org/ontology/salsah-gui#guiOrder + +:guiOrder rdf:type owl:DatatypeProperty ; + + knora-base:subjectClassConstraint owl:Restriction ; + + knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . + + + +### http://www.knora.org/ontology/salsah-gui#guiElement + +:guiElement rdf:type owl:ObjectProperty . + + + +### http://www.knora.org/ontology/salsah-gui#guiAttribute + +:guiAttribute rdf:type owl:DatatypeProperty ; + + knora-base:objectDatatypeConstraint xsd:string . + + + +### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition + +:guiAttributeDefinition rdf:type owl:DatatypeProperty ; + + knora-base:subjectClassConstraint :Guielement ; + + knora-base:objectDatatypeConstraint xsd:string . + + + + + +################################################################# +# +# Classes +# +################################################################# + + +### http://www.knora.org/ontology/salsah-gui#Guielement + +:Guielement rdf:type owl:Class . + + + + + +################################################################# +# +# Individuals +# +################################################################# + + +### http://www.knora.org/ontology/salsah-gui#Colorpicker + +:Colorpicker rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "ncolors:integer" . + + + +### http://www.knora.org/ontology/salsah-gui#Date + +:Date rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#Geometry + +:Geometry rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#Geonames + +:Geonames rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#Iconclass + +# :Iconclass rdf:type :Guielement , +# owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#Interval + +:Interval rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#TimeStamp + +:TimeStamp rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#List + +:List rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "hlist(required):iri" . + + + +### http://www.knora.org/ontology/salsah-gui#Pulldown + +:Pulldown rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "hlist(required):iri" . + + + +### http://www.knora.org/ontology/salsah-gui#Radio + +:Radio rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "hlist(required):iri" . + + + +### http://www.knora.org/ontology/salsah-gui#Richtext + +:Richtext rdf:type :Guielement , + owl:NamedIndividual . + + + +### http://www.knora.org/ontology/salsah-gui#Searchbox + +:Searchbox rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "numprops:integer" . + + + +### http://www.knora.org/ontology/salsah-gui#SimpleText + +:SimpleText rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "size:integer" , + "maxlength:integer" . + + + +### http://www.knora.org/ontology/salsah-gui#Slider + +:Slider rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "max(required):decimal" , + "min(required):decimal" . + + + +### http://www.knora.org/ontology/salsah-gui#Spinbox + +:Spinbox rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "max:decimal" , + "min:decimal" . + + + +### http://www.knora.org/ontology/salsah-gui#Textarea + +:Textarea rdf:type :Guielement , + owl:NamedIndividual ; + + :guiAttributeDefinition "cols:integer" , + "rows:integer" , + "width:percent" , + "wrap:string(soft|hard)" . + + +### http://www.knora.org/ontology/salsah-gui#Checkbox + +:Checkbox rdf:type :Guielement , + owl:NamedIndividual . + + +### http://www.knora.org/ontology/salsah-gui#Fileupload + +:Fileupload rdf:type :Guielement , + owl:NamedIndividual . diff --git a/upgrade/plugins/pr1403/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1403/knora-ontologies/standoff-onto.ttl new file mode 100644 index 0000000000..f5113c5028 --- /dev/null +++ b/upgrade/plugins/pr1403/knora-ontologies/standoff-onto.ttl @@ -0,0 +1,356 @@ +# Copyright © 2015-2019 the contributors (see Contributors.md). +# +# This file is part of Knora. +# +# Knora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Knora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Knora. If not, see . + +@prefix xml: . +@prefix xsd: . +@prefix rdf: . +@prefix rdfs: . +@prefix owl: . +@prefix foaf: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix salsah-gui: . +@base . + +@prefix : . + + rdf:type owl:Ontology ; + + rdfs:label "The standoff ontology"@en ; + + knora-base:attachedToProject knora-admin:SystemProject . + + +################################################################# +# +# Standoff Properties +# +################################################################# + +### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType + +:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "describes the document type"@en ; + + knora-base:subjectClassConstraint :StandoffRootTag ; + + knora-base:objectDatatypeConstraint xsd:string . + + +### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget + +:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; + + rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; + + rdfs:comment "describes the target settings of a hyperlink"@en ; + + knora-base:subjectClassConstraint :StandoffHyperlinkTag ; + + knora-base:objectDatatypeConstraint xsd:string . + + +################################################################# +# +# Intermediate Standoff Tags +# +################################################################# + +### http://www.knora.org/ontology/standoff#StandoffVisualTag + +:StandoffVisualTag rdf:type owl:Class ; + + rdfs:subClassOf knora-base:StandoffTag ; + + rdfs:comment "Represents visual markup information in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffStructuralTag + +:StandoffStructuralTag rdf:type owl:Class ; + + rdfs:subClassOf knora-base:StandoffTag ; + + rdfs:comment "Represents structural markup information in a TextValue"@en . + + +################################################################# +# +# Standoff Tags that can be instantiated +# +################################################################# + + +### http://www.knora.org/ontology/standoff#StandoffRootTag + +:StandoffRootTag rdf:type owl:Class ; + + rdfs:subClassOf knora-base:StandoffTag , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffRootTagHasDocumentType ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . + +### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag + +:StandoffHyperlinkTag rdf:type owl:Class ; + + rdfs:subClassOf knora-base:StandoffUriTag , + [ rdf:type owl:Restriction ; + owl:onProperty :standoffHyperlinkTagHasTarget ; + owl:maxCardinality "1"^^xsd:nonNegativeInteger + ] ; + + rdfs:comment "Represents a hyperlink in a text"@en . + +### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag + +:StandoffBlockquoteTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a section that is quoted from another source in a text"@en . + + +### http://www.knora.org/ontology/standoff#StandoffCodeTag + +:StandoffCodeTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a section of computer source code in a text"@en . + + +### http://www.knora.org/ontology/standoff#StandoffParagraphTag + +:StandoffParagraphTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a paragraph in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader1Tag + +:StandoffHeader1Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 1 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader2Tag + +:StandoffHeader2Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 2 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader3Tag + +:StandoffHeader3Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 3 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader4Tag + +:StandoffHeader4Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 4 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader5Tag + +:StandoffHeader5Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 5 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffHeader6Tag + +:StandoffHeader6Tag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a header of level 6 in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffOrderedListTag + +:StandoffOrderedListTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents an ordered list in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag + +:StandoffUnorderedListTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents an unordered list in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffListElementTag + +:StandoffListElementTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a list element in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffTableBodyTag + +:StandoffTableBodyTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a table body in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffTableTag + +:StandoffTableTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a table in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffTableRowTag + +:StandoffTableRowTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a row in a table"@en . + + +### http://www.knora.org/ontology/standoff#StandoffTableCellTag + +:StandoffTableCellTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a cell in a table"@en . + + +### http://www.knora.org/ontology/standoff#StandoffBrTag + +:StandoffBrTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents a linebreak"@en . + + + +### http://www.knora.org/ontology/standoff#StandoffItalicTag + +:StandoffItalicTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents italics in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffBoldTag + +:StandoffBoldTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents bold text in a TextValue"@en . + +### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag + +:StandoffCiteTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffStructuralTag ; + + rdfs:comment "Represents the title of a work in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffUnderlineTag + +:StandoffUnderlineTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents underlined text in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag + +:StandoffStrikethroughTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents struck text in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag + +:StandoffSuperscriptTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents superscript in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff#StandoffSubscriptTag + +:StandoffSubscriptTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents subscript in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag + +:StandoffLineTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents a line to seperate content in a TextValue"@en . + + +### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag + +:StandoffPreTag rdf:type owl:Class ; + + rdfs:subClassOf :StandoffVisualTag ; + + rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1403/update.py b/upgrade/plugins/pr1403/update.py new file mode 100644 index 0000000000..db6f636b60 --- /dev/null +++ b/upgrade/plugins/pr1403/update.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +# Copyright @ 2015-2019 the contributors (see Contributors.md). +# +# This file is part of Knora. +# +# Knora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Knora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with Knora. If not, see . + + +from updatelib import rdftools + + +class GraphTransformer(rdftools.GraphTransformer): + def transform(self, graph): + # Nothing to do, because this plugin only updates the built-in ontologies. + return graph diff --git a/upgrade/updatelib/rdftools.py b/upgrade/updatelib/rdftools.py index bb99a92bfb..84824c8bc0 100644 --- a/upgrade/updatelib/rdftools.py +++ b/upgrade/updatelib/rdftools.py @@ -147,9 +147,6 @@ def do_upload_request(graphdb_info, turtle_files, trig_file_path): prefix = match.group(1) + "-" + match.group(2) namespaces[prefix] = "http://www.knora.org/{}/{}/".format(match.group(1), match.group(2)) - for prefix, namespace in namespaces.items(): - print("prefix {}: {}".format(prefix, namespace)) - dataset = rdflib.Dataset() for turtle_file in turtle_files: diff --git a/webapi/src/main/scala/org/knora/webapi/package.scala b/webapi/src/main/scala/org/knora/webapi/package.scala index 0c8919e638..3a6f959693 100644 --- a/webapi/src/main/scala/org/knora/webapi/package.scala +++ b/webapi/src/main/scala/org/knora/webapi/package.scala @@ -27,7 +27,7 @@ package object webapi { * The version of `knora-base` and of the other built-in ontologies that this version of Knora requires. * Must be the same as the object of `knora-base:ontologyVersion` in the `knora-base` ontology being used. */ - val KnoraBaseVersion: String = "PR 1372" + val KnoraBaseVersion: String = "PR 1403" /** * `IRI` is a synonym for `String`, used to improve code readability. From abd0c4723abfdf5d24fda8c8f7296de216583534 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Tue, 3 Sep 2019 11:23:40 +0200 Subject: [PATCH 11/26] docs: Add docs. --- .../paradox/02-knora-ontologies/knora-base.md | 11 ++++++++ .../basicMessageComponents.ts | 26 ++++++++++++++++--- .../changeValueFormats.ts | 9 +++++++ .../createResourceFormats.ts | 2 +- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/docs/src/paradox/02-knora-ontologies/knora-base.md b/docs/src/paradox/02-knora-ontologies/knora-base.md index 0d2e46d805..407ffae9f5 100644 --- a/docs/src/paradox/02-knora-ontologies/knora-base.md +++ b/docs/src/paradox/02-knora-ontologies/knora-base.md @@ -428,6 +428,17 @@ regardless of the calendar in which they were entered. Properties: : The precision of the end of the period. +##### TimeValue + +A Knora time value represents a precise moment in time in the Gregorian +calendar. Since nanosecond precision can be included, it is suitable +for use as a timestamp. Properties: + +`valueHasTimeStamp` (1) + +: An `xsd:dateTimeStamp`, stored as an `xsd:dateTime` (because SPARQL + does not support `xsd:dateTimeStamp`). + ##### IntValue Represents an integer. Property: diff --git a/salsah1/src/typescript_interfaces/basicMessageComponents.ts b/salsah1/src/typescript_interfaces/basicMessageComponents.ts index 4a48642d4f..564d8c22a4 100644 --- a/salsah1/src/typescript_interfaces/basicMessageComponents.ts +++ b/salsah1/src/typescript_interfaces/basicMessageComponents.ts @@ -204,14 +204,24 @@ export module basicMessageComponents { /** * Begin of the interval in seconds */ - timeval1: integer; + timeval1: number; /** * End ofg the interval in seconds */ - timeval2: integer; + timeval2: number; } + + /** + * Repesents a timestamp. + */ + interface time { + /** + * An xsd:dateTimeStamp. + */ + timestamp: string; + } /** * String must be a hexadecimal RGB color code, e.g. "#4169E1" @@ -369,7 +379,17 @@ export module basicMessageComponents { /** * An interval value consisting of two time values */ - interval_value: Array; + interval_value: Array; + + } + + + export interface timeValue extends valueBase { + + /** + * A timestamp + */ + time_value: time; } diff --git a/salsah1/src/typescript_interfaces/changeValueFormats.ts b/salsah1/src/typescript_interfaces/changeValueFormats.ts index df2983a996..419c2471a6 100644 --- a/salsah1/src/typescript_interfaces/changeValueFormats.ts +++ b/salsah1/src/typescript_interfaces/changeValueFormats.ts @@ -126,6 +126,15 @@ export module changeValueFormats { export interface changeIntervalValueRequest extends changeValueRequestBase, basicMessageComponents.intervalValue {} + /** + * Represents a request to change a value of type time. + * + * HTTP PUT to http://host/v1/values/valueIRI + * + */ + export interface changeTimeValueRequest extends changeValueRequestBase, basicMessageComponents.timeValue {} + + /** * Represents a request to change a value of type geoname. * diff --git a/salsah1/src/typescript_interfaces/createResourceFormats.ts b/salsah1/src/typescript_interfaces/createResourceFormats.ts index 79c2917267..1e7f4e5944 100644 --- a/salsah1/src/typescript_interfaces/createResourceFormats.ts +++ b/salsah1/src/typescript_interfaces/createResourceFormats.ts @@ -170,7 +170,7 @@ export module createResourceFormats { [index:string]:Array|Array|Array |Array|Array|Array |Array|Array|Array - |Array|Array|Array; + |Array|Array|Array|Array; } /** From 1d8f09634a5bd1fba8113f9aedb7f15bb438455f Mon Sep 17 00:00:00 2001 From: Tobias Schweizer Date: Tue, 24 Sep 2019 10:15:20 +0200 Subject: [PATCH 12/26] test (ontology v2): fix test data --- .../anythingOntologyWithValueObjects.jsonld | 41 + .../anythingOntologyWithValueObjects.rdf | 842 +++++++++--------- .../anythingOntologyWithValueObjects.ttl | 39 +- 3 files changed, 508 insertions(+), 414 deletions(-) diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.jsonld b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.jsonld index e1b5f544e4..155e416c59 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.jsonld +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.jsonld @@ -247,6 +247,14 @@ "owl:onProperty" : { "@id" : "anything:hasThingPictureValue" } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "salsah-gui:guiOrder" : 13, + "owl:minCardinality" : 0, + "owl:onProperty" : { + "@id" : "anything:hasTimeStamp" + } }, { "@type" : "owl:Restriction", "knora-api:isInherited" : true, @@ -674,6 +682,13 @@ "owl:onProperty" : { "@id" : "anything:hasThingPictureValue" } + }, { + "@type" : "owl:Restriction", + "salsah-gui:guiOrder" : 13, + "owl:minCardinality" : 0, + "owl:onProperty" : { + "@id" : "anything:hasTimeStamp" + } }, { "@type" : "owl:Restriction", "salsah-gui:guiOrder" : 15, @@ -1378,6 +1393,14 @@ "owl:onProperty" : { "@id" : "anything:hasThingPictureValue" } + }, { + "@type" : "owl:Restriction", + "knora-api:isInherited" : true, + "salsah-gui:guiOrder" : 13, + "owl:minCardinality" : 0, + "owl:onProperty" : { + "@id" : "anything:hasTimeStamp" + } }, { "@type" : "owl:Restriction", "knora-api:isInherited" : true, @@ -1883,6 +1906,24 @@ "rdfs:subPropertyOf" : { "@id" : "knora-api:hasRepresentationValue" } + }, { + "@id" : "anything:hasTimeStamp", + "@type" : "owl:ObjectProperty", + "knora-api:isEditable" : true, + "knora-api:isResourceProperty" : true, + "knora-api:objectType" : { + "@id" : "knora-api:TimeValue" + }, + "knora-api:subjectType" : { + "@id" : "anything:Thing" + }, + "salsah-gui:guiElement" : { + "@id" : "salsah-gui:TimeStamp" + }, + "rdfs:label" : "Timestamp", + "rdfs:subPropertyOf" : { + "@id" : "knora-api:hasValue" + } }, { "@id" : "anything:hasUri", "@type" : "owl:ObjectProperty", diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.rdf b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.rdf index a3e56110cd..4a43a1abc7 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.rdf +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.rdf @@ -18,42 +18,43 @@ Diese Resource-Klasse beschreibt ein blaues Ding Blue thing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true @@ -62,129 +63,130 @@ 'The whole world is full of things, which means there's a real need for someone to go searching for them. And that's exactly what a thing-searcher does.' --Pippi Longstocking Thing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 0 @@ -201,7 +203,7 @@ - + true 0 0 @@ -218,7 +220,7 @@ - + true 2 0 @@ -234,7 +236,7 @@ - + true 2 0 @@ -252,7 +254,7 @@ - + true 3 0 @@ -268,7 +270,7 @@ - + true 4 0 @@ -286,7 +288,7 @@ - + true 5 0 @@ -304,7 +306,7 @@ - + true 6 1 @@ -320,7 +322,7 @@ - + true 7 0 @@ -338,7 +340,7 @@ - + true 9 0 @@ -354,7 +356,7 @@ - + true 10 0 @@ -370,7 +372,7 @@ - + true 11 0 @@ -386,7 +388,7 @@ - + true 12 0 @@ -402,7 +404,7 @@ - + true 13 0 @@ -419,7 +421,7 @@ - + true 13 0 @@ -436,7 +438,23 @@ - + + true + 13 + 0 + + + true + true + + + + Timestamp + + + + + true 15 0 @@ -453,7 +471,7 @@ - + true 15 0 @@ -470,7 +488,7 @@ - + 16 0 @@ -485,7 +503,7 @@ - + 63 0 @@ -506,28 +524,28 @@ Represents an event in a TextValue Represents an event in a TextValue - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + 1 @@ -536,197 +554,197 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + 0 0 - + 0 0 - + 1 0 @@ -742,7 +760,7 @@ - + 1 0 @@ -758,77 +776,82 @@ - + 2 0 - + 2 0 - + 3 0 - + 4 0 - + 5 0 - + 6 1 - + 7 0 - + 9 0 - + 10 0 - + 11 0 - + 12 0 - + 13 0 - + 13 0 - + + 13 + 0 + + + 15 0 - + 15 0 @@ -840,27 +863,27 @@ Diese Resource-Klasse beschreibt ein Bild eines Dinges Picture of a thing - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + 0 @@ -876,92 +899,92 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -972,27 +995,27 @@ A thing with a region Thing with region - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + 0 @@ -1007,7 +1030,7 @@ - + 0 @@ -1021,87 +1044,87 @@ - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1112,115 +1135,115 @@ A thing with a representation Thing with representation - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + 0 - + 0 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 @@ -1231,244 +1254,251 @@ Diese Resource-Klasse beschreibt ein Ding mit einer Sequenznummer Thing with sequence number - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 0 - + true 0 0 - + true 1 0 - + true 1 0 - + true 2 0 - + true 2 0 - + true 3 0 - + true 4 0 - + true 5 0 - + true 6 1 - + true 7 0 - + true 9 0 - + true 10 0 - + true 11 0 - + true 12 0 - + true 13 0 - + true 13 0 - + + true + 13 + 0 + + + true 15 0 - + true 15 0 - + 100 0 @@ -1480,105 +1510,105 @@ Diese Resource-Klasse beschreibt ein unbedeutendes Ding Trivial thing - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 0 - + true 1 - + true 0 - + true 0 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 - + true 1 diff --git a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl index f70dfece8f..b8c88007bd 100644 --- a/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl +++ b/webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl @@ -135,6 +135,11 @@ anything:BlueThing a owl:Class; salsah-gui:guiOrder 13; owl:minCardinality 0; owl:onProperty anything:hasThingPictureValue + ], [ a owl:Restriction; + knora-api:isInherited true; + salsah-gui:guiOrder 13; + owl:minCardinality 0; + owl:onProperty anything:hasTimeStamp ], [ a owl:Restriction; knora-api:isInherited true; salsah-gui:guiOrder 15; @@ -321,6 +326,10 @@ anything:Thing a owl:Class; salsah-gui:guiOrder 13; owl:minCardinality 0; owl:onProperty anything:hasThingPictureValue + ], [ a owl:Restriction; + salsah-gui:guiOrder 13; + owl:minCardinality 0; + owl:onProperty anything:hasTimeStamp ], [ a owl:Restriction; salsah-gui:guiOrder 15; owl:minCardinality 0; @@ -474,6 +483,15 @@ anything:hasThingPictureValue a owl:ObjectProperty; rdfs:label "Picture of a thing"; rdfs:subPropertyOf knora-api:hasRepresentationValue . +anything:hasTimeStamp a owl:ObjectProperty; + knora-api:isEditable true; + knora-api:isResourceProperty true; + knora-api:objectType knora-api:TimeValue; + knora-api:subjectType anything:Thing; + salsah-gui:guiElement salsah-gui:TimeStamp; + rdfs:label "Timestamp"; + rdfs:subPropertyOf knora-api:hasValue . + anything:isPartOfOtherThing a owl:ObjectProperty; knora-api:isEditable true; knora-api:isLinkProperty true; @@ -629,6 +647,14 @@ anything:ThingPicture a owl:Class; rdfs:comment "Diese Resource-Klasse beschreibt ein Bild eines Dinges"; rdfs:label "Picture of a thing"; rdfs:subClassOf knora-api:StillImageRepresentation, [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:deleteDate + ], [ a owl:Restriction; + knora-api:isInherited true; + owl:maxCardinality 1; + owl:onProperty knora-api:deletedBy + ], [ a owl:Restriction; knora-api:isInherited true; owl:minCardinality 0; owl:onProperty knora-api:hasIncomingLinkValue @@ -695,14 +721,6 @@ anything:ThingPicture a owl:Class; knora-api:isInherited true; owl:maxCardinality 1; owl:onProperty knora-api:deleteComment - ], [ a owl:Restriction; - knora-api:isInherited true; - owl:maxCardinality 1; - owl:onProperty knora-api:deleteDate - ], [ a owl:Restriction; - knora-api:isInherited true; - owl:maxCardinality 1; - owl:onProperty knora-api:deletedBy ] . anything:hasPictureTitle a owl:ObjectProperty; @@ -1054,6 +1072,11 @@ anything:ThingWithSeqnum a owl:Class; salsah-gui:guiOrder 13; owl:minCardinality 0; owl:onProperty anything:hasThingPictureValue + ], [ a owl:Restriction; + knora-api:isInherited true; + salsah-gui:guiOrder 13; + owl:minCardinality 0; + owl:onProperty anything:hasTimeStamp ], [ a owl:Restriction; knora-api:isInherited true; salsah-gui:guiOrder 15; From a40806f3fe4701431b1f78df3184c89fe71fca33 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Mon, 21 Oct 2019 09:26:31 +0200 Subject: [PATCH 13/26] Merge branch 'develop' into wip/1397-time-value # Conflicts: # upgrade/updatelib/rdftools.py --- .gitignore | 2 + .travis.yml | 32 +- KnoraBuild.sbt | 347 ++- Makefile | 8 +- docker/knora-upgrade.dockerfile | 13 +- .../04-publishing-deployment/updates.md | 87 +- .../development/updating-repositories.md | 88 +- knora-ontologies/knora-base.ttl | 2 +- project/Dependencies.scala | 12 +- upgrade/graphdb-se/.gitignore | 1 + upgrade/graphdb-se/README.md | 73 + upgrade/graphdb-se/auto-upgrade.sh | 94 + upgrade/graphdb-se/dump-repository.sh | 56 + upgrade/graphdb-se/empty-repository.sh | 54 + upgrade/{ => graphdb-se/old}/.gitignore | 0 .../old/1211-datetime/README.md | 0 .../old/1211-datetime/sparql/update-dates.rq | 0 .../old/1211-datetime/update-dates.py | 0 .../old/1230-delete-previews/README.md | 0 .../delete-preview-values.py | 0 .../1230-delete-previews/get-preview-paths.py | 0 .../sparql/delete-preview-values.rq | 0 .../sparql/get-preview-data.rq | 0 .../old/1263-knora-admin/README.md | 0 .../knora-ontologies/knora-admin.ttl | 0 .../knora-ontologies/knora-base.ttl | 0 .../1263-knora-admin/update-knora-admin.py | 0 upgrade/{ => graphdb-se/old}/README.md | 13 +- upgrade/{ => graphdb-se/old}/requirements.txt | 0 upgrade/graphdb-se/upload-repository.sh | 56 + .../pr1307/knora-ontologies/knora-admin.ttl | 773 ----- .../pr1307/knora-ontologies/knora-base.ttl | 2691 ---------------- .../pr1307/knora-ontologies/salsah-gui.ttl | 237 -- .../pr1307/knora-ontologies/standoff-onto.ttl | 356 --- upgrade/plugins/pr1307/test_1307.py | 141 - upgrade/plugins/pr1307/test_data.ttl | 99 - upgrade/plugins/pr1307/update.py | 170 - .../pr1322/knora-ontologies/knora-admin.ttl | 773 ----- .../pr1322/knora-ontologies/knora-base.ttl | 2709 ---------------- .../pr1322/knora-ontologies/salsah-gui.ttl | 237 -- .../pr1322/knora-ontologies/standoff-onto.ttl | 356 --- upgrade/plugins/pr1322/test_1322.py | 57 - upgrade/plugins/pr1322/test_data.ttl | 73 - upgrade/plugins/pr1322/update.py | 82 - .../pr1367/knora-ontologies/knora-admin.ttl | 777 ----- .../pr1367/knora-ontologies/knora-base.ttl | 2710 ---------------- .../pr1367/knora-ontologies/salsah-gui.ttl | 237 -- .../pr1367/knora-ontologies/standoff-onto.ttl | 356 --- upgrade/plugins/pr1367/test_1367.py | 44 - upgrade/plugins/pr1367/test_data.ttl | 26 - upgrade/plugins/pr1367/update.py | 42 - .../pr1372/knora-ontologies/knora-admin.ttl | 777 ----- .../pr1372/knora-ontologies/knora-base.ttl | 2710 ---------------- .../pr1372/knora-ontologies/salsah-gui.ttl | 237 -- .../pr1372/knora-ontologies/standoff-onto.ttl | 356 --- upgrade/plugins/pr1372/test_1372.py | 59 - upgrade/plugins/pr1372/test_data.ttl | 103 - upgrade/plugins/pr1372/update.py | 63 - .../pr1440/knora-ontologies/knora-admin.ttl | 781 ----- .../pr1440/knora-ontologies/knora-base.ttl | 2721 ----------------- .../pr1440/knora-ontologies/salsah-gui.ttl | 237 -- .../pr1440/knora-ontologies/standoff-data.ttl | 631 ---- .../pr1440/knora-ontologies/standoff-onto.ttl | 356 --- upgrade/plugins/pr1440/update.py | 27 - .../main/scala/org.knora.upgrade/Main.scala | 260 ++ .../org.knora.upgrade/UpgradePlugin.scala | 34 + .../plugins/NoopPlugin.scala | 30 + .../plugins/UpgradePluginPR1307.scala | 197 ++ .../plugins/UpgradePluginPR1322.scala | 63 + .../plugins/UpgradePluginPR1367.scala | 62 + .../plugins/UpgradePluginPR1372.scala | 61 + .../src/test/resources/test-data/pr1307.trig | 100 + .../src/test/resources/test-data/pr1322.trig | 75 + .../src/test/resources/test-data/pr1367.trig | 28 + .../src/test/resources/test-data/pr1372.trig | 105 + .../plugins/UpgradePluginPR1307Spec.scala | 158 + .../plugins/UpgradePluginPR1322Spec.scala | 70 + .../plugins/UpgradePluginPR1367Spec.scala | 50 + .../plugins/UpgradePluginPR1372Spec.scala | 74 + .../plugins/UpgradePluginSpec.scala | 117 + upgrade/test.sh | 3 - upgrade/update-repository.py | 360 --- upgrade/updatelib/rdftools.py | 217 -- webapi/src/it/resources/logback-test.xml | 2 +- webapi/src/main/resources/logback.xml | 2 +- .../main/scala/org/knora/webapi/package.scala | 2 +- .../knora/webapi/update/UpdatePlugin.scala | 36 + .../webapi/update/UpdateRepository.scala | 245 ++ .../webapi/update/plugins/NoopPlugin.scala | 32 + .../update/plugins/UpdatePluginPR1307.scala | 199 ++ .../update/plugins/UpdatePluginPR1322.scala | 65 + .../update/plugins/UpdatePluginPR1367.scala | 64 + .../update/plugins/UpdatePluginPR1372.scala | 63 + .../scala/org/knora/webapi/util/Debug.scala | 35 + .../org/knora/webapi/util/JavaUtil.scala | 19 +- .../util/StatementCollectingHandler.scala | 83 - .../org/knora/webapi/util/TransformData.scala | 658 ---- .../knora/webapi/util/TransformOntology.scala | 215 -- .../knora/webapi/util/jsonld/JsonLDUtil.scala | 2 +- webapi/src/test/resources/logback-test.xml | 2 +- .../resources/test-data/update/pr1307.trig | 100 + .../resources/test-data/update/pr1322.trig | 75 + .../resources/test-data/update/pr1367.trig | 28 + .../resources/test-data/update/pr1372.trig | 105 + .../e2e/v2/JSONLDHandlingV2R2RSpec.scala | 4 +- .../plugins/UpdatePluginPR1307Spec.scala | 160 + .../plugins/UpdatePluginPR1322Spec.scala | 72 + .../plugins/UpdatePluginPR1367Spec.scala | 52 + .../plugins/UpdatePluginPR1372Spec.scala | 76 + .../update/plugins/UpdatePluginSpec.scala | 119 + .../org/knora/webapi/util/AkkaHttpUtils.scala | 2 +- 111 files changed, 3738 insertions(+), 23785 deletions(-) create mode 100644 upgrade/graphdb-se/.gitignore create mode 100644 upgrade/graphdb-se/README.md create mode 100755 upgrade/graphdb-se/auto-upgrade.sh create mode 100755 upgrade/graphdb-se/dump-repository.sh create mode 100755 upgrade/graphdb-se/empty-repository.sh rename upgrade/{ => graphdb-se/old}/.gitignore (100%) rename upgrade/{ => graphdb-se}/old/1211-datetime/README.md (100%) rename upgrade/{ => graphdb-se}/old/1211-datetime/sparql/update-dates.rq (100%) rename upgrade/{ => graphdb-se}/old/1211-datetime/update-dates.py (100%) rename upgrade/{ => graphdb-se}/old/1230-delete-previews/README.md (100%) rename upgrade/{ => graphdb-se}/old/1230-delete-previews/delete-preview-values.py (100%) rename upgrade/{ => graphdb-se}/old/1230-delete-previews/get-preview-paths.py (100%) rename upgrade/{ => graphdb-se}/old/1230-delete-previews/sparql/delete-preview-values.rq (100%) rename upgrade/{ => graphdb-se}/old/1230-delete-previews/sparql/get-preview-data.rq (100%) rename upgrade/{ => graphdb-se}/old/1263-knora-admin/README.md (100%) rename upgrade/{ => graphdb-se}/old/1263-knora-admin/knora-ontologies/knora-admin.ttl (100%) rename upgrade/{ => graphdb-se}/old/1263-knora-admin/knora-ontologies/knora-base.ttl (100%) rename upgrade/{ => graphdb-se}/old/1263-knora-admin/update-knora-admin.py (100%) rename upgrade/{ => graphdb-se/old}/README.md (55%) rename upgrade/{ => graphdb-se/old}/requirements.txt (100%) create mode 100755 upgrade/graphdb-se/upload-repository.sh delete mode 100644 upgrade/plugins/pr1307/knora-ontologies/knora-admin.ttl delete mode 100644 upgrade/plugins/pr1307/knora-ontologies/knora-base.ttl delete mode 100644 upgrade/plugins/pr1307/knora-ontologies/salsah-gui.ttl delete mode 100644 upgrade/plugins/pr1307/knora-ontologies/standoff-onto.ttl delete mode 100644 upgrade/plugins/pr1307/test_1307.py delete mode 100644 upgrade/plugins/pr1307/test_data.ttl delete mode 100644 upgrade/plugins/pr1307/update.py delete mode 100644 upgrade/plugins/pr1322/knora-ontologies/knora-admin.ttl delete mode 100644 upgrade/plugins/pr1322/knora-ontologies/knora-base.ttl delete mode 100644 upgrade/plugins/pr1322/knora-ontologies/salsah-gui.ttl delete mode 100644 upgrade/plugins/pr1322/knora-ontologies/standoff-onto.ttl delete mode 100644 upgrade/plugins/pr1322/test_1322.py delete mode 100644 upgrade/plugins/pr1322/test_data.ttl delete mode 100644 upgrade/plugins/pr1322/update.py delete mode 100644 upgrade/plugins/pr1367/knora-ontologies/knora-admin.ttl delete mode 100644 upgrade/plugins/pr1367/knora-ontologies/knora-base.ttl delete mode 100644 upgrade/plugins/pr1367/knora-ontologies/salsah-gui.ttl delete mode 100644 upgrade/plugins/pr1367/knora-ontologies/standoff-onto.ttl delete mode 100644 upgrade/plugins/pr1367/test_1367.py delete mode 100644 upgrade/plugins/pr1367/test_data.ttl delete mode 100644 upgrade/plugins/pr1367/update.py delete mode 100644 upgrade/plugins/pr1372/knora-ontologies/knora-admin.ttl delete mode 100644 upgrade/plugins/pr1372/knora-ontologies/knora-base.ttl delete mode 100644 upgrade/plugins/pr1372/knora-ontologies/salsah-gui.ttl delete mode 100644 upgrade/plugins/pr1372/knora-ontologies/standoff-onto.ttl delete mode 100644 upgrade/plugins/pr1372/test_1372.py delete mode 100644 upgrade/plugins/pr1372/test_data.ttl delete mode 100644 upgrade/plugins/pr1372/update.py delete mode 100644 upgrade/plugins/pr1440/knora-ontologies/knora-admin.ttl delete mode 100644 upgrade/plugins/pr1440/knora-ontologies/knora-base.ttl delete mode 100644 upgrade/plugins/pr1440/knora-ontologies/salsah-gui.ttl delete mode 100644 upgrade/plugins/pr1440/knora-ontologies/standoff-data.ttl delete mode 100644 upgrade/plugins/pr1440/knora-ontologies/standoff-onto.ttl delete mode 100644 upgrade/plugins/pr1440/update.py create mode 100644 upgrade/src/main/scala/org.knora.upgrade/Main.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/UpgradePlugin.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/plugins/NoopPlugin.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1307.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1322.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1367.scala create mode 100644 upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1372.scala create mode 100644 upgrade/src/test/resources/test-data/pr1307.trig create mode 100644 upgrade/src/test/resources/test-data/pr1322.trig create mode 100644 upgrade/src/test/resources/test-data/pr1367.trig create mode 100644 upgrade/src/test/resources/test-data/pr1372.trig create mode 100644 upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1307Spec.scala create mode 100644 upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1322Spec.scala create mode 100644 upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1367Spec.scala create mode 100644 upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1372Spec.scala create mode 100644 upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginSpec.scala delete mode 100755 upgrade/test.sh delete mode 100755 upgrade/update-repository.py delete mode 100644 upgrade/updatelib/rdftools.py create mode 100644 webapi/src/main/scala/org/knora/webapi/update/UpdatePlugin.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/UpdateRepository.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/plugins/NoopPlugin.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372.scala create mode 100644 webapi/src/main/scala/org/knora/webapi/util/Debug.scala delete mode 100644 webapi/src/main/scala/org/knora/webapi/util/StatementCollectingHandler.scala delete mode 100644 webapi/src/main/scala/org/knora/webapi/util/TransformData.scala delete mode 100644 webapi/src/main/scala/org/knora/webapi/util/TransformOntology.scala create mode 100644 webapi/src/test/resources/test-data/update/pr1307.trig create mode 100644 webapi/src/test/resources/test-data/update/pr1322.trig create mode 100644 webapi/src/test/resources/test-data/update/pr1367.trig create mode 100644 webapi/src/test/resources/test-data/update/pr1372.trig create mode 100644 webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307Spec.scala create mode 100644 webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322Spec.scala create mode 100644 webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367Spec.scala create mode 100644 webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372Spec.scala create mode 100644 webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginSpec.scala diff --git a/.gitignore b/.gitignore index 82a8de8186..2ce6c86803 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,8 @@ salsah1/project webapi/project webapi/_fuseki/run webapi/build +upgrade/project +upgrade/target triplestores/graphdb-se-7 idea.vmoptions sipi/test diff --git a/.travis.yml b/.travis.yml index 738e62ebb3..39aea7c27c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,7 +69,7 @@ jobs: # - sbt knora-sipi/docker:publish # - sbt knora-graphdb-se/docker:publish # - sbt knora-graphdb-free/docker:publish - # - sbt knora-upgrade/docker:publish + # - sbt upgrade/docker:publish # - sbt knora-assets/docker:publish # unit tests - stage: test @@ -103,9 +103,27 @@ jobs: # upgrade tests - stage: test script: - # run tests - - pyenv shell 3.7.1 - - cd $TRAVIS_BUILD_DIR/upgrade && pip3 install -r requirements.txt && ./test.sh + # build all docker images + - make build-all-images + # prepare needed graphdb-se files + - mkdir -p $TRAVIS_BUILD_DIR/graphdb + - cp $TRAVIS_BUILD_DIR/travis/graphdb.license $TRAVIS_BUILD_DIR/graphdb/graphdb.license + - cp $TRAVIS_BUILD_DIR/webapi/scripts/KnoraRules.pie $TRAVIS_BUILD_DIR/graphdb + # start and initialize graphdb-se + - docker network create knora-net + - docker run --rm -d --name=db --network=knora-net -p 127.0.0.1:7200:7200 -v $TRAVIS_BUILD_DIR/graphdb:/graphdb -e GDB_HEAP_SIZE=$GDB_HEAP_SIZE daschswiss/knora-graphdb-se -Dgraphdb.license.file=/graphdb/graphdb.license + - sleep 5 + - make init-db-test-minimal + # load v7.0.0 data and run auto-upgrade (sbt use case) + - cd $TRAVIS_BUILD_DIR/upgrade/graphdb-se + - unzip $TRAVIS_BUILD_DIR/test-data/v7.0.0/v7.0.0-knora-test.trig.zip + - ./empty-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 + - ./upload-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 v7.0.0-knora-test.trig + - ./auto-upgrade.sh -r knora-test -u gaga -p gaga -h localhost:7200 -t /tmp/upgrade.dir + # load v7.0.0 data and run auto-upgrade (docker use case) + - ./empty-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 + - ./upload-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 v7.0.0-knora-test.trig + - docker run -it --rm --network=knora-net -v /tmp:/tmp -e KNORA_UPGRADE_DOCKER=true daschswiss/knora-upgrade -r knora-test -u gaga -p gaga -h db:7200 -t /tmp/upgrade.dir # testing docs generation - stage: test script: @@ -141,9 +159,9 @@ jobs: # when on 'develop' then $TRAVIS_BRANCH = develop # when on 'tag' then $TRAVIS_BRANCH = tag, e.g., v1.2.0 - docker login -u $DOCKER_USER -p $DOCKER_PASS - # webapi + # knora-api - sbt webapi/docker:publish - # salsah1 + # knora-salsah1 - sbt salsah1/docker:publish # knora-sipi - sbt knora-sipi/docker:publish @@ -152,7 +170,7 @@ jobs: # knora-graphdb-free - sbt knora-graphdb-free/docker:publish # knora-upgrade - - sbt knora-upgrade/docker:publish + - sbt upgrade/docker:publish # knora-assets - sbt knora-assets/docker:publish # publish images to daschswiss dockerhub organization diff --git a/KnoraBuild.sbt b/KnoraBuild.sbt index 98a0e935e4..d8ea09b1df 100644 --- a/KnoraBuild.sbt +++ b/KnoraBuild.sbt @@ -23,68 +23,69 @@ lazy val buildSettings = Dependencies.Versions ++ Seq( version := (ThisBuild / version).value ) -lazy val root = Project(id = "knora", file(".")) - .aggregate(aggregatedProjects: _*) - .enablePlugins(DockerComposePlugin, GitVersioning, GitBranchPrompt) - .settings(Dependencies.Versions) - .settings( - // values set for all sub-projects - // These are normal sbt settings to configure for release, skip if already defined +lazy val rootBaseDir = baseDirectory.in(ThisBuild) - ThisBuild / licenses := Seq("AGPL-3.0" -> url("https://opensource.org/licenses/AGPL-3.0")), - ThisBuild / homepage := Some(url("https://github.com/dhlab-basel/Knora")), - ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/dhlab-basel/Knora"), "scm:git:git@github.com:dhlab-basel/Knora.git")), +lazy val root: Project = Project(id = "knora", file(".")) + .aggregate(aggregatedProjects: _*) + .enablePlugins(DockerComposePlugin, GitVersioning, GitBranchPrompt) + .settings(Dependencies.Versions) + .settings( + // values set for all sub-projects + // These are normal sbt settings to configure for release, skip if already defined - // use 'git describe' for deriving the version - git.useGitDescribe := true, + ThisBuild / licenses := Seq("AGPL-3.0" -> url("https://opensource.org/licenses/AGPL-3.0")), + ThisBuild / homepage := Some(url("https://github.com/dhlab-basel/Knora")), + ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/dhlab-basel/Knora"), "scm:git:git@github.com:dhlab-basel/Knora.git")), - // override generated version string because docker hub rejects '+' in tags - ThisBuild / version ~= (_.replace('+', '-')), + // use 'git describe' for deriving the version + git.useGitDescribe := true, - // use Ctrl-c to stop current task but not quit SBT - Global / cancelable := true, + // override generated version string because docker hub rejects '+' in tags + ThisBuild / version ~= (_.replace('+', '-')), - publish / skip := true, + // use Ctrl-c to stop current task but not quit SBT + Global / cancelable := true, - Dependencies.sysProps := sys.props.toString(), - Dependencies.sysEnvs := sys.env.toString(), + publish / skip := true, - // these can be set by the user as system environment variables - ThisBuild / Dependencies.gdbHomePath := sys.env.getOrElse("KNORA_GDB_HOME", sys.props("user.dir") + "/triplestores/graphdb/home"), - ThisBuild / Dependencies.gdbLicensePath := sys.env.getOrElse("KNORA_GDB_LICENSE", sys.props("user.dir") + "/triplestores/graphdb/graphdb.license"), + Dependencies.sysProps := sys.props.toString(), + Dependencies.sysEnvs := sys.env.toString(), - // these are calculated in their respective targets - Dependencies.knoraSipiImage := "dhlabbasel/knora-sipi:" + version.value, - Dependencies.knoraGdbImage := { - if (Dependencies.gdbTypeString.equals("graphdb-free")) { - "dhlabbasel/knora-graphdb-free:" + version.value - } else { - "dhlabbasel/knora-graphdb-se:" + version.value - } - }, - Dependencies.knoraWebapiImage := "dhlabbasel/webapi:" + version.value, - Dependencies.knoraSalsah1Image := "dhlabbasel/salsah1:" + version.value, - - // use these values for variable substitution in the docker-compose.yml - variablesForSubstitution := Map( - "KNORA_GDB_HOME" -> Dependencies.gdbHomePath.value, - "KNORA_GDB_LICENSE" -> Dependencies.gdbLicensePath.value, - "KNORA_GDB_TYPE" -> Dependencies.gdbTypeString, - "KNORA_GDB_IMAGE" -> Dependencies.knoraGdbImage.value, - "KNORA_SIPI_IMAGE" -> Dependencies.knoraSipiImage.value, - "KNORA_WEBAPI_IMAGE" -> Dependencies.knoraWebapiImage.value, - "KNORA_SALSAH1_IMAGE" -> Dependencies.knoraSalsah1Image.value - ), + // these can be set by the user as system environment variables + ThisBuild / Dependencies.gdbHomePath := sys.env.getOrElse("KNORA_GDB_HOME", sys.props("user.dir") + "/triplestores/graphdb/home"), + ThisBuild / Dependencies.gdbLicensePath := sys.env.getOrElse("KNORA_GDB_LICENSE", sys.props("user.dir") + "/triplestores/graphdb/graphdb.license"), - dockerImageCreationTask := Seq( - (salsah1 / Docker / publishLocal).value, - (webapi / Docker / publishLocal).value, - (knoraGraphDbSe / Docker / publishLocal).value, - (knoraGraphdbFree / Docker / publishLocal).value, - (knoraSipi / Docker / publishLocal).value, - (knoraAssets / Docker / publishLocal).value - ) - ) + // these are calculated in their respective targets + Dependencies.knoraSipiImage := "dhlabbasel/knora-sipi:" + version.value, + Dependencies.knoraGdbImage := { + if (Dependencies.gdbTypeString.equals("graphdb-free")) { + "dhlabbasel/knora-graphdb-free:" + version.value + } else { + "dhlabbasel/knora-graphdb-se:" + version.value + } + }, + Dependencies.knoraWebapiImage := "dhlabbasel/webapi:" + version.value, + Dependencies.knoraSalsah1Image := "dhlabbasel/salsah1:" + version.value, + + // use these values for variable substitution in the docker-compose.yml + variablesForSubstitution := Map( + "KNORA_GDB_HOME" -> Dependencies.gdbHomePath.value, + "KNORA_GDB_LICENSE" -> Dependencies.gdbLicensePath.value, + "KNORA_GDB_TYPE" -> Dependencies.gdbTypeString, + "KNORA_GDB_IMAGE" -> Dependencies.knoraGdbImage.value, + "KNORA_SIPI_IMAGE" -> Dependencies.knoraSipiImage.value, + "KNORA_WEBAPI_IMAGE" -> Dependencies.knoraWebapiImage.value, + "KNORA_SALSAH1_IMAGE" -> Dependencies.knoraSalsah1Image.value + ), + + dockerImageCreationTask := Seq( + (salsah1 / Docker / publishLocal).value, + (webapi / Docker / publishLocal).value, + (knoraGraphDbSe / Docker / publishLocal).value, + (knoraGraphdbFree / Docker / publishLocal).value, + (knoraSipi / Docker / publishLocal).value + ) + ) ////////////////////////////////////// @@ -194,7 +195,7 @@ lazy val graphdbseCommonSettings = Seq( name := "knora-graphdb-se" ) -lazy val knoraGraphDbSe = knoraModule("knora-graphdb-se") +lazy val knoraGraphDbSe: Project = knoraModule("knora-graphdb-se") .enablePlugins(DockerPlugin) .settings( graphdbseCommonSettings @@ -213,7 +214,7 @@ lazy val knoraGraphDbSe = knoraModule("knora-graphdb-se") dockerRepository := Some("dhlabbasel"), - maintainer := "ivan.subotic@unibas.ch", + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerExposedPorts ++= Seq(7200), Docker / dockerCommands := Seq( @@ -221,7 +222,7 @@ lazy val knoraGraphDbSe = knoraModule("knora-graphdb-se") Cmd("FROM", "ontotext/graphdb:8.5.0-se"), Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""), Cmd("COPY", "opt/docker/scripts", "/scripts"), - Cmd("RUN", "mkdir -p /graphdb && cp /scripts/KnoraRules.pie /graphdb/KnoraRules.pie && rm -rf /scripts"), + ExecCmd("RUN", "mkdir -p /graphdb && cp /scripts/KnoraRules.pie /graphdb/KnoraRules.pie && rm -rf /scripts"), ) ) @@ -233,7 +234,7 @@ lazy val graphdbfreeCommonSettings = Seq( name := "knora-graphdb-free" ) -lazy val knoraGraphdbFree = knoraModule("knora-graphdb-free") +lazy val knoraGraphdbFree: Project = knoraModule("knora-graphdb-free") .enablePlugins(DockerPlugin) .settings( graphdbfreeCommonSettings @@ -252,7 +253,7 @@ lazy val knoraGraphdbFree = knoraModule("knora-graphdb-free") dockerRepository := Some("dhlabbasel"), - maintainer := "ivan.subotic@unibas.ch", + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerExposedPorts ++= Seq(7200), Docker / dockerCommands := Seq( @@ -260,7 +261,7 @@ lazy val knoraGraphdbFree = knoraModule("knora-graphdb-free") Cmd("FROM", "dhlabbasel/graphdb:8.10.0-free"), Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""), Cmd("COPY", "opt/docker/scripts", "/scripts"), - Cmd("RUN", "mkdir -p /graphdb && cp /scripts/KnoraRules.pie /graphdb/KnoraRules.pie && rm -rf /scripts"), + ExecCmd("RUN", "mkdir -p /graphdb && cp /scripts/KnoraRules.pie /graphdb/KnoraRules.pie && rm -rf /scripts"), ) ) @@ -272,7 +273,7 @@ lazy val knoraSipiCommonSettings = Seq( name := "knora-sipi" ) -lazy val knoraSipi = knoraModule("knora-sipi") +lazy val knoraSipi: Project = knoraModule("knora-sipi") .enablePlugins(DockerPlugin) .settings( knoraSipiCommonSettings @@ -291,7 +292,7 @@ lazy val knoraSipi = knoraModule("knora-sipi") dockerRepository := Some("dhlabbasel"), - maintainer := "ivan.subotic@unibas.ch", + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerExposedPorts ++= Seq(1024), Docker / dockerCommands := Seq( @@ -311,7 +312,7 @@ lazy val knoraAssetsCommonSettings = Seq( name := "knora-assets" ) -lazy val knoraAssets = knoraModule("knora-assets") +lazy val knoraAssets: Project = knoraModule("knora-assets") .enablePlugins(DockerPlugin) .settings( knoraAssetsCommonSettings @@ -323,9 +324,9 @@ lazy val knoraAssets = knoraModule("knora-assets") Universal / mappings ++= { // copy the different folders directory("webapi/scripts") ++ - directory("webapi/_test_data") ++ - directory("webapi/_assets") ++ - directory("knora-ontologies") + directory("webapi/_test_data") ++ + directory("webapi/_assets") ++ + directory("knora-ontologies") }, // add dockerCommands used to create the image @@ -333,7 +334,7 @@ lazy val knoraAssets = knoraModule("knora-assets") dockerRepository := Some("dhlabbasel"), - maintainer := "ivan.subotic@unibas.ch", + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerExposedPorts ++= Seq(9999), // not used. added just so that there is no warning Docker / dockerCommands := Seq( Cmd("FROM", "scratch"), @@ -346,41 +347,91 @@ lazy val knoraAssets = knoraModule("knora-assets") // Knora upgrade scripts ////////////////////////////////////// -lazy val knoraUpgradeCommonSettings = Seq( - name := "knora-upgrade" +lazy val upgradeCommonSettings = Seq( + name := "upgrade" ) -lazy val knoraUpgrade = knoraModule("knora-upgrade") - .enablePlugins(DockerPlugin) +lazy val upgrade: Project = knoraModule("upgrade") + .dependsOn(webapi) + .enablePlugins(JavaAppPackaging, DockerPlugin) .settings( - knoraUpgradeCommonSettings + upgradeCommonSettings, + Dependencies.upgradeLibraryDependencies, + // use jars (and not class directory) for run, test, console + exportJars := true, + unmanagedResourceDirectories in Compile += (rootBaseDir.value / "knora-ontologies"), + + // add content of knora-ontologies to jar + mappings in (Compile, packageBin) ++= Seq ( + (rootBaseDir.value / "knora-ontologies" / "knora-admin.ttl") -> "knora-ontologies/knora-admin.ttl", + (rootBaseDir.value / "knora-ontologies" / "knora-base.ttl") -> "knora-ontologies/knora-base.ttl", + (rootBaseDir.value / "knora-ontologies" / "salsah-gui.ttl") -> "knora-ontologies/salsah-gui.ttl", + (rootBaseDir.value / "knora-ontologies" / "standoff-data.ttl") -> "knora-ontologies/standoff-data.ttl", + (rootBaseDir.value / "knora-ontologies" / "standoff-onto.ttl") -> "knora-ontologies/standoff-onto.ttl", + ), + // contentOf("salsah1/src/main/resources").toMap.mapValues("config/" + _) + // (rootBaseDir.value / "knora-ontologies") -> "knora-ontologies", + + ) + .settings( + scalacOptions ++= Seq("-feature", "-unchecked", "-deprecation", "-Yresolve-term-conflict:package"), + logLevel := Level.Info, + run / fork := true, + run / javaOptions ++= upgradeJavaRunOptions, + Compile / run / mainClass := Some("org.knora.upgrade.Main"), + Test / fork := true, + Test / javaOptions ++= upgradeJavaTestOptions, + Test / parallelExecution := false, + /* show full stack traces and test case durations */ + Test / testOptions += Tests.Argument("-oDF"), ) .settings( // Skip packageDoc and packageSrc task on stage Compile / packageDoc / mappings := Seq(), Compile / packageSrc / mappings := Seq(), + Universal / mappings ++= { // copy the different folders - directory("upgrade") + directory("upgrade/graphdb-se") }, // add dockerCommands used to create the image // docker:stage, docker:publishLocal, docker:publish, docker:clean - dockerRepository := Some("dhlabbasel"), - - maintainer := "ivan.subotic@unibas.ch", - Docker / dockerExposedPorts ++= Seq(9999), // not used. added just so that there is no warning + dockerUpdateLatest := true, + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerCommands := Seq( - Cmd("FROM", "python:3.7-stretch"), + Cmd("FROM", "adoptopenjdk/openjdk11:alpine-jre"), Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""), - Cmd("COPY", "opt/docker", "/"), - Cmd("RUN", "pip install -r /upgrade/requirements.txt"), - Cmd("ENTRYPOINT", "/upgrade/update-repository.py"), - Cmd("CMD", "-h") - ) + Cmd("RUN apk update && apk upgrade && apk add bash"), + + Cmd("ENV", """KNORA_UPGRADE_DOCKER="true""""), + Cmd("COPY", "opt/docker", "/upgrade"), + Cmd("WORKDIR", "/upgrade/graphdb-se"), + ExecCmd("ENTRYPOINT", "/upgrade/graphdb-se/auto-upgrade.sh"), + ), ) +lazy val upgradeJavaRunOptions = Seq( + // "-showversion", + "-Xms1G", + "-Xmx1G" + // "-verbose:gc", + //"-XX:+UseG1GC", + //"-XX:MaxGCPauseMillis=500", + //"-XX:MaxMetaspaceSize=4096m" +) + +lazy val upgradeJavaTestOptions = Seq( + // "-showversion", + "-Xms1G", + "-Xmx1G" + // "-verbose:gc", + //"-XX:+UseG1GC", + //"-XX:MaxGCPauseMillis=500", + //"-XX:MaxMetaspaceSize=4096m" +) + ////////////////////////////////////// // SALSAH1 (./salsah1) ////////////////////////////////////// @@ -389,80 +440,78 @@ lazy val salsahCommonSettings = Seq( name := "salsah1" ) -lazy val salsah1 = knoraModule("salsah1") - .enablePlugins(JavaAppPackaging, DockerPlugin, DockerComposePlugin) - .configs( - HeadlessTest - ) - .settings( - salsahCommonSettings, - Revolver.settings - ) - .settings(inConfig(HeadlessTest)( - Defaults.testTasks ++ Seq( - fork := true, - javaOptions ++= javaHeadlessTestOptions, - testOptions += Tests.Argument("-oDF") // show full stack traces and test case durations - ) - ): _*) - .settings( - Dependencies.salsahLibraryDependencies, - logLevel := Level.Info, - run / fork := true, - run / javaOptions ++= javaRunOptions, - Compile / run / mainClass := Some("org.knora.salsah.Main"), - Test / fork := true, - Test / javaOptions ++= javaTestOptions, - Test / parallelExecution := false, - /* show full stack traces and test case durations */ - Test / testOptions += Tests.Argument("-oDF") - ) - .settings( // enable deployment staging with `sbt stage` - // Skip packageDoc and packageSrc task on stage - Compile / packageDoc / mappings := Seq(), - Compile / packageSrc / mappings := Seq(), - Universal / mappings ++= { - // copy the public folder - directory("salsah1/src/public") ++ - // copy the configuration files to config directory - // contentOf("salsah1/configs").toMap.mapValues("config/" + _) ++ - // copy configuration files to config directory - contentOf("salsah1/src/main/resources").toMap.mapValues("config/" + _) - }, - // add 'config' directory first in the classpath of the start script, - scriptClasspath := Seq("../config/") ++ scriptClasspath.value, - // need this here, but why? - Compile / mainClass := Some("org.knora.salsah.Main"), - - // add dockerCommands used to create the image - // docker:stage, docker:publishLocal, docker:publish, docker:clean - - dockerRepository := Some("dhlabbasel"), +lazy val salsah1: Project = knoraModule("salsah1") + .enablePlugins(JavaAppPackaging, DockerPlugin, DockerComposePlugin) + .configs( + HeadlessTest + ) + .settings( + salsahCommonSettings, + Revolver.settings + ) + .settings(inConfig(HeadlessTest)( + Defaults.testTasks ++ Seq( + fork := true, + javaOptions ++= javaHeadlessTestOptions, + testOptions += Tests.Argument("-oDF") // show full stack traces and test case durations + ) + ): _*) + .settings( + Dependencies.salsahLibraryDependencies, + logLevel := Level.Info, + run / fork := true, + run / javaOptions ++= javaRunOptions, + Compile / run / mainClass := Some("org.knora.salsah.Main"), + Test / fork := true, + Test / javaOptions ++= javaTestOptions, + Test / parallelExecution := false, + /* show full stack traces and test case durations */ + Test / testOptions += Tests.Argument("-oDF") + ) + .settings( // enable deployment staging with `sbt stage` + // Skip packageDoc and packageSrc task on stage + Compile / packageDoc / mappings := Seq(), + Compile / packageSrc / mappings := Seq(), + Universal / mappings ++= { + // copy the public folder + directory("salsah1/src/public") ++ + // copy the configuration files to config directory + // contentOf("salsah1/configs").toMap.mapValues("config/" + _) ++ + // copy configuration files to config directory + contentOf("salsah1/src/main/resources").toMap.mapValues("config/" + _) + }, + // add 'config' directory first in the classpath of the start script, + scriptClasspath := Seq("../config/") ++ scriptClasspath.value, + // need this here, but why? + Compile / mainClass := Some("org.knora.salsah.Main"), - maintainer := "ivan.subotic@unibas.ch", + // add dockerCommands used to create the image + // docker:stage, docker:publishLocal, docker:publish, docker:clean - Docker / dockerExposedPorts ++= Seq(3335), - Docker / dockerCommands := Seq( - Cmd("FROM", "adoptopenjdk/openjdk11:alpine-jre"), - Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""), + dockerRepository := Some("dhlabbasel"), - Cmd("ENV", """LANG="en_US.UTF-8""""), - Cmd("ENV", """JAVA_OPTS="-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8""""), - Cmd("ENV", "KNORA_SALSAH1_DEPLOYED=true"), - Cmd("ENV", "KNORA_SALSAH1_WORKDIR=/salsah1"), + maintainer := "400790+subotic@users.noreply.github.com", - Cmd("RUN apk update && apk upgrade && apk add bash"), + Docker / dockerExposedPorts ++= Seq(3335), + Docker / dockerCommands := Seq( + Cmd("FROM", "adoptopenjdk/openjdk11:alpine-jre"), + Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""), - Cmd("COPY", "opt/docker", "/salsah1"), - Cmd("WORKDIR", "/salsah1"), + Cmd("ENV", """LANG="en_US.UTF-8""""), + Cmd("ENV", """JAVA_OPTS="-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8""""), + Cmd("ENV", "KNORA_SALSAH1_DEPLOYED=true"), + Cmd("ENV", "KNORA_SALSAH1_WORKDIR=/salsah1"), + Cmd("RUN apk update && apk upgrade && apk add bash"), + Cmd("COPY", "opt/docker", "/salsah1"), + Cmd("WORKDIR", "/salsah1"), - Cmd("EXPOSE", "3335"), + Cmd("EXPOSE", "3335"), - ExecCmd("ENTRYPOINT", "bin/salsah1"), - ), + ExecCmd("ENTRYPOINT", "bin/salsah1"), + ), - ) + ) lazy val javaRunOptions = Seq( // "-showversion", @@ -630,7 +679,7 @@ lazy val webapi = knoraModule("webapi") dockerRepository := Some("dhlabbasel"), - maintainer := "ivan.subotic@unibas.ch", + maintainer := "400790+subotic@users.noreply.github.com", Docker / dockerExposedPorts ++= Seq(3333, 10001), Docker / dockerCommands := Seq( @@ -746,4 +795,4 @@ lazy val webapi_it = project def knoraModule(name: String): Project = Project(id = name, base = file(name)) - .settings(buildSettings) + .settings(buildSettings) diff --git a/Makefile b/Makefile index 0badd39a92..6827a46a9b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ docs-build: ## build the docs .PHONY: build-all-scala build-all-scala: ## build all scala projects - sbt webapi/universal:stage knora-graphdb-se/universal:stage knora-graphdb-free/universal:stage knora-sipi/universal:stage salsah1/universal:stage knora-upgrade/universal:stage knora-assets/universal:stage webapi_test/universal:stage webapi_it/universal:stage + sbt webapi/universal:stage knora-graphdb-se/universal:stage knora-graphdb-free/universal:stage knora-sipi/universal:stage salsah1/universal:stage upgrade/universal:stage knora-assets/universal:stage webapi_test/universal:stage webapi_it/universal:stage ## knora-api .PHONY: build-knora-api-image @@ -38,7 +38,7 @@ publish-knora-api-image: build-knora-api-image ## publish knora-api image to Doc build-knora-graphdb-se-image: build-all-scala ## build and publish knora-graphdb-se docker image locally @mkdir -p .docker @sed -e "s/@GRAPHDB_IMAGE@/ontotext\/graphdb\:$(GRAPHDB_SE_VERSION)-se/" docker/knora-graphdb.template.dockerfile > .docker/knora-graphdb-se.dockerfile - docker build -t $(KNORA_GRAPHDB_SE_IMAGE) -f .docker/knora-graphdb-se.dockerfile knora-graphdb-se/target/universal + docker build -t $(KNORA_GRAPHDB_SE_IMAGE) -t $(REPO_PREFIX)/$(KNORA_GRAPHDB_SE_REPO):latest -f .docker/knora-graphdb-se.dockerfile knora-graphdb-se/target/universal .PHONY: publish-knora-graphdb-se-image publish-knora-graphdb-se-image: build-knora-graphdb-se-image ## publish knora-graphdb-se image to Dockerhub @@ -73,12 +73,12 @@ build-knora-salsah1-image: build-all-scala ## build and publish knora-salsah1 do .PHONY: publish-knora-salsah1-image publish-knora-salsah1-image: build-knora-salsah1-image ## publish knora-salsah1 image to Dockerhub - docker push $(KNORA_SALSAH_IMAGE) + docker push $(KNORA_SALSAH1_IMAGE) ## knora-upgrade .PHONY: build-knora-upgrade-image build-knora-upgrade-image: build-all-scala ## build and publish knora-upgrade docker image locally - docker build -t $(KNORA_UPGRADE_IMAGE) -f docker/knora-upgrade.dockerfile knora-upgrade/target/universal + docker build -t $(KNORA_UPGRADE_IMAGE) -t $(REPO_PREFIX)/$(KNORA_UPGRADE_REPO):latest -f docker/knora-upgrade.dockerfile upgrade/target/universal .PHONY: publish-knora-upgrade publish-knora-upgrade: build-knora-upgrade-image ## publish knora-upgrade image to Dockerhub diff --git a/docker/knora-upgrade.dockerfile b/docker/knora-upgrade.dockerfile index 4bed3aa2a0..7f93cb8850 100644 --- a/docker/knora-upgrade.dockerfile +++ b/docker/knora-upgrade.dockerfile @@ -1,8 +1,11 @@ -FROM python:3.7-stretch +FROM adoptopenjdk/openjdk11:alpine-jre -COPY stage/upgrade /upgrade -RUN pip install -r /upgrade/requirements.txt -ENTRYPOINT /upgrade/update-repository.py -CMD -h +RUN apk update && apk upgrade && apk add bash curl + +COPY stage /upgrade + +WORKDIR /upgrade/graphdb-se + +ENTRYPOINT ["/upgrade/graphdb-se/auto-upgrade.sh"] LABEL MAINTAINER="400790+subotic@users.noreply.github.com" diff --git a/docs/src/paradox/04-publishing-deployment/updates.md b/docs/src/paradox/04-publishing-deployment/updates.md index d31796e28e..7bd5a0486e 100644 --- a/docs/src/paradox/04-publishing-deployment/updates.md +++ b/docs/src/paradox/04-publishing-deployment/updates.md @@ -19,22 +19,87 @@ License along with Knora. If not, see . # Updating Repositories When Upgrading Knora +@@toc + When a new version of Knora introduces changes that are not backwards-compatible -with existing data, you will need to update your repository. Follow the -instructions below for the Knora version that you are upgrading from. +with existing data, you will need to update your repository. First, back up +your repository. Then follow the instructions below for the Knora version that +you are upgrading from. ## Upgrading from Knora 7.0.0 or Later -Follow the instructions in `upgrade/README.md`. +### Automatic Upgrade + +The automatic upgrade procedure dumps your repository to a file, determines which transformations +are needed, transforms the file, then loads the transformed file back into the repository. +To perform an automatic upgrade, open a shell in the directory `upgrade/graphdb-se` and run the script +`./auto-upgrade.sh`. You must be in that directory when you run the script. For information on its +command line options, run it without arguments, or see the `README.md` in that directory for details. + +### Manual Upgrade + +If you need more control over the process (e.g. you want to use +GraphDB's [LoadRDF](http://graphdb.ontotext.com/documentation/free/loading-data-using-the-loadrdf-tool.html) +tool to upload the transformed file), follow the steps below. + +#### 1. Dump the Repository to a TriG File + +You can use the `dump-repository.sh` script in `upgrade/graphdb-se`. See +the `README.md` there for instructions. + +#### 2. Transform the TriG File + +In the `knora-api` directory of the version of Knora you are upgrading to, run: + +``` +sbt "upgrade/run INPUT_FILE OUTPUT_FILE" +``` + +For `INPUT_FILE`, use the absolute path of the TriG file you downloaded in +step 1. + +For `OUTPUT_FILE`, use the absolute path of the transformed TriG file to +be created. + +The program automatically determines which transformations are needed. +If the repository is already up to date, the program will say so, and no +output file will be written. In this case, there is nothing more to do. +Otherwise, proceed to step 3. + +#### 3. Empty the Repository + +The transformed TriG file must be loaded into an empty repository. +To empty the repository, you can use the `empty-repository.sh` script in +`upgrade/graphdb-se`. See the `README.md` there for instructions. +Make sure you have backed up the repository first. + +#### 4. Load the Transformed TriG File into the Repository + +You can use the `upload-repository.sh` script in `upgrade/graphdb-se`. See +the `README.md` there for instructions. + +If the file is very large, it may be more efficient to load it offline, +using GraphDB's [LoadRDF](http://graphdb.ontotext.com/documentation/free/loading-data-using-the-loadrdf-tool.html) +tool. + +## Upgrading from a Knora Version Before 7.0.0 + +First, read the general instructions in `upgrade/graphdb-se/old/README.md`. + +### Upgrading from Knora 6.0.0 or 6.0.1 + +1. Follow the instructions in `upgrade/graphdb-se/old/1263-knora-admin/README.md`. + +2. Follow the instructions in + @ref:[Upgrading from Knora 7.0.0 or Later](#upgrading-from-knora-7-0-0-or-later). + +### Upgrading from Knora 5.0.0 -## Upgrading from Knora 6.0.0 or 6.0.1 +1. Follow the instructions in `upgrade/graphdb-se/old/1211-datetime/README.md`. -1. Follow the instructions in `upgrade/old/1263-knora-admin/README.md`. -2. Follow the instructions in `upgrade/README.md`. +2. Follow the instructions in `upgrade/graphdb-se/old/1230-delete-previews/README.md`. -## Upgrading from Knora 5.0.0 +3. Follow the instructions in `upgrade/graphdb-se/old/1263-knora-admin/README.md`. -1. Follow the instructions in `upgrade/old/1211-datetime/README.md`. -2. Follow the instructions in `upgrade/old/1230-delete-previews/README.md`. -3. Follow the instructions in `upgrade/old/1263-knora-admin/README.md`. -4. Follow the instructions in `upgrade/README.md`. +4. Follow the instructions in + @ref:[Upgrading from Knora 7.0.0 or Later](#upgrading-from-knora-7-0-0-or-later). diff --git a/docs/src/paradox/05-internals/development/updating-repositories.md b/docs/src/paradox/05-internals/development/updating-repositories.md index fdd8e3a27f..d9a0d59a25 100644 --- a/docs/src/paradox/05-internals/development/updating-repositories.md +++ b/docs/src/paradox/05-internals/development/updating-repositories.md @@ -24,62 +24,58 @@ As explained in the `knora-base` ontology contains a version string to ensure compatibility between a repository and a given version of Knora. The same version string is therefore hard-coded in the Knora source code, in the string constant -`org.knora.webapi.KnoraBaseVersion`. The format of this string is currently -`PR NNNN`, where `NNNN` is the number of a GitHub pull request. Each time -a pull request introduces changes that are not compatible with existing data, -the following must happen: - -- The `knora-base` version string must be updated in `knora-base.ttl` and - in the string constant `org.knora.webapi.KnoraBaseVersion`. This version - string must contain the number of the last pull request that introduced - a breaking change. +`org.knora.webapi.KnoraBaseVersion`. For new pull requests, the format of this string +is `knora-base vN`, where `N` is an integer that is incremented for +each version. Each time a pull request introduces changes that are not compatible +with existing data, the following must happen: + +- The `knora-base` version number must be incremented in `knora-base.ttl` and + in the string constant `org.knora.webapi.KnoraBaseVersion`. -- A plugin must be added to the - @ref:[repository update program](../../04-publishing-deployment/updates.md), to update - existing repositories to work with the new version of Knora. The plugin will - be used by `update-repository.py` if needed. +- A plugin must be added in the `upgrade` subproject under `org.knora.upgrade.plugins`, + and registered in `org.knora.upgrade.Main`, to transform + existing repositories so that they are compatible with the code changes + introduced in the pull request. -## Adding an Update Plugin +The order of version numbers must correspond to the order in which the pull requests +are merged. -An update plugin is a Python module, which must be put in a subdirectory -of `upgrade/plugins`. The name of the plugin's directory must be `prNNNN`, where -`NNNN` is the pull request number. That directory must have a subdirectory called -`knora-ontologies`, containing the following built-in Knora ontologies with any -modifications introduced by that pull request: +## Adding an Upgrade Plugin -- `knora-admin.ttl` -- `knora-base.ttl` -- `salsah-gui.ttl` -- `standoff-onto.ttl` +An upgrade plugin is a Scala class that extends `UpgradePlugin`. The name of the plugin +class should refer to the pull request that made the transformation necessary, +using the format `UpgradePluginPRNNNN`, where `NNNN` is the number of the pull request. -The `knora-base.ttl` file must contain a `knora-base:ontologyVersion` that -matches the pull request number. +A plugin's `transform` method takes an RDF4J `Model` (a mutable object representing +the repository) and modifies it as needed. For details on how to do this, see +[The RDF Model API](https://rdf4j.eclipse.org/documentation/programming/model/) +in the RDF4J documentation. -Each plugin module must be in a file called `update.py`, and must contain -a class called `GraphTransformer`, defined like this: +The plugin must then be added to the collection `pluginsForVersions` in +`org.knora.upgrade.Main`. -```python -import rdflib -from updatelib import rdftools +## Testing Update Plugins -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - # Do the transformation -``` +Each plugin should have a unit test that extends `UpgradePluginSpec`. A typical +test loads a TriG file containing test data into a `Model`, runs the plugin, +makes an RDF4J `SailRepository` containing the transformed `Model`, and uses +SPARQL to check the result. -The `transform` method takes an `rdflib.graph.Graph` and returns a transformed -graph (which may be the same graph instance or a new one). See the -[rdflib documentation](https://rdflib.readthedocs.io/en/stable/index.html) -for details of that class. +## Design Rationale -This method will be called once for each named graph downloaded from the -triplestore. +We tried and rejected other designs: -The `updatelib.rdftools` library provides convenience functions for working -with RDF data. +- Running SPARQL updates in the triplestore: too slow, and no way to report + progress during the update. + +- Downloading the repository and transforming it in Python using + [rdflib](https://rdflib.readthedocs.io/en/stable/): too slow. + +- Downloading the repository and transforming it in C++ using + [Redland](http://librdf.org): also too slow. -## Testing Update Plugins +The Scala implementation is the fastest by far. -Each plugin should have a unit test that can be run by -[pytest](https://docs.pytest.org/en/latest/index.html). To run all the -plugin unit tests, run the script `./test.sh` in the `upgrade` directory. +The whole repository is uploaded in a single transaction because +GraphDB's consistency checker can enforce dependencies between named +graphs. diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index e34e69858c..1a9d5985f8 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -33,7 +33,7 @@ :attachedToProject knora-admin:SystemProject ; - :ontologyVersion "PR XXXX" . + :ontologyVersion "knora-base v6" . diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 468f3f02f5..a61ae398bd 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -209,6 +209,7 @@ object Dependencies { akkaStream.value, WebapiTest.akkaStreamTestkit.value, WebapiTest.akkaTestkit.value, + apacheHttpClient, bcprov, chill, commonsBeanUtil, @@ -220,6 +221,7 @@ object Dependencies { WebapiTest.gatlingHighcharts, WebapiTest.gatlingTestFramework, gwtServlet, + icu4j, jacksonScala, jaxbApi, jsonldJava, @@ -246,9 +248,13 @@ object Dependencies { springSecurityCore, swaggerAkkaHttp, typesafeConfig, - xmlunitCore, - icu4j, - apacheHttpClient + xmlunitCore + ) + + val upgradeLibraryDependencies = l ++= Seq[sbt.ModuleID]( + rdf4jRuntime, + SalsahTest.scalaTest, + scallop ) val webapiTestAndITLibraryDependencies = l ++= Seq[sbt.ModuleID]( diff --git a/upgrade/graphdb-se/.gitignore b/upgrade/graphdb-se/.gitignore new file mode 100644 index 0000000000..2fe000267b --- /dev/null +++ b/upgrade/graphdb-se/.gitignore @@ -0,0 +1 @@ +*.trig diff --git a/upgrade/graphdb-se/README.md b/upgrade/graphdb-se/README.md new file mode 100644 index 0000000000..400f86cb4a --- /dev/null +++ b/upgrade/graphdb-se/README.md @@ -0,0 +1,73 @@ +# Scripts for Upgrading GraphDB Repositories + +This directory contains shell scripts for updating a GraphDB repository +to work with a new version of Knora. + +You will need to have [curl](https://curl.haxx.se) installed. + +## Automatic Upgrade + +This dumps your repository to a file, determines which transformations are needed, +transforms the file, then loads the transformed file back into the repository. +Make sure you have backed up the repository before you do this. + +``` +./auto-upgrade.sh -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] +``` + +- `-r`: the name of the repository. +- `-u`: the GraphDB username. +- `-p`: the GraphDB password. If not supplied, you will be prompted for it. +- `-h`: the GraphDB host and port. Defaults to `localhost:7200`. + +If the environment variable `KNORA_UPGRADE_DOCKER` is set, this script runs the +upgrade program using the executable `/upgrade/bin/upgrade`. Otherwise, it runs +the program using SBT. + +## Scripts for Manual Upgrades + +These scripts are useful if you want more control over the upgrade process. + +### Dumping a GraphDB Repository to a TriG File + +``` +./dump-repository.sh -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE +``` + +- `-r`: the name of the repository. +- `-u`: the GraphDB username. +- `-p`: the GraphDB password. If not supplied, you will be prompted for it. +- `-h`: the GraphDB host and port. Defaults to `localhost:7200`. +- `FILE`: the file path of the TriG file to be written. + +### Emptying a GraphDB Repository + +This empties a GraphDB repository by running a SPARQL `DROP ALL` command. Make sure you +have backed up the repository before you do this. + +``` +./empty-repository.sh -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] +``` + +- `-r`: the name of the repository. +- `-u`: the GraphDB username. +- `-p`: the GraphDB password. If not supplied, you will be prompted for it. +- `-h`: the GraphDB host and port. Defaults to `localhost:7200`. + +### Uploading a TriG File to a GraphDB Repository + +This uploads the TriG file to GraphDB over HTTP. + +``` +./upload-repository.sh -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE +``` + +- `-r`: the name of the repository. +- `-u`: the GraphDB username. +- `-p`: the GraphDB password. If not supplied, you will be prompted for it. +- `-h`: the GraphDB host and port. Defaults to `localhost:7200`. +- `FILE`: the file path of the TriG file to be uploaded. + +If the file is very large, it may be more efficient to load it offline, +using GraphDB's [LoadRDF](http://graphdb.ontotext.com/documentation/free/loading-data-using-the-loadrdf-tool.html) +tool. diff --git a/upgrade/graphdb-se/auto-upgrade.sh b/upgrade/graphdb-se/auto-upgrade.sh new file mode 100755 index 0000000000..7379170dc3 --- /dev/null +++ b/upgrade/graphdb-se/auto-upgrade.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +#set -x +set -e + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -r|--repository) + REPOSITORY="$2" + shift # past argument + shift # past value + ;; + -u|--username) + USERNAME="$2" + shift # past argument + shift # past value + ;; + -p|--password) + PASSWORD="$2" + shift # past argument + shift # past value + ;; + -h|--host) + HOST="$2" + shift # past argument + shift # past value + ;; + -t|--tempdir) + TEMP_DIR="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +if [[ -z "${REPOSITORY}" || -z "${USERNAME}" ]]; then + echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] [-t|--tempdir temporary directory]" + exit 1 +fi + +if [[ -z "${PASSWORD}" ]]; then + echo -n "Password: " + IFS="" read -rs PASSWORD + echo +fi + +if [[ -z "${HOST}" ]]; then + HOST="localhost:7200" +fi + +if [[ -z "${TEMP_DIR}" ]]; then + TEMP_DIR=$(mktemp -d) +else + mkdir -p "${TEMP_DIR}" +fi + +INPUT_FILE=${TEMP_DIR}/dump.trig +OUTPUT_FILE=${TEMP_DIR}/transformed.trig + +# Download the repository. +echo "Downloading repository..." +curl -X GET -H "Accept: application/trig" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements?infer=false" > "${INPUT_FILE}" + +# Transform the downloaded file. +echo "Checking for needed transformations..." + +if [[ -z "${KNORA_UPGRADE_DOCKER}" ]]; then + # Run the upgrade program using SBT. + (cd ../.. && sbt "upgrade/run ${INPUT_FILE} ${OUTPUT_FILE}") +else + # Run the upgrade program using Docker. + /upgrade/bin/upgrade "${INPUT_FILE}" "${OUTPUT_FILE}" +fi + +# If a transformed file was produced, empty the repository and upload the transformed file. +if [[ -f "${OUTPUT_FILE}" ]]; then + echo "Emptying repository..." + curl -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" + + echo "Uploading transformed data to repository..." + curl -X POST -H "Content-Type: application/trig" -d "@${OUTPUT_FILE}" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" | tee /dev/null +fi + +rm -r "${TEMP_DIR}" +echo "Done." diff --git a/upgrade/graphdb-se/dump-repository.sh b/upgrade/graphdb-se/dump-repository.sh new file mode 100755 index 0000000000..d7ab11a534 --- /dev/null +++ b/upgrade/graphdb-se/dump-repository.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +#set -x + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -r|--repository) + REPOSITORY="$2" + shift # past argument + shift # past value + ;; + -u|--username) + USERNAME="$2" + shift # past argument + shift # past value + ;; + -p|--password) + PASSWORD="$2" + shift # past argument + shift # past value + ;; + -h|--host) + HOST="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +FILE="$1" + +if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then + echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" + exit 1 +fi + +if [[ -z "${PASSWORD}" ]]; then + echo -n "Password: " + IFS="" read -rs PASSWORD + echo +fi + +if [[ -z "${HOST}" ]]; then + HOST="localhost:7200" +fi + +curl -X GET -H "Accept: application/trig" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements?infer=false" > "${FILE}" diff --git a/upgrade/graphdb-se/empty-repository.sh b/upgrade/graphdb-se/empty-repository.sh new file mode 100755 index 0000000000..4faa14925d --- /dev/null +++ b/upgrade/graphdb-se/empty-repository.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +#set -x + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -r|--repository) + REPOSITORY="$2" + shift # past argument + shift # past value + ;; + -u|--username) + USERNAME="$2" + shift # past argument + shift # past value + ;; + -p|--password) + PASSWORD="$2" + shift # past argument + shift # past value + ;; + -h|--host) + HOST="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +if [[ -z "${REPOSITORY}" || -z "${USERNAME}" ]]; then + echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST]" + exit 1 +fi + +if [[ -z "${PASSWORD}" ]]; then + echo -n "Password: " + IFS="" read -rs PASSWORD + echo +fi + +if [[ -z "${HOST}" ]]; then + HOST="localhost:7200" +fi + +curl -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" diff --git a/upgrade/.gitignore b/upgrade/graphdb-se/old/.gitignore similarity index 100% rename from upgrade/.gitignore rename to upgrade/graphdb-se/old/.gitignore diff --git a/upgrade/old/1211-datetime/README.md b/upgrade/graphdb-se/old/1211-datetime/README.md similarity index 100% rename from upgrade/old/1211-datetime/README.md rename to upgrade/graphdb-se/old/1211-datetime/README.md diff --git a/upgrade/old/1211-datetime/sparql/update-dates.rq b/upgrade/graphdb-se/old/1211-datetime/sparql/update-dates.rq similarity index 100% rename from upgrade/old/1211-datetime/sparql/update-dates.rq rename to upgrade/graphdb-se/old/1211-datetime/sparql/update-dates.rq diff --git a/upgrade/old/1211-datetime/update-dates.py b/upgrade/graphdb-se/old/1211-datetime/update-dates.py similarity index 100% rename from upgrade/old/1211-datetime/update-dates.py rename to upgrade/graphdb-se/old/1211-datetime/update-dates.py diff --git a/upgrade/old/1230-delete-previews/README.md b/upgrade/graphdb-se/old/1230-delete-previews/README.md similarity index 100% rename from upgrade/old/1230-delete-previews/README.md rename to upgrade/graphdb-se/old/1230-delete-previews/README.md diff --git a/upgrade/old/1230-delete-previews/delete-preview-values.py b/upgrade/graphdb-se/old/1230-delete-previews/delete-preview-values.py similarity index 100% rename from upgrade/old/1230-delete-previews/delete-preview-values.py rename to upgrade/graphdb-se/old/1230-delete-previews/delete-preview-values.py diff --git a/upgrade/old/1230-delete-previews/get-preview-paths.py b/upgrade/graphdb-se/old/1230-delete-previews/get-preview-paths.py similarity index 100% rename from upgrade/old/1230-delete-previews/get-preview-paths.py rename to upgrade/graphdb-se/old/1230-delete-previews/get-preview-paths.py diff --git a/upgrade/old/1230-delete-previews/sparql/delete-preview-values.rq b/upgrade/graphdb-se/old/1230-delete-previews/sparql/delete-preview-values.rq similarity index 100% rename from upgrade/old/1230-delete-previews/sparql/delete-preview-values.rq rename to upgrade/graphdb-se/old/1230-delete-previews/sparql/delete-preview-values.rq diff --git a/upgrade/old/1230-delete-previews/sparql/get-preview-data.rq b/upgrade/graphdb-se/old/1230-delete-previews/sparql/get-preview-data.rq similarity index 100% rename from upgrade/old/1230-delete-previews/sparql/get-preview-data.rq rename to upgrade/graphdb-se/old/1230-delete-previews/sparql/get-preview-data.rq diff --git a/upgrade/old/1263-knora-admin/README.md b/upgrade/graphdb-se/old/1263-knora-admin/README.md similarity index 100% rename from upgrade/old/1263-knora-admin/README.md rename to upgrade/graphdb-se/old/1263-knora-admin/README.md diff --git a/upgrade/old/1263-knora-admin/knora-ontologies/knora-admin.ttl b/upgrade/graphdb-se/old/1263-knora-admin/knora-ontologies/knora-admin.ttl similarity index 100% rename from upgrade/old/1263-knora-admin/knora-ontologies/knora-admin.ttl rename to upgrade/graphdb-se/old/1263-knora-admin/knora-ontologies/knora-admin.ttl diff --git a/upgrade/old/1263-knora-admin/knora-ontologies/knora-base.ttl b/upgrade/graphdb-se/old/1263-knora-admin/knora-ontologies/knora-base.ttl similarity index 100% rename from upgrade/old/1263-knora-admin/knora-ontologies/knora-base.ttl rename to upgrade/graphdb-se/old/1263-knora-admin/knora-ontologies/knora-base.ttl diff --git a/upgrade/old/1263-knora-admin/update-knora-admin.py b/upgrade/graphdb-se/old/1263-knora-admin/update-knora-admin.py similarity index 100% rename from upgrade/old/1263-knora-admin/update-knora-admin.py rename to upgrade/graphdb-se/old/1263-knora-admin/update-knora-admin.py diff --git a/upgrade/README.md b/upgrade/graphdb-se/old/README.md similarity index 55% rename from upgrade/README.md rename to upgrade/graphdb-se/old/README.md index bbfa8ef17b..0ae0fe826f 100644 --- a/upgrade/README.md +++ b/upgrade/graphdb-se/old/README.md @@ -1,9 +1,8 @@ -# Updating Repositories When Upgrading Knora +# Upgrading from a Knora Version Before 7.0.0 -The command-line program `update-repository.py`, located in this directory, -updates a Knora repository when a Knora upgrade introduces changes that are not -backwards-compatible with existing data. The program checks your repository -and applies any necessary changes. +If you are upgrading from a version of Knora before 7.0.0, you will need +the scripts in `old`. See "Updating Repositories When Upgrading Knora" +in the Knora documentation for details on which scripts to run. ## Prerequisites @@ -26,8 +25,8 @@ scripts: ### Updating Repositories -Run `./update-repository.py` in this directory. You will need to provide some -command-line options; type `./update-repository.py --help` for instructions. +Follow the the instructions in the `README` in the subdirectory containing +each script you need to run. ### After Updating Repositories diff --git a/upgrade/requirements.txt b/upgrade/graphdb-se/old/requirements.txt similarity index 100% rename from upgrade/requirements.txt rename to upgrade/graphdb-se/old/requirements.txt diff --git a/upgrade/graphdb-se/upload-repository.sh b/upgrade/graphdb-se/upload-repository.sh new file mode 100755 index 0000000000..8b8ffe062b --- /dev/null +++ b/upgrade/graphdb-se/upload-repository.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +#set -x + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -r|--repository) + REPOSITORY="$2" + shift # past argument + shift # past value + ;; + -u|--username) + USERNAME="$2" + shift # past argument + shift # past value + ;; + -p|--password) + PASSWORD="$2" + shift # past argument + shift # past value + ;; + -h|--host) + HOST="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +FILE="$1" + +if [[ -z "${REPOSITORY}" || -z "${USERNAME}" || -z "${FILE}" ]]; then + echo "Usage: $(basename "$0") -r|--repository REPOSITORY -u|--username USERNAME [-p|--password PASSWORD] [-h|--host HOST] FILE" + exit 1 +fi + +if [[ -z "${PASSWORD}" ]]; then + echo -n "Password: " + IFS="" read -rs PASSWORD + echo +fi + +if [[ -z "${HOST}" ]]; then + HOST="localhost:7200" +fi + +curl -X POST -H "Content-Type: application/trig" -d "@${FILE}" -u "${USERNAME}:${PASSWORD}" "http://${HOST}/repositories/${REPOSITORY}/statements" | tee /dev/null diff --git a/upgrade/plugins/pr1307/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1307/knora-ontologies/knora-admin.ttl deleted file mode 100644 index 68df980d37..0000000000 --- a/upgrade/plugins/pr1307/knora-ontologies/knora-admin.ttl +++ /dev/null @@ -1,773 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix knora-base: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora admin ontology"@en ; - - knora-base:attachedToProject :SystemProject . - - -################################################################# -# -# Object Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#belongsToInstitution - -:belongsToInstitution rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which Institution a knoraProject belongs to"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectClassConstraint :Institution . - - - -### http://www.knora.org/ontology/knora-admin#belongsToProject - -:belongsToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which knoraProject a UserGroup belongs to"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#currentproject - -:currentproject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isInGroup - -:isInGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given UserGroup"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :UserGroup . - - - -### http://www.knora.org/ontology/knora-admin#isInProject - -:isInProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given knoraProject"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isAdminForProject - -:isInProjectAdminGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given Project's ProjectAdmin group"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-admin#address - -:address rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:comment "Address of a person or an institution"@en . - - -### http://www.knora.org/ontology/knora-admin#groupName - -:groupName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The group's name"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:subPropertyOf . - - - -### http://www.knora.org/ontology/knora-admin#groupDescription - -:groupDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a user group"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled - -:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if users can add themselves to the project or group"@en ; - - # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#institutionName - -:institutionName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The institutions's name"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionDescription - -:institutionDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of an institution"@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionWebsite - -:institutionWebsite rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The URL of a web site"@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-admin#isActiveUser - -:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#givenName - -:givenName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#familyName - -:familyName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#password - -:password rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "An encrypted credential for access"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#phone - -:phone rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Phone number of a person, institution, etc."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#preferredLanguage - -:preferredLanguage rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Language (\"en\", \"de\", \"fr\", \"it\", \"gr\", etc.)"@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectDescription - -:projectDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a Knora project"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectKeyword - -:projectKeyword rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A keyword describing a project"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLongname - -:projectLongname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The longname of a Knora project"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLogo - -:projectLogo rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Path to the projects logo"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize - -:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark - -:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Path to the restricted view watermark"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectShortname - -:projectShortname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique shortname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectShortcode - -:projectShortcode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique short code of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#username - -:username rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The username and login name of a user of Knora"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#email - -:email rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The email address and login name of a user of Knora"@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#status - -:status rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)"@en ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -################################################################# -# -# Classes -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#Institution - -:Institution rdf:type owl:Class ; - - rdfs:subClassOf foaf:Organization , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionWebsite ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :phone ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "An institution that has data in Knora"@en . - - - -### http://www.knora.org/ontology/knora-admin#User - -:User rdf:type owl:Class ; - - rdfs:subClassOf foaf:Person , - [ rdf:type owl:Restriction ; - owl:onProperty :username ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :familyName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :givenName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :password ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :preferredLanguage ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInProject ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInGroup ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInSystemAdminGroup ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a Knora user"@en . - - - -### http://www.knora.org/ontology/knora-admin#UserGroup - -:UserGroup rdf:type owl:Class ; - - rdfs:subClassOf foaf:Group , - [ rdf:type owl:Restriction ; - owl:onProperty :groupName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :groupDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "A group of Knora users"@en . - - - - -### http://www.knora.org/ontology/knora-admin#knoraProject - -:knoraProject rdf:type owl:Class ; - - rdfs:subClassOf foaf:Project , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortcode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLongname ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectDescription ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectKeyword ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLogo ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewSize ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewWatermark ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToInstitution ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a project that uses Knora"@en . - - - - -################################################################# -# -# Individuals -# -################################################################# - -### http://www.knora.org/ontology/knora-admin#UnknownUser -:UnknownUser rdf:type :UserGroup ; - :groupName "UnknownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#KnownUser -:KnownUser rdf:type :UserGroup ; - :groupName "KnownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#Creator -:Creator rdf:type :UserGroup ; - :groupName "Creator" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectMember -:ProjectMember rdf:type :UserGroup ; - :groupName "ProjectMember" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectAdmin -:ProjectAdmin rdf:type :UserGroup ; - :groupName "ProjectAdmin" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemAdmin -:SystemAdmin rdf:type :UserGroup ; - :groupName "SystemAdmin" ; - :belongsToProject :SystemProject ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemUser -:SystemUser rdf:type :User ; - rdfs:comment "A built-in system user."@en ; - :username "system"; - :email "system@localhost" ; - :givenName "Knora" ; - :familyName "System" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#AnonymousUser -:AnonymousUser rdf:type :User ; - rdfs:comment "A built-in anonymous user."@en ; - :username "anonymous" ; - :email "anonymous@localhost" ; - :givenName "Knora" ; - :familyName "Anonymous" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemProject -:SystemProject rdf:type :knoraProject ; - rdfs:comment "A built-in project representing the Knora System."@en ; - :projectShortname "SystemProject" ; - :projectShortcode "FFFF" ; - :projectLongname "Knora System Project" ; - :projectDescription "Knora System Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - - -### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject -:DefaultSharedOntologiesProject rdf:type :knoraProject ; - rdfs:comment "The default project for shared ontologies."@en ; - :projectShortname "DefaultSharedOntologiesProject" ; - :projectShortcode "0000" ; - :projectLongname "Knora Default Shared Ontologies Project" ; - :projectDescription "Knora Shared Ontologies Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -# -## -### Permission Class Properties -## -# -### http://www.knora.org/ontology/knora-admin#forProject - -:forProject rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a knoraProject."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :knoraProject . - -### http://www.knora.org/ontology/knora-admin#forGroup -:forGroup rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a UserGroup."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :UserGroup . - -### http://www.knora.org/ontology/knora-admin#forResourceClass -:forResourceClass rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource class."@en ; - knora-base:subjectClassConstraint :Permission . - -### http://www.knora.org/ontology/knora-admin#forProperty -:forProperty rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource property."@en ; - knora-base:subjectClassConstraint :Permission . - - -# -## -### Permission Class and Sub-Classes -## -# -### http://www.knora.org/ontology/knora-admin#Permission -:Permission rdf:type owl:Class ; - rdfs:comment "Base Permission class."@en. - - -### http://www.knora.org/ontology/knora-admin#AdministrativePermission -:AdministrativePermission rdf:type owl:Class ; - rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; - rdfs:subClassOf :Permission . - -### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission -:DefaultObjectAccessPermission rdf:type owl:Class ; - rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; - rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1307/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1307/knora-ontologies/knora-base.ttl deleted file mode 100644 index 51dadc6c60..0000000000 --- a/upgrade/plugins/pr1307/knora-ontologies/knora-base.ttl +++ /dev/null @@ -1,2691 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@prefix salsah-gui: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora base ontology"@en ; - - :attachedToProject knora-admin:SystemProject ; - - :ontologyVersion "PR 1307" . - - - -################################################################# -# -# Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-base#ontologyVersion - -:ontologyVersion rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; - - :subjectClassConstraint owl:Ontology ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isMainResource - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:isMainResource rdf:type owl:DatatypeProperty ; - - rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted - -:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; - - rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . - - - -### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint - -:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; - - rdfs:comment "Specifies the type required as the object of a datatype property"@en . - - - -### http://www.knora.org/ontology/knora-base#resourceIcon - -:resourceIcon rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#resourceProperty - -:resourceProperty rdf:type owl:ObjectProperty ; - - rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#subjectClassConstraint - -:subjectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#objectClassConstraint - -:objectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#isEditable - -:isEditable rdf:type owl:AnnotationProperty ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "is editable"@en ; - - rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#canBeInstantiated - -:canBeInstantiated rdf:type owl:AnnotationProperty ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "can be instantiated"@en ; - - rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#attachedToProject - -:attachedToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to project"@en ; - - rdfs:comment "Connects something to a project"@en ; - - :objectClassConstraint knora-admin:knoraProject . - - - -### http://www.knora.org/ontology/knora-base#attachedToUser - -:attachedToUser rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to user"@en ; - - rdfs:comment "Connects something to a user"@en ; - - :objectClassConstraint knora-admin:User . - - -### http://www.knora.org/ontology/knora-base#hasColor - -:hasColor rdf:type owl:ObjectProperty ; - - rdfs:label "Farbe"@de , - "Color"@en , - "Couleur"@fr , - "Colore"@it ; - - rdfs:comment """Specifies the color of a region."""@en ; - - salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; - - :objectClassConstraint :ColorValue ; - - :subjectClassConstraint :Region ; - - rdfs:subPropertyOf :hasValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Colorpicker . - - - -### http://www.knora.org/ontology/knora-base#hasComment - -:hasComment rdf:type owl:ObjectProperty ; - - rdfs:label "Kommentar"@de , - "Comment"@en , - "Commentaire"@fr , - "Commento"@it ; - - rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :TextValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Richtext ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasExtResValue - -:hasExtResValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat externen Wert"@de , - "has external Value"@en , - "a valeur externe"@fr , - "ha valore esterno"@it ; - - :objectClassConstraint :ExternalResValue ; - - :subjectClassConstraint :ExternalResource ; - - rdfs:subPropertyOf :hasValue . - - -### http://www.knora.org/ontology/knora-base#hasFileValue - -:hasFileValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :FileValue ; - - rdfs:label "hat Datei"@de , - "has file"@en , - "a fichier"@fr , - "ha file"@it ; - - rdfs:comment "Connects a Representation to a file"@en ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - :subjectClassConstraint :Representation ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasStillImageFileValue - -:hasStillImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Bilddatei"@de , - "has image file"@en , - "a fichier d'image"@fr , - "ha file imagine"@it ; - - rdfs:comment "Connects a Representation to an image file"@en ; - - :objectClassConstraint :StillImageFileValue ; - - :subjectClassConstraint :StillImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue - -:hasMovingImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Filmdatei"@de , - "has movie file"@en , - "a fichier de film"@fr , - "ha file film"@it ; - - rdfs:comment "Connects a Representation to a movie file"@en ; - - :objectClassConstraint :MovingImageFileValue ; - - :subjectClassConstraint :MovingImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasAudioFileValue - -:hasAudioFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Audiodatei"@de , - "has audio file"@en , - "a fichier d'audio"@fr , - "ha file audio"@it ; - - rdfs:comment "Connects a Representation to an audio file"@en ; - - :objectClassConstraint :AudioFileValue ; - - :subjectClassConstraint :AudioRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDDDFileValue - -:hasDDDFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat 3D-Datei"@de , - "has 3D-file"@en , - "a ficher de 3D"@fr , - "ha file 3D"@it ; - - rdfs:comment "Connects a Representation to a 3D-file"@en ; - - :objectClassConstraint :DDDFileValue ; - - :subjectClassConstraint :DDDRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasTextFileValue - -:hasTextFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Textdatei"@de , - "has text file"@en , - "a fichier de texte"@fr , - "ha file testo"@it ; - - rdfs:comment "Connects a Representation to a text file"@en ; - - :objectClassConstraint :TextFileValue ; - - :subjectClassConstraint :TextRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDocumentFileValue - -:hasDocumentFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Dokument"@de , - "has document"@en , - "a document"@fr , - "ha documento"@it ; - - rdfs:comment "Connects a Representation to a document"@en ; - - :objectClassConstraint :DocumentFileValue ; - - :subjectClassConstraint :DocumentRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasGeometry - -:hasGeometry rdf:type owl:ObjectProperty ; - - rdfs:label "Geometrie"@de , - "Geometry"@en , - "Géometrie"@fr , - "Geometria"@it ; - - rdfs:comment """Represents a geometrical shape."""@en ; - - rdfs:subPropertyOf :hasValue ; - - salsah-gui:guiElement salsah-gui:Geometry ; - - :isEditable true ; - - :objectClassConstraint :GeomValue ; - - :subjectClassConstraint :Region . - - - -### http://www.knora.org/ontology/knora-base#hasLinkTo - -:hasLinkTo rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#hasLinkToValue - -:hasLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentation - -:hasRepresentation rdf:type owl:ObjectProperty ; - - rdfs:label "hat Repräsentation"@de , - "has Representation"@en , - "a Répresentation"@fr , - "ha Rappresentazione"@it ; - - rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; - - :objectClassConstraint :Representation ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentationValue - -:hasRepresentationValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo - -:hasStandoffLinkTo rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue - -:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasLink - -:standoffTagHasLink rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :StandoffLinkTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference - -:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :StandoffInternalReferenceTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStart - -:standoffTagHasStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEnd - -:standoffTagHasEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex - -:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex - -:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor - -:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent - -:standoffTagHasStartParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent - -:standoffTagHasEndParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasUUID - -:standoffTagHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:string . - - -:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#hasSubListNode - -:hasSubListNode rdf:type owl:ObjectProperty ; - - rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :ListNode ; - - :subjectClassConstraint :ListNode . - - -### http://www.knora.org/ontology/knora-base#hasValue - -:hasValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Value . - - -### http://www.knora.org/ontology/knora-base#isAnnotationOf - -:isAnnotationOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Annotation von"@de , - "is Annotation of"@en , - "est Annotation de"@fr , - "è Annotation di"@it ; - - :subjectClassConstraint :Annotation ; - - :objectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isAnnotationOfValue - -:isAnnotationOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Annotation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isPartOf - -:isPartOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Teil von"@de , - "is part of"@en , - "fait partie de"@fr , - "fa parte di"@it ; - - rdfs:comment "Indicates that this resource is part of another resource"@en ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isPartOfValue - -:isPartOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isRegionOf - -:isRegionOf rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :subjectClassConstraint :Region ; - - :objectClassConstraint :Representation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isRegionOfValue - -:isRegionOfValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Region ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#previousValue - -:previousValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "Points to the previous verson of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectClassConstraint :Value . - - - -### http://www.knora.org/ontology/knora-base#seqnum - -:seqnum rdf:type owl:ObjectProperty ; - - :objectClassConstraint :IntValue ; - - rdfs:subPropertyOf :hasValue ; - - rdfs:label "Sequenznummer"@de , - "Sequence number"@en , - "Numéro de séquence"@fr , - "Numero di sequenza"@it ; - - rdfs:comment "Indicates the position of a resource within a sequence"@en . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID - -:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - - -### http://www.knora.org/ontology/knora-base#valueHasStandoff - -:valueHasStandoff rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasLanguage - -:valueHasLanguage rdf:type owl:DatatypeProperty ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasMapping - -:valueHasMapping rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :XMLToStandoffMapping ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#hasMappingElement - -:hasMappingElement rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "mapping element"@en ; - - rdfs:comment """Represents an element in a mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :MappingElement . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname - -:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML tag"@en ; - - rdfs:comment """name of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace - -:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "namespace of the XML tag"@en ; - - rdfs:comment """namespace of the XML tag"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLClass - -:mappingHasXMLClass rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "class of the XML tag"@en ; - - rdfs:comment """class of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass - -:mappingHasStandoffClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff class"@en ; - - rdfs:comment """IRI of the standoff class"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectClassConstraint owl:Class . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute - -:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename - -:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty - -:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff property"@en ; - - rdfs:comment """IRI of the standoff property"""@en ; - - :subjectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass - -:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "datatype of the XML tag"@en ; - - rdfs:comment """datatype of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingStandoffDataTypeClass . - - -### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator - -:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "indicates if the element requires a separator in the text"@en ; - - rdfs:comment """indicates if the element requires a separator in the text"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation - -:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "default XSL Transformation"@en ; - - rdfs:comment """default XSL Transformation for this mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :XSLTransformation . - - -### http://www.knora.org/ontology/knora-base#deletedBy - -:deletedBy rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates who deleted a resource or value"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectClassConstraint knora-admin:User . - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#creationDate - -:creationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource was created"@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#deleteDate - -:deleteDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource or value was deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:dateTime . - - -### http://www.knora.org/ontology/knora-base#dimX - -:dimX rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#dimY - -:dimY rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#duration - -:duration rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#extResAccessInfo - -:extResAccessInfo rdf:type owl:DatatypeProperty ; - - rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResId - -:extResId rdf:type owl:DatatypeProperty ; - - rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResProvider - -:extResProvider rdf:type owl:DatatypeProperty ; - - rdfs:comment "The name of the external provider of the resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - - -### http://www.knora.org/ontology/knora-base#fps - -:fps rdf:type owl:DatatypeProperty ; - - rdfs:label "Frames per second"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :MovingImageFileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#internalFilename - -:internalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#internalMimeType - -:internalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isDeleted - -:isDeleted rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the resource has been deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#isRootNode - -:isRootNode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#hasRootNode - -:hasRootNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint :ListNode . - - - - -### http://www.knora.org/ontology/knora-base#lastModificationDate - -:lastModificationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#listNodePosition - -:listNodePosition rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#listNodeName - -:listNodeName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalFilename - -:originalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalMimeType - -:originalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasComment - -:valueHasComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment on a value"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#deleteComment - -:deleteComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueCreationDate - -:valueCreationDate rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :Value ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#valueHas - -:valueHas rdf:type rdf:Property ; - - :subjectClassConstraint :ValueBase ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . - - - -### http://www.knora.org/ontology/knora-base#valueHasCalendar - -:valueHasCalendar rdf:type owl:DatatypeProperty ; - - rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasColor - -:valueHasColor rdf:type owl:DatatypeProperty ; - - rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ColorBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndJDN - -:valueHasEndJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndPrecision - -:valueHasEndPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasDecimal - -:valueHasDecimal rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DecimalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeometry - -:valueHasGeometry rdf:type owl:DatatypeProperty ; - - rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeomValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeonameCode - -:valueHasGeonameCode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeonameValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasInteger - -:valueHasInteger rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasBoolean - -:valueHasBoolean rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :BooleanBase ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#valueHasUri - -:valueHasUri rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :UriBase ; - - :objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd - -:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart - -:valueHasIntervalStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasListNode - -:valueHasListNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ListValue ; - - :objectClassConstraint :ListNode . - - - -### http://www.knora.org/ontology/knora-base#valueHasOrder - -:valueHasOrder rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#valueHasRefCount - -:valueHasRefCount rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :LinkValue ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartJDN - -:valueHasStartJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartPrecision - -:valueHasStartPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasString - -:valueHasString rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#hasPermissions - -:hasPermissions rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string . - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#Annotation - -:Annotation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOf ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOfValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Annotation"@de , - "Annotation"@en , - "Annotation"@fr , - "Annotation"@it ; - - :canBeInstantiated true ; - - rdfs:comment "A generic class for representing annotations"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioFileValue - -:AudioFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an audio file"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioRepresentation - -:AudioRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasAudioFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Audio)"@de , - "Representation (Audio)"@en , - "Répresentation (Audio)"@fr , - "Rappresentazione (Audio)"@it ; - - rdfs:comment "Represents a file containing audio data"@en . - - -### http://www.knora.org/ontology/knora-base#ColorBase - -:ColorBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#ColorValue - -:ColorValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :ColorBase ; - - rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . - - - -### http://www.knora.org/ontology/knora-base#DDDFileValue - -:DDDFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#DDDRepresentation - -:DDDRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDDDFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (3D)"@de , - "Representation (3D)"@en , - "Répresentation (3D)"@fr , - "Rappresentazione (3D)"@it ; - - rdfs:comment "Represents a file containg 3D data"@en . - - -### http://www.knora.org/ontology/knora-base#DateBase - -:DateBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasCalendar ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DateValue - -:DateValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DateBase ; - - rdfs:comment "Represents a Knora date value"@en . - - - -### http://www.knora.org/ontology/knora-base#DocumentFileValue - -:DocumentFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue . - - - -### http://www.knora.org/ontology/knora-base#DocumentRepresentation - -:DocumentRepresentation rdf:type owl:Class ; - - rdfs:label "Repräsentation (Dokument)"@de , - "Representation (Document)"@en , - "Répresentation (Document)"@fr , - "Rappresentazione (Documento)"@it ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDocumentFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResValue - -:ExternalResValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :extResId ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResProvider ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResAccessInfo ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResource - -:ExternalResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasExtResValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Externe Ressource"@de , - "External Resource"@en , - "Ressource Externe"@fr , - "Risorsa esterna"@it ; - - rdfs:comment "Represents a proxy for an object stored by an external provider"@en . - - - -### http://www.knora.org/ontology/knora-base#FileValue - -:FileValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :originalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :originalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DecimalBase - -:DecimalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasDecimal ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#DecimalValue - -:DecimalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DecimalBase ; - - rdfs:comment "Represents an arbitrary-precision decimal value"@en . - - - -### http://www.knora.org/ontology/knora-base#GeomValue - -:GeomValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeometry ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a geometrical objects as JSON string"@en . - - - -### http://www.knora.org/ontology/knora-base#GeonameValue - -:GeonameValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeonameCode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntBase - -:IntBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasInteger ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntValue - -:IntValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :IntBase ; - - rdfs:comment "Represents an integer value"@en . - -### http://www.knora.org/ontology/knora-base#BooleanBase - -:BooleanBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasBoolean ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#BooleanValue - -:BooleanValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :BooleanBase ; - - rdfs:comment "Represents a boolean value"@en . - - - -### http://www.knora.org/ontology/knora-base#UriBase - -:UriBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUri ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - -### http://www.knora.org/ontology/knora-base#UriValue - -:UriValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :UriBase ; - - rdfs:comment "Represents a URI"@en . - -### http://www.knora.org/ontology/knora-base#IntervalBase - -:IntervalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#IntervalValue - -:IntervalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :IntervalBase ; - - rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkObj - -:LinkObj rdf:type owl:Class ; - - rdfs:label "Verknüpfungsobjekt"@de , - "Link Object"@en , - "Objet de lien"@fr , - "Oggetto di connessione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkTo ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkToValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "link.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Verknüpfung mehrerer Resourcen"@de , - "Represents a generic link object"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkValue - -:LinkValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - rdf:Statement , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasRefCount ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:subject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:predicate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:object ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A reification node that describes direct links between resources"@en . - - - -### http://www.knora.org/ontology/knora-base#ListNode - -:ListNode rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :hasSubListNode ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodePosition ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodeName ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "Represents a flat or hierarchical list"@en . - - - -### http://www.knora.org/ontology/knora-base#ListValue - -:ListValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasListNode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#MovingImageFileValue - -:MovingImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :fps ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a moving image file"@en . - - - -### http://www.knora.org/ontology/knora-base#MovingImageRepresentation - -:MovingImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasMovingImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Video)"@de , - "Representation (Movie)"@en , - "Répresentation (Film)"@fr , - "Rappresentazione (Film)"@it ; - - rdfs:comment "A resource containing moving image data"@en . - - - -### http://www.knora.org/ontology/knora-base#Region - -:Region rdf:type owl:Class ; - - rdfs:label "Region"@de , - "Region"@en , - "Région"@fr , - "Regione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOf ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasGeometry ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOfValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "region.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . - - - -### http://www.knora.org/ontology/knora-base#Representation - -:Representation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation"@de , - "Representation"@en , - "Répresentation"@fr , - "Rappresentazione"@it ; - - rdfs:comment "A resource that can store a file"@en . - - - -### http://www.knora.org/ontology/knora-base#Resource - -:Resource rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkTo ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkToValue ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :creationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :lastModificationDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Ressource"@de , - "Resource"@en , - "Ressource"@fr , - "Risorsa"@it ; - - rdfs:comment "Represents something in the world, or an abstract thing"@en . - - -################################################################# -# -# Generic Standoff Tag -# -################################################################# - - -:standoffParentClassConstraint rdf:type owl:ObjectProperty . - - -### http://www.knora.org/ontology/knora-base#StandoffTag - -:StandoffTag rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasUUID ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasOriginalXMLID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartIndex ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffParentClassConstraint; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a standoff markup tag"@en . - - - -################################################################# -# -# Abstract Standoff Data Type Tag -# -################################################################# - -### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag - -:StandoffDataTypeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag ; - - rdfs:comment "Represents a knora-base value type in a TextValue"@en . - - -################################################################# -# -# Standoff Data Type Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#StandoffLinkTag - -:StandoffLinkTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasLink ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffUriTag - -:StandoffUriTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag , - :UriBase ; - - rdfs:comment "Represents an arbitrary URI in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDateTag - -:StandoffDateTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DateBase ; - - rdfs:comment "Represents a date in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffColorTag - -:StandoffColorTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ColorBase ; - - rdfs:comment "Represents a color in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntegerTag - -:StandoffIntegerTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntBase ; - - rdfs:comment "Represents an integer value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDecimalTag - -:StandoffDecimalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DecimalBase ; - - rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntervalTag - -:StandoffIntervalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntervalBase ; - - rdfs:comment "Represents an interval in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffBooleanTag - -:StandoffBooleanTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :BooleanBase ; - - rdfs:comment "Represents a boolean in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag - -:StandoffInternalReferenceTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasInternalReference ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an internal reference in a TextValue"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageFileValue - -:StillImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A file containing a two-dimensional still image"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageRepresentation - -:StillImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStillImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Bild)"@de , - "Representation (Image)"@en , - "Répresentation (Image)"@fr , - "Rappresentazione (Imagine)"@it ; - - rdfs:comment "A resource that can contain a two-dimensional still image file"@en . - - - -### http://www.knora.org/ontology/knora-base#TextFileValue - -:TextFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#TextRepresentation - -:TextRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Text)"@de , - "Representation (Text)"@en , - "Répresentation (Texte)"@fr , - "Rappresentazione (testo)"@it ; - - rdfs:comment "A resource containing a text file"@en . - - -### http://www.knora.org/ontology/knora-base#ForbiddenResource - -:ForbiddenResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ]; - - rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; - - rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . - -### http://www.knora.org/ontology/knora-base#XSLTransformation - -:XSLTransformation rdf:type owl:Class ; - - rdfs:subClassOf :TextRepresentation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; - - rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . - - -### http://www.knora.org/ontology/knora-base#MappingComponent - -:MappingComponent rdf:type owl:Class ; - - rdfs:label "Component of a mapping"@en ; - - rdfs:comment "Component of a mapping" . - - -### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass - -:MappingStandoffDataTypeClass rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingXMLAttribute - -:MappingXMLAttribute rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffProperty ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingElement - -:MappingElement rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLTagname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttribute ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffDataTypeClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingElementRequiresSeparator ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping - -:XMLToStandoffMapping rdf:type owl:Class ; - - rdfs:subClassOf - [ rdf:type owl:Restriction ; - owl:onProperty :hasMappingElement ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasDefaultXSLTransformation ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#TextValue - -:TextValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStandoff ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMaxStandoffStartIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasLanguage ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMapping ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ValueBase - -:ValueBase rdf:type owl:Class . - - -### http://www.knora.org/ontology/knora-base#Value - -:Value rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :valueCreationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasOrder ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :previousValue ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasString ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1307/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1307/knora-ontologies/salsah-gui.ttl deleted file mode 100644 index 6c183c0f51..0000000000 --- a/upgrade/plugins/pr1307/knora-ontologies/salsah-gui.ttl +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@prefix knora-base: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The salsah-gui ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Properties -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#guiOrder - -:guiOrder rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint owl:Restriction ; - - knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . - - - -### http://www.knora.org/ontology/salsah-gui#guiElement - -:guiElement rdf:type owl:ObjectProperty . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttribute - -:guiAttribute rdf:type owl:DatatypeProperty ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition - -:guiAttributeDefinition rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint :Guielement ; - - knora-base:objectDatatypeConstraint xsd:string . - - - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Guielement - -:Guielement rdf:type owl:Class . - - - - - -################################################################# -# -# Individuals -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Colorpicker - -:Colorpicker rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "ncolors:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Date - -:Date rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geometry - -:Geometry rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geonames - -:Geonames rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Iconclass - -# :Iconclass rdf:type :Guielement , -# owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Interval - -:Interval rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#List - -:List rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Pulldown - -:Pulldown rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Radio - -:Radio rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Richtext - -:Richtext rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Searchbox - -:Searchbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "numprops:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#SimpleText - -:SimpleText rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "size:integer" , - "maxlength:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Slider - -:Slider rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max(required):decimal" , - "min(required):decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Spinbox - -:Spinbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max:decimal" , - "min:decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Textarea - -:Textarea rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "cols:integer" , - "rows:integer" , - "width:percent" , - "wrap:string(soft|hard)" . - - -### http://www.knora.org/ontology/salsah-gui#Checkbox - -:Checkbox rdf:type :Guielement , - owl:NamedIndividual . - - -### http://www.knora.org/ontology/salsah-gui#Fileupload - -:Fileupload rdf:type :Guielement , - owl:NamedIndividual . diff --git a/upgrade/plugins/pr1307/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1307/knora-ontologies/standoff-onto.ttl deleted file mode 100644 index f5113c5028..0000000000 --- a/upgrade/plugins/pr1307/knora-ontologies/standoff-onto.ttl +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix salsah-gui: . -@base . - -@prefix : . - - rdf:type owl:Ontology ; - - rdfs:label "The standoff ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Standoff Properties -# -################################################################# - -### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType - -:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the document type"@en ; - - knora-base:subjectClassConstraint :StandoffRootTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget - -:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the target settings of a hyperlink"@en ; - - knora-base:subjectClassConstraint :StandoffHyperlinkTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -################################################################# -# -# Intermediate Standoff Tags -# -################################################################# - -### http://www.knora.org/ontology/standoff#StandoffVisualTag - -:StandoffVisualTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents visual markup information in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStructuralTag - -:StandoffStructuralTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents structural markup information in a TextValue"@en . - - -################################################################# -# -# Standoff Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/standoff#StandoffRootTag - -:StandoffRootTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffRootTagHasDocumentType ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . - -### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag - -:StandoffHyperlinkTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffUriTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffHyperlinkTagHasTarget ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a hyperlink in a text"@en . - -### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag - -:StandoffBlockquoteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section that is quoted from another source in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffCodeTag - -:StandoffCodeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section of computer source code in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffParagraphTag - -:StandoffParagraphTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a paragraph in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader1Tag - -:StandoffHeader1Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 1 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader2Tag - -:StandoffHeader2Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 2 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader3Tag - -:StandoffHeader3Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 3 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader4Tag - -:StandoffHeader4Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 4 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader5Tag - -:StandoffHeader5Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 5 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader6Tag - -:StandoffHeader6Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 6 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffOrderedListTag - -:StandoffOrderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an ordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag - -:StandoffUnorderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an unordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffListElementTag - -:StandoffListElementTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a list element in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableBodyTag - -:StandoffTableBodyTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table body in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableTag - -:StandoffTableTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableRowTag - -:StandoffTableRowTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a row in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableCellTag - -:StandoffTableCellTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a cell in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBrTag - -:StandoffBrTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a linebreak"@en . - - - -### http://www.knora.org/ontology/standoff#StandoffItalicTag - -:StandoffItalicTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents italics in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBoldTag - -:StandoffBoldTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents bold text in a TextValue"@en . - -### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag - -:StandoffCiteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents the title of a work in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnderlineTag - -:StandoffUnderlineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents underlined text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag - -:StandoffStrikethroughTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents struck text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag - -:StandoffSuperscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents superscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSubscriptTag - -:StandoffSubscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents subscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag - -:StandoffLineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a line to seperate content in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag - -:StandoffPreTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1307/test_1307.py b/upgrade/plugins/pr1307/test_1307.py deleted file mode 100644 index cc087b5c6f..0000000000 --- a/upgrade/plugins/pr1307/test_1307.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import tempfile -import rdflib -from rdflib.term import URIRef, Literal -from rdflib.namespace import XSD -from plugins.pr1307.update import GraphTransformer - -save_output = False - - -def test_update(): - input_graph = rdflib.Graph() - input_graph.parse("plugins/pr1307/test_data.ttl", format="turtle") - transformer = GraphTransformer() - output_graph = transformer.transform(input_graph) - - query_result = output_graph.query( - """ - PREFIX knora-base: - - SELECT ?s ?maxStartIndex WHERE { - ?s knora-base:valueHasMaxStandoffStartIndex ?maxStartIndex . - } - """ - ) - - max_start_index = set([(row["s"], row["maxStartIndex"]) for row in query_result]) - - assert max_start_index == { - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ"), - Literal("7", datatype=XSD.integer) - ) - } - - query_result = output_graph.query( - """ - PREFIX knora-base: - - SELECT ?tag WHERE { - knora-base:valueHasStandoff ?tag . - } - """ - ) - - tags = set([row["tag"] for row in query_result]) - - assert tags == { - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6"), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7") - } - - query_result = output_graph.query( - """ - PREFIX knora-base: - - SELECT ?tag ?startIndex ?startParent WHERE { - ?tag knora-base:standoffTagHasStartIndex ?startIndex . - - OPTIONAL { - ?tag knora-base:standoffTagHasStartParent ?startParent . - } - } - """ - ) - - tag_data = set([(row["tag"], row["startIndex"], row["startParent"]) for row in query_result]) - - assert tag_data == { - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0"), - Literal("0", datatype=XSD.integer), - None - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1"), - Literal("1", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2"), - Literal("2", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3"), - Literal("3", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4"), - Literal("4", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5"), - Literal("5", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6"), - Literal("6", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ), - ( - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7"), - Literal("7", datatype=XSD.integer), - URIRef("http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1") - ) - } - - if save_output: - temp_dir = tempfile.mkdtemp() - output_file_path = temp_dir + "/output.ttl" - output_graph.serialize(destination=output_file_path, format="turtle") - print("Wrote output to", output_file_path) diff --git a/upgrade/plugins/pr1307/test_data.ttl b/upgrade/plugins/pr1307/test_data.ttl deleted file mode 100644 index c9812af874..0000000000 --- a/upgrade/plugins/pr1307/test_data.ttl +++ /dev/null @@ -1,99 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix standoff: . -@prefix anything: . - - - a anything:Thing; - rdfs:label "Something with a lot of markup"; - knora-base:isDeleted false; - knora-base:attachedToProject ; - knora-base:creationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; - knora-base:attachedToUser ; - anything:hasRichtext . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueHasStandoff , - , - , - , - , - , - , - ; - knora-base:valueHasMapping ; - knora-base:valueCreationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "Something with a lot of different markup. And more markup."; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; - knora-base:attachedToUser . - - - a standoff:StandoffBoldTag; - knora-base:standoffTagHasStart 0; - knora-base:standoffTagHasEnd 9; - knora-base:standoffTagHasStartIndex 2; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "7f3af890-c77d-4bf8-a81c-6786632520dd" . - - - a standoff:StandoffSuperscriptTag; - knora-base:standoffTagHasStart 34; - knora-base:standoffTagHasEnd 40; - knora-base:standoffTagHasStartIndex 6; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "e2ab65d2-6c80-494e-88ba-66767ed885f9" . - - - a standoff:StandoffParagraphTag; - knora-base:standoffTagHasStart 0; - knora-base:standoffTagHasEnd 58; - knora-base:standoffTagHasStartIndex 1; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "f3c0773a-2eb3-4d2e-9a6f-c8f2582a146e" . - - - a knora-base:StandoffUriTag; - knora-base:standoffTagHasStart 51; - knora-base:standoffTagHasEnd 57; - knora-base:standoffTagHasStartIndex 7; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "7b9f4609-3ba6-43e5-b945-d4329a155ca7"; - knora-base:valueHasUri "http://www.google.ch"^^xsd:anyURI . - - - a standoff:StandoffUnderlineTag; - knora-base:standoffTagHasStart 24; - knora-base:standoffTagHasEnd 33; - knora-base:standoffTagHasStartIndex 5; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "df348cfa-c362-45e6-9e13-601442214064" . - - - a standoff:StandoffRootTag; - knora-base:standoffTagHasStart 0; - knora-base:standoffTagHasEnd 59; - knora-base:standoffTagHasStartIndex 0; - knora-base:standoffTagHasUUID "c41e4e78-8b4f-47fc-9d17-8af0a279c80c" . - - - a standoff:StandoffItalicTag; - knora-base:standoffTagHasStart 10; - knora-base:standoffTagHasEnd 14; - knora-base:standoffTagHasStartIndex 3; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "13f66d42-2b1f-4fb4-91aa-6c55e350b0f4" . - - - a standoff:StandoffStrikethroughTag; - knora-base:standoffTagHasStart 17; - knora-base:standoffTagHasEnd 20; - knora-base:standoffTagHasStartIndex 4; - knora-base:standoffTagHasStartParent ; - knora-base:standoffTagHasUUID "0aaa6e47-0e9b-494f-9b6a-f42c66471d30" . diff --git a/upgrade/plugins/pr1307/update.py b/upgrade/plugins/pr1307/update.py deleted file mode 100644 index 332e50a579..0000000000 --- a/upgrade/plugins/pr1307/update.py +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import rdflib -from rdflib.namespace import RDF, XSD -from updatelib import rdftools - - -# The IRI of knora-base:TextValue. -text_value_type = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#TextValue") - -# The IRI of knora-base:standoffTagHasStartParent. -standoff_tag_has_start_parent = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#standoffTagHasStartParent") - -# The IRI of knora-base:standoffTagHasEndParent. -standoff_tag_has_end_parent = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#standoffTagHasEndParent") - -# The IRI of knora-base:standoffTagHasStartIndex. -standoff_tag_has_start_index = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex") - -# The IRI of knora-base:valueHasStandoff. -value_has_standoff = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#valueHasStandoff") - -# The IRI of knora-base:valueHasMaxStandoffStartIndex. -value_has_max_standoff_start_index = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#valueHasMaxStandoffStartIndex") - - -# Updates standoff for PR 1307. -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - # Check whether the transformation has already been done. - statements_with_max_start_index = graph.subject_objects(value_has_max_standoff_start_index) - - if not rdftools.generator_is_empty(statements_with_max_start_index): - print("This transformation seems to have been done already.") - return graph - - # Group the statements in the named graph by subject and by predicate. - grouped_statements = rdftools.group_statements(graph) - - # Collect all text values included in the grouped statements. - text_values = collect_text_values(grouped_statements) - - # A set of subjects that will be transformed and should therefore not be copied - # from the input graph. - old_subjs = set() - - # A set of transformed statements to be included in the output graph. - transformed_statements = {} - - # Transform text values. - for text_value in text_values: - old_subjs.add(text_value.subj) - - for standoff_tag_old_subj in text_value.standoff_tags.keys(): - old_subjs.add(standoff_tag_old_subj) - - transformed_statements.update(text_value.transform_statements()) - - # Copy all non-transformed statements into the output graph. - for subj, pred_objs in grouped_statements.items(): - if subj not in old_subjs: - transformed_statements[subj] = pred_objs - - return rdftools.ungroup_statements(transformed_statements) - - -# Represents a standoff tag to be be transformed. -class StandoffTag: - def __init__(self, old_subj, pred_objs): - self.old_subj = old_subj - self.pred_objs = pred_objs - self.start_index = int(pred_objs[standoff_tag_has_start_index][0]) - self.new_subj = make_new_standoff_tag_iri(old_subj, self.start_index) - - # Transforms the statements whose subject is this text value. - def transform_pred_objs(self, standoff_tags): - transformed_pred_objs = {} - - for pred, objs in self.pred_objs.items(): - if pred == standoff_tag_has_start_parent or pred == standoff_tag_has_end_parent: - old_obj = objs[0] - new_obj = standoff_tags[old_obj].new_subj - transformed_pred_objs[pred] = [new_obj] - else: - transformed_pred_objs[pred] = objs - - return transformed_pred_objs - - -# Converts an old standoff tag IRI to a new one. -def make_new_standoff_tag_iri(old_subj, start_index): - old_subj_str = str(old_subj) - slash_pos = old_subj_str.rfind("/") + 1 - return rdflib.term.URIRef(old_subj_str[0:slash_pos] + str(start_index)) - - -# Represents a text value to be transformed. -class TextValue: - def __init__(self, subj, pred_objs, standoff_tags): - self.subj = subj - self.pred_objs = pred_objs - self.standoff_tags = standoff_tags - - # Transforms the statements whose subject is this text value or any of its standoff tags. - def transform_statements(self): - transformed_value_pred_objs = {} - - for pred, objs in self.pred_objs.items(): - if pred == value_has_standoff: - new_objs = [] - - for old_obj in objs: - new_objs.append(self.standoff_tags[old_obj].new_subj) - - transformed_value_pred_objs[pred] = new_objs - else: - transformed_value_pred_objs[pred] = objs - - if self.standoff_tags: - max_start_index = max([tag.start_index for tag in self.standoff_tags.values()]) - max_start_index_literal = rdflib.Literal(str(max_start_index), datatype=XSD.integer) - transformed_value_pred_objs[value_has_max_standoff_start_index] = [max_start_index_literal] - - transformed_statements = { - self.subj: transformed_value_pred_objs - } - - for tag in self.standoff_tags.values(): - transformed_statements[tag.new_subj] = tag.transform_pred_objs(self.standoff_tags) - - return transformed_statements - - -# Collects all text values found in grouped statements. -def collect_text_values(grouped_statements): - text_values = [] - - for subj, pred_objs in grouped_statements.items(): - if pred_objs[RDF.type][0] == text_value_type: - standoff_tags = {} - - if value_has_standoff in pred_objs: - standoff_subjs = pred_objs[value_has_standoff] - - for standoff_subj in standoff_subjs: - standoff_pred_objs = grouped_statements[standoff_subj] - standoff_tag = StandoffTag(old_subj=standoff_subj, pred_objs=standoff_pred_objs) - standoff_tags[standoff_subj] = standoff_tag - - text_values.append(TextValue(subj=subj, pred_objs=pred_objs, standoff_tags=standoff_tags)) - - return text_values diff --git a/upgrade/plugins/pr1322/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1322/knora-ontologies/knora-admin.ttl deleted file mode 100644 index 68df980d37..0000000000 --- a/upgrade/plugins/pr1322/knora-ontologies/knora-admin.ttl +++ /dev/null @@ -1,773 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix knora-base: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora admin ontology"@en ; - - knora-base:attachedToProject :SystemProject . - - -################################################################# -# -# Object Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#belongsToInstitution - -:belongsToInstitution rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which Institution a knoraProject belongs to"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectClassConstraint :Institution . - - - -### http://www.knora.org/ontology/knora-admin#belongsToProject - -:belongsToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which knoraProject a UserGroup belongs to"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#currentproject - -:currentproject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isInGroup - -:isInGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given UserGroup"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :UserGroup . - - - -### http://www.knora.org/ontology/knora-admin#isInProject - -:isInProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given knoraProject"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isAdminForProject - -:isInProjectAdminGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given User is part of the given Project's ProjectAdmin group"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-admin#address - -:address rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:comment "Address of a person or an institution"@en . - - -### http://www.knora.org/ontology/knora-admin#groupName - -:groupName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The group's name"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:subPropertyOf . - - - -### http://www.knora.org/ontology/knora-admin#groupDescription - -:groupDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a user group"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled - -:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if users can add themselves to the project or group"@en ; - - # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#institutionName - -:institutionName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The institutions's name"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionDescription - -:institutionDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of an institution"@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionWebsite - -:institutionWebsite rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The URL of a web site"@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-admin#isActiveUser - -:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#givenName - -:givenName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#familyName - -:familyName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#password - -:password rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "An encrypted credential for access"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#phone - -:phone rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Phone number of a person, institution, etc."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#preferredLanguage - -:preferredLanguage rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Language (\"en\", \"de\", \"fr\", \"it\", \"gr\", etc.)"@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectDescription - -:projectDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a Knora project"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectKeyword - -:projectKeyword rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A keyword describing a project"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLongname - -:projectLongname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The longname of a Knora project"@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLogo - -:projectLogo rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Path to the projects logo"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize - -:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark - -:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Path to the restricted view watermark"@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectShortname - -:projectShortname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique shortname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectShortcode - -:projectShortcode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique short code of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#username - -:username rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The username and login name of a user of Knora"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#email - -:email rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The email address and login name of a user of Knora"@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#status - -:status rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)"@en ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -################################################################# -# -# Classes -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#Institution - -:Institution rdf:type owl:Class ; - - rdfs:subClassOf foaf:Organization , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionWebsite ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :phone ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "An institution that has data in Knora"@en . - - - -### http://www.knora.org/ontology/knora-admin#User - -:User rdf:type owl:Class ; - - rdfs:subClassOf foaf:Person , - [ rdf:type owl:Restriction ; - owl:onProperty :username ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :familyName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :givenName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :password ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :preferredLanguage ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInProject ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInGroup ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInSystemAdminGroup ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a Knora user"@en . - - - -### http://www.knora.org/ontology/knora-admin#UserGroup - -:UserGroup rdf:type owl:Class ; - - rdfs:subClassOf foaf:Group , - [ rdf:type owl:Restriction ; - owl:onProperty :groupName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :groupDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "A group of Knora users"@en . - - - - -### http://www.knora.org/ontology/knora-admin#knoraProject - -:knoraProject rdf:type owl:Class ; - - rdfs:subClassOf foaf:Project , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortcode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLongname ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectDescription ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectKeyword ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLogo ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewSize ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewWatermark ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToInstitution ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a project that uses Knora"@en . - - - - -################################################################# -# -# Individuals -# -################################################################# - -### http://www.knora.org/ontology/knora-admin#UnknownUser -:UnknownUser rdf:type :UserGroup ; - :groupName "UnknownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#KnownUser -:KnownUser rdf:type :UserGroup ; - :groupName "KnownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#Creator -:Creator rdf:type :UserGroup ; - :groupName "Creator" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectMember -:ProjectMember rdf:type :UserGroup ; - :groupName "ProjectMember" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectAdmin -:ProjectAdmin rdf:type :UserGroup ; - :groupName "ProjectAdmin" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemAdmin -:SystemAdmin rdf:type :UserGroup ; - :groupName "SystemAdmin" ; - :belongsToProject :SystemProject ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemUser -:SystemUser rdf:type :User ; - rdfs:comment "A built-in system user."@en ; - :username "system"; - :email "system@localhost" ; - :givenName "Knora" ; - :familyName "System" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#AnonymousUser -:AnonymousUser rdf:type :User ; - rdfs:comment "A built-in anonymous user."@en ; - :username "anonymous" ; - :email "anonymous@localhost" ; - :givenName "Knora" ; - :familyName "Anonymous" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemProject -:SystemProject rdf:type :knoraProject ; - rdfs:comment "A built-in project representing the Knora System."@en ; - :projectShortname "SystemProject" ; - :projectShortcode "FFFF" ; - :projectLongname "Knora System Project" ; - :projectDescription "Knora System Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - - -### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject -:DefaultSharedOntologiesProject rdf:type :knoraProject ; - rdfs:comment "The default project for shared ontologies."@en ; - :projectShortname "DefaultSharedOntologiesProject" ; - :projectShortcode "0000" ; - :projectLongname "Knora Default Shared Ontologies Project" ; - :projectDescription "Knora Shared Ontologies Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -# -## -### Permission Class Properties -## -# -### http://www.knora.org/ontology/knora-admin#forProject - -:forProject rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a knoraProject."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :knoraProject . - -### http://www.knora.org/ontology/knora-admin#forGroup -:forGroup rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a UserGroup."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :UserGroup . - -### http://www.knora.org/ontology/knora-admin#forResourceClass -:forResourceClass rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource class."@en ; - knora-base:subjectClassConstraint :Permission . - -### http://www.knora.org/ontology/knora-admin#forProperty -:forProperty rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource property."@en ; - knora-base:subjectClassConstraint :Permission . - - -# -## -### Permission Class and Sub-Classes -## -# -### http://www.knora.org/ontology/knora-admin#Permission -:Permission rdf:type owl:Class ; - rdfs:comment "Base Permission class."@en. - - -### http://www.knora.org/ontology/knora-admin#AdministrativePermission -:AdministrativePermission rdf:type owl:Class ; - rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; - rdfs:subClassOf :Permission . - -### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission -:DefaultObjectAccessPermission rdf:type owl:Class ; - rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; - rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1322/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1322/knora-ontologies/knora-base.ttl deleted file mode 100644 index 8c2054e7a7..0000000000 --- a/upgrade/plugins/pr1322/knora-ontologies/knora-base.ttl +++ /dev/null @@ -1,2709 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@prefix salsah-gui: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora base ontology"@en ; - - :attachedToProject knora-admin:SystemProject ; - - :ontologyVersion "PR 1322" . - - - -################################################################# -# -# Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-base#ontologyVersion - -:ontologyVersion rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; - - :subjectClassConstraint owl:Ontology ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isMainResource - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:isMainResource rdf:type owl:DatatypeProperty ; - - rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted - -:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; - - rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . - - - -### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint - -:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; - - rdfs:comment "Specifies the type required as the object of a datatype property"@en . - - - -### http://www.knora.org/ontology/knora-base#resourceIcon - -:resourceIcon rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#resourceProperty - -:resourceProperty rdf:type owl:ObjectProperty ; - - rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#subjectClassConstraint - -:subjectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#objectClassConstraint - -:objectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#isEditable - -:isEditable rdf:type owl:AnnotationProperty ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "is editable"@en ; - - rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#canBeInstantiated - -:canBeInstantiated rdf:type owl:AnnotationProperty ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "can be instantiated"@en ; - - rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#attachedToProject - -:attachedToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to project"@en ; - - rdfs:comment "Connects something to a project"@en ; - - :objectClassConstraint knora-admin:knoraProject . - - - -### http://www.knora.org/ontology/knora-base#attachedToUser - -:attachedToUser rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to user"@en ; - - rdfs:comment "Connects something to a user"@en ; - - :objectClassConstraint knora-admin:User . - - -### http://www.knora.org/ontology/knora-base#hasColor - -:hasColor rdf:type owl:ObjectProperty ; - - rdfs:label "Farbe"@de , - "Color"@en , - "Couleur"@fr , - "Colore"@it ; - - rdfs:comment """Specifies the color of a region."""@en ; - - salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; - - :objectClassConstraint :ColorValue ; - - :subjectClassConstraint :Region ; - - rdfs:subPropertyOf :hasValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Colorpicker . - - - -### http://www.knora.org/ontology/knora-base#hasComment - -:hasComment rdf:type owl:ObjectProperty ; - - rdfs:label "Kommentar"@de , - "Comment"@en , - "Commentaire"@fr , - "Commento"@it ; - - rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :TextValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Richtext ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasExtResValue - -:hasExtResValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat externen Wert"@de , - "has external Value"@en , - "a valeur externe"@fr , - "ha valore esterno"@it ; - - :objectClassConstraint :ExternalResValue ; - - :subjectClassConstraint :ExternalResource ; - - rdfs:subPropertyOf :hasValue . - - -### http://www.knora.org/ontology/knora-base#hasFileValue - -:hasFileValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :FileValue ; - - rdfs:label "hat Datei"@de , - "has file"@en , - "a fichier"@fr , - "ha file"@it ; - - rdfs:comment "Connects a Representation to a file"@en ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - :subjectClassConstraint :Representation ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasStillImageFileValue - -:hasStillImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Bilddatei"@de , - "has image file"@en , - "a fichier d'image"@fr , - "ha file imagine"@it ; - - rdfs:comment "Connects a Representation to an image file"@en ; - - :objectClassConstraint :StillImageFileValue ; - - :subjectClassConstraint :StillImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue - -:hasMovingImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Filmdatei"@de , - "has movie file"@en , - "a fichier de film"@fr , - "ha file film"@it ; - - rdfs:comment "Connects a Representation to a movie file"@en ; - - :objectClassConstraint :MovingImageFileValue ; - - :subjectClassConstraint :MovingImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasAudioFileValue - -:hasAudioFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Audiodatei"@de , - "has audio file"@en , - "a fichier d'audio"@fr , - "ha file audio"@it ; - - rdfs:comment "Connects a Representation to an audio file"@en ; - - :objectClassConstraint :AudioFileValue ; - - :subjectClassConstraint :AudioRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDDDFileValue - -:hasDDDFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat 3D-Datei"@de , - "has 3D-file"@en , - "a ficher de 3D"@fr , - "ha file 3D"@it ; - - rdfs:comment "Connects a Representation to a 3D-file"@en ; - - :objectClassConstraint :DDDFileValue ; - - :subjectClassConstraint :DDDRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasTextFileValue - -:hasTextFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Textdatei"@de , - "has text file"@en , - "a fichier de texte"@fr , - "ha file testo"@it ; - - rdfs:comment "Connects a Representation to a text file"@en ; - - :objectClassConstraint :TextFileValue ; - - :subjectClassConstraint :TextRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDocumentFileValue - -:hasDocumentFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Dokument"@de , - "has document"@en , - "a document"@fr , - "ha documento"@it ; - - rdfs:comment "Connects a Representation to a document"@en ; - - :objectClassConstraint :DocumentFileValue ; - - :subjectClassConstraint :DocumentRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasGeometry - -:hasGeometry rdf:type owl:ObjectProperty ; - - rdfs:label "Geometrie"@de , - "Geometry"@en , - "Géometrie"@fr , - "Geometria"@it ; - - rdfs:comment """Represents a geometrical shape."""@en ; - - rdfs:subPropertyOf :hasValue ; - - salsah-gui:guiElement salsah-gui:Geometry ; - - :isEditable true ; - - :objectClassConstraint :GeomValue ; - - :subjectClassConstraint :Region . - - - -### http://www.knora.org/ontology/knora-base#hasLinkTo - -:hasLinkTo rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#hasLinkToValue - -:hasLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentation - -:hasRepresentation rdf:type owl:ObjectProperty ; - - rdfs:label "hat Repräsentation"@de , - "has Representation"@en , - "a Répresentation"@fr , - "ha Rappresentazione"@it ; - - rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; - - :objectClassConstraint :Representation ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentationValue - -:hasRepresentationValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo - -:hasStandoffLinkTo rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue - -:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasLink - -:standoffTagHasLink rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :StandoffLinkTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference - -:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :StandoffInternalReferenceTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStart - -:standoffTagHasStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEnd - -:standoffTagHasEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex - -:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex - -:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor - -:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent - -:standoffTagHasStartParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent - -:standoffTagHasEndParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasUUID - -:standoffTagHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:string . - - -:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#hasSubListNode - -:hasSubListNode rdf:type owl:ObjectProperty ; - - rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :ListNode ; - - :subjectClassConstraint :ListNode . - - -### http://www.knora.org/ontology/knora-base#hasValue - -:hasValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Value . - - -### http://www.knora.org/ontology/knora-base#isAnnotationOf - -:isAnnotationOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Annotation von"@de , - "is Annotation of"@en , - "est Annotation de"@fr , - "è Annotation di"@it ; - - :subjectClassConstraint :Annotation ; - - :objectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isAnnotationOfValue - -:isAnnotationOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Annotation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isPartOf - -:isPartOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Teil von"@de , - "is part of"@en , - "fait partie de"@fr , - "fa parte di"@it ; - - rdfs:comment "Indicates that this resource is part of another resource"@en ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isPartOfValue - -:isPartOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isRegionOf - -:isRegionOf rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :subjectClassConstraint :Region ; - - :objectClassConstraint :Representation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isRegionOfValue - -:isRegionOfValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Region ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#previousValue - -:previousValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "Points to the previous verson of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectClassConstraint :Value . - - - -### http://www.knora.org/ontology/knora-base#seqnum - -:seqnum rdf:type owl:ObjectProperty ; - - :objectClassConstraint :IntValue ; - - rdfs:subPropertyOf :hasValue ; - - rdfs:label "Sequenznummer"@de , - "Sequence number"@en , - "Numéro de séquence"@fr , - "Numero di sequenza"@it ; - - rdfs:comment "Indicates the position of a resource within a sequence"@en . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID - -:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - - -### http://www.knora.org/ontology/knora-base#valueHasStandoff - -:valueHasStandoff rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasLanguage - -:valueHasLanguage rdf:type owl:DatatypeProperty ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasMapping - -:valueHasMapping rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :XMLToStandoffMapping ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#hasMappingElement - -:hasMappingElement rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "mapping element"@en ; - - rdfs:comment """Represents an element in a mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :MappingElement . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname - -:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML tag"@en ; - - rdfs:comment """name of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace - -:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "namespace of the XML tag"@en ; - - rdfs:comment """namespace of the XML tag"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLClass - -:mappingHasXMLClass rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "class of the XML tag"@en ; - - rdfs:comment """class of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass - -:mappingHasStandoffClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff class"@en ; - - rdfs:comment """IRI of the standoff class"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectClassConstraint owl:Class . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute - -:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename - -:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty - -:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff property"@en ; - - rdfs:comment """IRI of the standoff property"""@en ; - - :subjectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass - -:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "datatype of the XML tag"@en ; - - rdfs:comment """datatype of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingStandoffDataTypeClass . - - -### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator - -:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "indicates if the element requires a separator in the text"@en ; - - rdfs:comment """indicates if the element requires a separator in the text"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation - -:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "default XSL Transformation"@en ; - - rdfs:comment """default XSL Transformation for this mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :XSLTransformation . - - -### http://www.knora.org/ontology/knora-base#deletedBy - -:deletedBy rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates who deleted a resource or value"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectClassConstraint knora-admin:User . - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#creationDate - -:creationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource was created"@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#deleteDate - -:deleteDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource or value was deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:dateTime . - - -### http://www.knora.org/ontology/knora-base#dimX - -:dimX rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#dimY - -:dimY rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#duration - -:duration rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#extResAccessInfo - -:extResAccessInfo rdf:type owl:DatatypeProperty ; - - rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResId - -:extResId rdf:type owl:DatatypeProperty ; - - rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResProvider - -:extResProvider rdf:type owl:DatatypeProperty ; - - rdfs:comment "The name of the external provider of the resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - - -### http://www.knora.org/ontology/knora-base#fps - -:fps rdf:type owl:DatatypeProperty ; - - rdfs:label "Frames per second"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :MovingImageFileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#internalFilename - -:internalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#internalMimeType - -:internalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isDeleted - -:isDeleted rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the resource has been deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#isRootNode - -:isRootNode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#hasRootNode - -:hasRootNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint :ListNode . - - - - -### http://www.knora.org/ontology/knora-base#lastModificationDate - -:lastModificationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#listNodePosition - -:listNodePosition rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#listNodeName - -:listNodeName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalFilename - -:originalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalMimeType - -:originalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasComment - -:valueHasComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment on a value"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#deleteComment - -:deleteComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueCreationDate - -:valueCreationDate rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :Value ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#valueHas - -:valueHas rdf:type rdf:Property ; - - :subjectClassConstraint :ValueBase ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . - - - -### http://www.knora.org/ontology/knora-base#valueHasUUID - -:valueHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "The UUID of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasCalendar - -:valueHasCalendar rdf:type owl:DatatypeProperty ; - - rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasColor - -:valueHasColor rdf:type owl:DatatypeProperty ; - - rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ColorBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndJDN - -:valueHasEndJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndPrecision - -:valueHasEndPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasDecimal - -:valueHasDecimal rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DecimalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeometry - -:valueHasGeometry rdf:type owl:DatatypeProperty ; - - rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeomValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeonameCode - -:valueHasGeonameCode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeonameValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasInteger - -:valueHasInteger rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasBoolean - -:valueHasBoolean rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :BooleanBase ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#valueHasUri - -:valueHasUri rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :UriBase ; - - :objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd - -:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart - -:valueHasIntervalStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasListNode - -:valueHasListNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ListValue ; - - :objectClassConstraint :ListNode . - - - -### http://www.knora.org/ontology/knora-base#valueHasOrder - -:valueHasOrder rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#valueHasRefCount - -:valueHasRefCount rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :LinkValue ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartJDN - -:valueHasStartJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartPrecision - -:valueHasStartPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasString - -:valueHasString rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#hasPermissions - -:hasPermissions rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string . - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#Annotation - -:Annotation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOf ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOfValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Annotation"@de , - "Annotation"@en , - "Annotation"@fr , - "Annotation"@it ; - - :canBeInstantiated true ; - - rdfs:comment "A generic class for representing annotations"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioFileValue - -:AudioFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an audio file"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioRepresentation - -:AudioRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasAudioFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Audio)"@de , - "Representation (Audio)"@en , - "Répresentation (Audio)"@fr , - "Rappresentazione (Audio)"@it ; - - rdfs:comment "Represents a file containing audio data"@en . - - -### http://www.knora.org/ontology/knora-base#ColorBase - -:ColorBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#ColorValue - -:ColorValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :ColorBase ; - - rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . - - - -### http://www.knora.org/ontology/knora-base#DDDFileValue - -:DDDFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#DDDRepresentation - -:DDDRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDDDFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (3D)"@de , - "Representation (3D)"@en , - "Répresentation (3D)"@fr , - "Rappresentazione (3D)"@it ; - - rdfs:comment "Represents a file containg 3D data"@en . - - -### http://www.knora.org/ontology/knora-base#DateBase - -:DateBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasCalendar ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DateValue - -:DateValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DateBase ; - - rdfs:comment "Represents a Knora date value"@en . - - - -### http://www.knora.org/ontology/knora-base#DocumentFileValue - -:DocumentFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue . - - - -### http://www.knora.org/ontology/knora-base#DocumentRepresentation - -:DocumentRepresentation rdf:type owl:Class ; - - rdfs:label "Repräsentation (Dokument)"@de , - "Representation (Document)"@en , - "Répresentation (Document)"@fr , - "Rappresentazione (Documento)"@it ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDocumentFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResValue - -:ExternalResValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :extResId ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResProvider ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResAccessInfo ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResource - -:ExternalResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasExtResValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Externe Ressource"@de , - "External Resource"@en , - "Ressource Externe"@fr , - "Risorsa esterna"@it ; - - rdfs:comment "Represents a proxy for an object stored by an external provider"@en . - - - -### http://www.knora.org/ontology/knora-base#FileValue - -:FileValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :originalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :originalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DecimalBase - -:DecimalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasDecimal ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#DecimalValue - -:DecimalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DecimalBase ; - - rdfs:comment "Represents an arbitrary-precision decimal value"@en . - - - -### http://www.knora.org/ontology/knora-base#GeomValue - -:GeomValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeometry ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a geometrical objects as JSON string"@en . - - - -### http://www.knora.org/ontology/knora-base#GeonameValue - -:GeonameValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeonameCode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntBase - -:IntBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasInteger ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntValue - -:IntValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :IntBase ; - - rdfs:comment "Represents an integer value"@en . - -### http://www.knora.org/ontology/knora-base#BooleanBase - -:BooleanBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasBoolean ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#BooleanValue - -:BooleanValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :BooleanBase ; - - rdfs:comment "Represents a boolean value"@en . - - - -### http://www.knora.org/ontology/knora-base#UriBase - -:UriBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUri ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - -### http://www.knora.org/ontology/knora-base#UriValue - -:UriValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :UriBase ; - - rdfs:comment "Represents a URI"@en . - -### http://www.knora.org/ontology/knora-base#IntervalBase - -:IntervalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#IntervalValue - -:IntervalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :IntervalBase ; - - rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkObj - -:LinkObj rdf:type owl:Class ; - - rdfs:label "Verknüpfungsobjekt"@de , - "Link Object"@en , - "Objet de lien"@fr , - "Oggetto di connessione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkTo ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkToValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "link.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Verknüpfung mehrerer Resourcen"@de , - "Represents a generic link object"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkValue - -:LinkValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - rdf:Statement , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasRefCount ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:subject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:predicate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:object ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A reification node that describes direct links between resources"@en . - - - -### http://www.knora.org/ontology/knora-base#ListNode - -:ListNode rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :hasSubListNode ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodePosition ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodeName ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "Represents a flat or hierarchical list"@en . - - - -### http://www.knora.org/ontology/knora-base#ListValue - -:ListValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasListNode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#MovingImageFileValue - -:MovingImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :fps ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a moving image file"@en . - - - -### http://www.knora.org/ontology/knora-base#MovingImageRepresentation - -:MovingImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasMovingImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Video)"@de , - "Representation (Movie)"@en , - "Répresentation (Film)"@fr , - "Rappresentazione (Film)"@it ; - - rdfs:comment "A resource containing moving image data"@en . - - - -### http://www.knora.org/ontology/knora-base#Region - -:Region rdf:type owl:Class ; - - rdfs:label "Region"@de , - "Region"@en , - "Région"@fr , - "Regione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOf ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasGeometry ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOfValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "region.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . - - - -### http://www.knora.org/ontology/knora-base#Representation - -:Representation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation"@de , - "Representation"@en , - "Répresentation"@fr , - "Rappresentazione"@it ; - - rdfs:comment "A resource that can store a file"@en . - - - -### http://www.knora.org/ontology/knora-base#Resource - -:Resource rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkTo ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkToValue ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :creationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :lastModificationDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Ressource"@de , - "Resource"@en , - "Ressource"@fr , - "Risorsa"@it ; - - rdfs:comment "Represents something in the world, or an abstract thing"@en . - - -################################################################# -# -# Generic Standoff Tag -# -################################################################# - - -:standoffParentClassConstraint rdf:type owl:ObjectProperty . - - -### http://www.knora.org/ontology/knora-base#StandoffTag - -:StandoffTag rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasUUID ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasOriginalXMLID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartIndex ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffParentClassConstraint; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a standoff markup tag"@en . - - - -################################################################# -# -# Abstract Standoff Data Type Tag -# -################################################################# - -### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag - -:StandoffDataTypeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag ; - - rdfs:comment "Represents a knora-base value type in a TextValue"@en . - - -################################################################# -# -# Standoff Data Type Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#StandoffLinkTag - -:StandoffLinkTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasLink ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffUriTag - -:StandoffUriTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag , - :UriBase ; - - rdfs:comment "Represents an arbitrary URI in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDateTag - -:StandoffDateTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DateBase ; - - rdfs:comment "Represents a date in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffColorTag - -:StandoffColorTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ColorBase ; - - rdfs:comment "Represents a color in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntegerTag - -:StandoffIntegerTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntBase ; - - rdfs:comment "Represents an integer value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDecimalTag - -:StandoffDecimalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DecimalBase ; - - rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntervalTag - -:StandoffIntervalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntervalBase ; - - rdfs:comment "Represents an interval in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffBooleanTag - -:StandoffBooleanTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :BooleanBase ; - - rdfs:comment "Represents a boolean in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag - -:StandoffInternalReferenceTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasInternalReference ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an internal reference in a TextValue"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageFileValue - -:StillImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A file containing a two-dimensional still image"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageRepresentation - -:StillImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStillImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Bild)"@de , - "Representation (Image)"@en , - "Répresentation (Image)"@fr , - "Rappresentazione (Imagine)"@it ; - - rdfs:comment "A resource that can contain a two-dimensional still image file"@en . - - - -### http://www.knora.org/ontology/knora-base#TextFileValue - -:TextFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#TextRepresentation - -:TextRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Text)"@de , - "Representation (Text)"@en , - "Répresentation (Texte)"@fr , - "Rappresentazione (testo)"@it ; - - rdfs:comment "A resource containing a text file"@en . - - -### http://www.knora.org/ontology/knora-base#ForbiddenResource - -:ForbiddenResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ]; - - rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; - - rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . - -### http://www.knora.org/ontology/knora-base#XSLTransformation - -:XSLTransformation rdf:type owl:Class ; - - rdfs:subClassOf :TextRepresentation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; - - rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . - - -### http://www.knora.org/ontology/knora-base#MappingComponent - -:MappingComponent rdf:type owl:Class ; - - rdfs:label "Component of a mapping"@en ; - - rdfs:comment "Component of a mapping" . - - -### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass - -:MappingStandoffDataTypeClass rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingXMLAttribute - -:MappingXMLAttribute rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffProperty ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingElement - -:MappingElement rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLTagname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttribute ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffDataTypeClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingElementRequiresSeparator ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping - -:XMLToStandoffMapping rdf:type owl:Class ; - - rdfs:subClassOf - [ rdf:type owl:Restriction ; - owl:onProperty :hasMappingElement ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasDefaultXSLTransformation ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#TextValue - -:TextValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStandoff ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMaxStandoffStartIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasLanguage ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMapping ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ValueBase - -:ValueBase rdf:type owl:Class . - - -### http://www.knora.org/ontology/knora-base#Value - -:Value rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :valueCreationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasOrder ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :previousValue ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasString ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUUID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - - rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1322/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1322/knora-ontologies/salsah-gui.ttl deleted file mode 100644 index 6c183c0f51..0000000000 --- a/upgrade/plugins/pr1322/knora-ontologies/salsah-gui.ttl +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@prefix knora-base: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The salsah-gui ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Properties -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#guiOrder - -:guiOrder rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint owl:Restriction ; - - knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . - - - -### http://www.knora.org/ontology/salsah-gui#guiElement - -:guiElement rdf:type owl:ObjectProperty . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttribute - -:guiAttribute rdf:type owl:DatatypeProperty ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition - -:guiAttributeDefinition rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint :Guielement ; - - knora-base:objectDatatypeConstraint xsd:string . - - - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Guielement - -:Guielement rdf:type owl:Class . - - - - - -################################################################# -# -# Individuals -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Colorpicker - -:Colorpicker rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "ncolors:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Date - -:Date rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geometry - -:Geometry rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geonames - -:Geonames rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Iconclass - -# :Iconclass rdf:type :Guielement , -# owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Interval - -:Interval rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#List - -:List rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Pulldown - -:Pulldown rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Radio - -:Radio rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Richtext - -:Richtext rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Searchbox - -:Searchbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "numprops:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#SimpleText - -:SimpleText rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "size:integer" , - "maxlength:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Slider - -:Slider rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max(required):decimal" , - "min(required):decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Spinbox - -:Spinbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max:decimal" , - "min:decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Textarea - -:Textarea rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "cols:integer" , - "rows:integer" , - "width:percent" , - "wrap:string(soft|hard)" . - - -### http://www.knora.org/ontology/salsah-gui#Checkbox - -:Checkbox rdf:type :Guielement , - owl:NamedIndividual . - - -### http://www.knora.org/ontology/salsah-gui#Fileupload - -:Fileupload rdf:type :Guielement , - owl:NamedIndividual . diff --git a/upgrade/plugins/pr1322/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1322/knora-ontologies/standoff-onto.ttl deleted file mode 100644 index f5113c5028..0000000000 --- a/upgrade/plugins/pr1322/knora-ontologies/standoff-onto.ttl +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix salsah-gui: . -@base . - -@prefix : . - - rdf:type owl:Ontology ; - - rdfs:label "The standoff ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Standoff Properties -# -################################################################# - -### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType - -:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the document type"@en ; - - knora-base:subjectClassConstraint :StandoffRootTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget - -:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the target settings of a hyperlink"@en ; - - knora-base:subjectClassConstraint :StandoffHyperlinkTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -################################################################# -# -# Intermediate Standoff Tags -# -################################################################# - -### http://www.knora.org/ontology/standoff#StandoffVisualTag - -:StandoffVisualTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents visual markup information in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStructuralTag - -:StandoffStructuralTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents structural markup information in a TextValue"@en . - - -################################################################# -# -# Standoff Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/standoff#StandoffRootTag - -:StandoffRootTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffRootTagHasDocumentType ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . - -### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag - -:StandoffHyperlinkTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffUriTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffHyperlinkTagHasTarget ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a hyperlink in a text"@en . - -### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag - -:StandoffBlockquoteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section that is quoted from another source in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffCodeTag - -:StandoffCodeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section of computer source code in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffParagraphTag - -:StandoffParagraphTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a paragraph in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader1Tag - -:StandoffHeader1Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 1 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader2Tag - -:StandoffHeader2Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 2 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader3Tag - -:StandoffHeader3Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 3 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader4Tag - -:StandoffHeader4Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 4 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader5Tag - -:StandoffHeader5Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 5 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader6Tag - -:StandoffHeader6Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 6 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffOrderedListTag - -:StandoffOrderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an ordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag - -:StandoffUnorderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an unordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffListElementTag - -:StandoffListElementTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a list element in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableBodyTag - -:StandoffTableBodyTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table body in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableTag - -:StandoffTableTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableRowTag - -:StandoffTableRowTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a row in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableCellTag - -:StandoffTableCellTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a cell in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBrTag - -:StandoffBrTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a linebreak"@en . - - - -### http://www.knora.org/ontology/standoff#StandoffItalicTag - -:StandoffItalicTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents italics in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBoldTag - -:StandoffBoldTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents bold text in a TextValue"@en . - -### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag - -:StandoffCiteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents the title of a work in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnderlineTag - -:StandoffUnderlineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents underlined text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag - -:StandoffStrikethroughTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents struck text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag - -:StandoffSuperscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents superscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSubscriptTag - -:StandoffSubscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents subscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag - -:StandoffLineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a line to seperate content in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag - -:StandoffPreTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1322/test_1322.py b/upgrade/plugins/pr1322/test_1322.py deleted file mode 100644 index 55b3f172ee..0000000000 --- a/upgrade/plugins/pr1322/test_1322.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import tempfile -import rdflib -from rdflib.term import URIRef -from plugins.pr1322.update import GraphTransformer - - -save_output = False - - -def test_update(): - input_graph = rdflib.Graph() - input_graph.parse("plugins/pr1322/test_data.ttl", format="turtle") - transformer = GraphTransformer() - output_graph = transformer.transform(input_graph) - - query_result = output_graph.query( - """ - PREFIX knora-base: - - SELECT ?value WHERE { - ?value knora-base:valueHasUUID ?valueHasUUID . - } - """ - ) - - values_with_uuids = set([row["value"] for row in query_result]) - - assert values_with_uuids == { - URIRef("http://rdfh.ch/0001/thing-with-history/values/1c"), - URIRef("http://rdfh.ch/0001/thing-with-history/values/2c") - } - - if save_output: - temp_dir = tempfile.mkdtemp() - output_file_path = temp_dir + "/output.ttl" - output_graph.serialize(destination=output_file_path, format="turtle") - print("Wrote output to", output_file_path) diff --git a/upgrade/plugins/pr1322/test_data.ttl b/upgrade/plugins/pr1322/test_data.ttl deleted file mode 100644 index 1d5d09b513..0000000000 --- a/upgrade/plugins/pr1322/test_data.ttl +++ /dev/null @@ -1,73 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix anything: . - - a anything:Thing; - knora-base:isDeleted false; - knora-base:attachedToUser ; - knora-base:attachedToProject ; - rdfs:label "A thing with version history"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; - knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; - anything:hasInteger ; - anything:hasText . - - a knora-base:IntValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 1; - knora-base:valueHasOrder 0; - knora-base:valueHasString "1"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser . - - a knora-base:IntValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 2; - knora-base:valueHasOrder 0; - knora-base:valueHasString "2"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:IntValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 3; - knora-base:valueHasOrder 0; - knora-base:valueHasString "3"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "one"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "two"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "three"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . diff --git a/upgrade/plugins/pr1322/update.py b/upgrade/plugins/pr1322/update.py deleted file mode 100644 index 16e6d87938..0000000000 --- a/upgrade/plugins/pr1322/update.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import uuid -import base64 -import rdflib -from rdflib.namespace import XSD -from updatelib import rdftools - - -# The IRI of knora-base:TextValue. -text_value_type = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#TextValue") - -# The IRI of knora-base:valueHasUUID. -value_has_uuid = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#valueHasUUID") - -# The IRI of knora-base:valueCreationDate. -value_creation_date = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#valueCreationDate") - -# The IRI of knora-base:previousValue. -previous_value = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#previousValue") - - -# Updates values for PR 1322. -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - # Check whether the transformation has already been done. - statements_with_value_has_uuid = graph.subject_objects(value_has_uuid) - - if not rdftools.generator_is_empty(statements_with_value_has_uuid): - print("This transformation seems to have been done already.") - return graph - - # Group the statements in the named graph by subject and by predicate. - grouped_statements = rdftools.group_statements(graph) - - # Collect the IRIs of values to be transformed. - value_iris = collect_value_iris(graph, grouped_statements) - - for value_iri in value_iris: - random_uuid_str = make_random_uuid_str() - graph.add((value_iri, value_has_uuid, rdflib.Literal(str(random_uuid_str), datatype=XSD.string))) - - return graph - - -# Given a graph, collects the IRIs of all values that are current value versions. -def collect_value_iris(graph, grouped_statements): - value_iris = set() - - for subj, pred_objs in grouped_statements.items(): - if value_creation_date in pred_objs: - # This is a value. Is it a current value version? - if rdftools.generator_is_empty(graph.subjects(previous_value, subj)): - # Yes. Include its IRI. - value_iris.add(subj) - - return value_iris - - -# Returns a random, Base64-encoded, URL-safe UUID. -def make_random_uuid_str(): - random_uuid = uuid.uuid4() - return base64.urlsafe_b64encode(random_uuid.bytes).decode("ascii").strip("=") - diff --git a/upgrade/plugins/pr1367/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1367/knora-ontologies/knora-admin.ttl deleted file mode 100644 index c731a6f7e4..0000000000 --- a/upgrade/plugins/pr1367/knora-ontologies/knora-admin.ttl +++ /dev/null @@ -1,777 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix knora-base: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora admin ontology"@en ; - - knora-base:attachedToProject :SystemProject . - - -################################################################# -# -# Object Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#belongsToInstitution - -:belongsToInstitution rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which Institution a project belongs to."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectClassConstraint :Institution . - - - -### http://www.knora.org/ontology/knora-admin#belongsToProject - -:belongsToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which project a group belongs to."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#currentproject - -:currentproject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isInGroup - -:isInGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :UserGroup . - - - -### http://www.knora.org/ontology/knora-admin#isInProject - -:isInProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isAdminForProject - -:isInProjectAdminGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project's ProjectAdmin group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-admin#address - -:address rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:comment "The address of a person or an institution"@en . - - -### http://www.knora.org/ontology/knora-admin#groupName - -:groupName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The group's name."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:subPropertyOf . - - - -### http://www.knora.org/ontology/knora-admin#groupDescription - -:groupDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a user group"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled - -:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if users can add themselves to the project or group."@en ; - - # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#institutionName - -:institutionName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The institutions's name."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionDescription - -:institutionDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of an institution."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionWebsite - -:institutionWebsite rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The URL of a web site."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-admin#isActiveUser - -:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#givenName - -:givenName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's given name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#familyName - -:familyName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's family name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#password - -:password rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "An encrypted credential for access"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#phone - -:phone rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The phone number of a person, institution, etc."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#preferredLanguage - -:preferredLanguage rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The ISO 639-1 code of the user's preferred language."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectDescription - -:projectDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a Knora project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectKeyword - -:projectKeyword rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A keyword describing a project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLongname - -:projectLongname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The longname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLogo - -:projectLogo rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the projects's logo."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize - -:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark - -:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the restricted view watermark."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectShortname - -:projectShortname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique shortname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectShortcode - -:projectShortcode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique short code of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#username - -:username rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The username and login name of a user."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#email - -:email rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The email address and login name of a user."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#status - -:status rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)."@en ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -################################################################# -# -# Classes -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#Institution - -:Institution rdf:type owl:Class ; - - rdfs:subClassOf foaf:Organization , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionWebsite ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :phone ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "An institution that has data in Knora."@en . - - - -### http://www.knora.org/ontology/knora-admin#User - -:User rdf:type owl:Class ; - - rdfs:subClassOf foaf:Person , - [ rdf:type owl:Restriction ; - owl:onProperty :username ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :familyName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :givenName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :password ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :preferredLanguage ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInProject ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInGroup ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInSystemAdminGroup ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a Knora user."@en . - - - -### http://www.knora.org/ontology/knora-admin#UserGroup - -:UserGroup rdf:type owl:Class ; - - rdfs:subClassOf foaf:Group , - [ rdf:type owl:Restriction ; - owl:onProperty :groupName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :groupDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "A group of Knora users."@en . - - - - -### http://www.knora.org/ontology/knora-admin#knoraProject - -:knoraProject rdf:type owl:Class ; - - rdfs:subClassOf foaf:Project , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortcode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLongname ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectDescription ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectKeyword ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLogo ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewSize ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewWatermark ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToInstitution ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a project that uses Knora."@en . - - - - -################################################################# -# -# Individuals -# -################################################################# - -### http://www.knora.org/ontology/knora-admin#UnknownUser -:UnknownUser rdf:type :UserGroup ; - :groupName "UnknownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#KnownUser -:KnownUser rdf:type :UserGroup ; - :groupName "KnownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#Creator -:Creator rdf:type :UserGroup ; - :groupName "Creator" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectMember -:ProjectMember rdf:type :UserGroup ; - :groupName "ProjectMember" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectAdmin -:ProjectAdmin rdf:type :UserGroup ; - :groupName "ProjectAdmin" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemAdmin -:SystemAdmin rdf:type :UserGroup ; - :groupName "SystemAdmin" ; - :belongsToProject :SystemProject ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemUser -:SystemUser rdf:type :User ; - rdfs:comment "A built-in system user."@en ; - :username "system"; - :email "system@localhost" ; - :givenName "Knora" ; - :familyName "System" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#AnonymousUser -:AnonymousUser rdf:type :User ; - rdfs:comment "A built-in anonymous user."@en ; - :username "anonymous" ; - :email "anonymous@localhost" ; - :givenName "Knora" ; - :familyName "Anonymous" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemProject -:SystemProject rdf:type :knoraProject ; - rdfs:comment "A built-in project representing the Knora System."@en ; - :projectShortname "SystemProject" ; - :projectShortcode "FFFF" ; - :projectLongname "Knora System Project" ; - :projectDescription "Knora System Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - - -### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject -:DefaultSharedOntologiesProject rdf:type :knoraProject ; - rdfs:comment "The default project for shared ontologies."@en ; - :projectShortname "DefaultSharedOntologiesProject" ; - :projectShortcode "0000" ; - :projectLongname "Knora Default Shared Ontologies Project" ; - :projectDescription "Knora Shared Ontologies Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -# -## -### Permission Class Properties -## -# -### http://www.knora.org/ontology/knora-admin#forProject - -:forProject rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a knoraProject."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :knoraProject . - -### http://www.knora.org/ontology/knora-admin#forGroup -:forGroup rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a UserGroup."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :UserGroup . - -### http://www.knora.org/ontology/knora-admin#forResourceClass -:forResourceClass rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource class."@en ; - knora-base:subjectClassConstraint :Permission . - -### http://www.knora.org/ontology/knora-admin#forProperty -:forProperty rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource property."@en ; - knora-base:subjectClassConstraint :Permission . - - -# -## -### Permission Class and Sub-Classes -## -# -### http://www.knora.org/ontology/knora-admin#Permission -:Permission rdf:type owl:Class ; - rdfs:comment "Base Permission class."@en. - - -### http://www.knora.org/ontology/knora-admin#AdministrativePermission -:AdministrativePermission rdf:type owl:Class ; - rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; - rdfs:subClassOf :Permission . - -### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission -:DefaultObjectAccessPermission rdf:type owl:Class ; - rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; - rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1367/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1367/knora-ontologies/knora-base.ttl deleted file mode 100644 index 00e108f7b6..0000000000 --- a/upgrade/plugins/pr1367/knora-ontologies/knora-base.ttl +++ /dev/null @@ -1,2710 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@prefix salsah-gui: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora base ontology"@en ; - - :attachedToProject knora-admin:SystemProject ; - - :ontologyVersion "PR 1367" . - - - -################################################################# -# -# Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-base#ontologyVersion - -:ontologyVersion rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; - - :subjectClassConstraint owl:Ontology ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isMainResource - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:isMainResource rdf:type owl:DatatypeProperty ; - - rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted - -:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; - - rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . - - - -### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint - -:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; - - rdfs:comment "Specifies the type required as the object of a datatype property"@en . - - - -### http://www.knora.org/ontology/knora-base#resourceIcon - -:resourceIcon rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#resourceProperty - -:resourceProperty rdf:type owl:ObjectProperty ; - - rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#subjectClassConstraint - -:subjectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#objectClassConstraint - -:objectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#isEditable - -:isEditable rdf:type owl:AnnotationProperty ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "is editable"@en ; - - rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#canBeInstantiated - -:canBeInstantiated rdf:type owl:AnnotationProperty ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "can be instantiated"@en ; - - rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#attachedToProject - -:attachedToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to project"@en ; - - rdfs:comment "Connects something to a project"@en ; - - :objectClassConstraint knora-admin:knoraProject . - - - -### http://www.knora.org/ontology/knora-base#attachedToUser - -:attachedToUser rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to user"@en ; - - rdfs:comment "Connects something to a user"@en ; - - :objectClassConstraint knora-admin:User . - - -### http://www.knora.org/ontology/knora-base#hasColor - -:hasColor rdf:type owl:ObjectProperty ; - - rdfs:label "Farbe"@de , - "Color"@en , - "Couleur"@fr , - "Colore"@it ; - - rdfs:comment """Specifies the color of a region."""@en ; - - salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; - - :objectClassConstraint :ColorValue ; - - :subjectClassConstraint :Region ; - - rdfs:subPropertyOf :hasValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Colorpicker . - - - -### http://www.knora.org/ontology/knora-base#hasComment - -:hasComment rdf:type owl:ObjectProperty ; - - rdfs:label "Kommentar"@de , - "Comment"@en , - "Commentaire"@fr , - "Commento"@it ; - - rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :TextValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Richtext ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasExtResValue - -:hasExtResValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat externen Wert"@de , - "has external Value"@en , - "a valeur externe"@fr , - "ha valore esterno"@it ; - - :objectClassConstraint :ExternalResValue ; - - :subjectClassConstraint :ExternalResource ; - - rdfs:subPropertyOf :hasValue . - - -### http://www.knora.org/ontology/knora-base#hasFileValue - -:hasFileValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :FileValue ; - - rdfs:label "hat Datei"@de , - "has file"@en , - "a fichier"@fr , - "ha file"@it ; - - rdfs:comment "Connects a Representation to a file"@en ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - :subjectClassConstraint :Representation ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasStillImageFileValue - -:hasStillImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Bilddatei"@de , - "has image file"@en , - "a fichier d'image"@fr , - "ha file imagine"@it ; - - rdfs:comment "Connects a Representation to an image file"@en ; - - :objectClassConstraint :StillImageFileValue ; - - :subjectClassConstraint :StillImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue - -:hasMovingImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Filmdatei"@de , - "has movie file"@en , - "a fichier de film"@fr , - "ha file film"@it ; - - rdfs:comment "Connects a Representation to a movie file"@en ; - - :objectClassConstraint :MovingImageFileValue ; - - :subjectClassConstraint :MovingImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasAudioFileValue - -:hasAudioFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Audiodatei"@de , - "has audio file"@en , - "a fichier d'audio"@fr , - "ha file audio"@it ; - - rdfs:comment "Connects a Representation to an audio file"@en ; - - :objectClassConstraint :AudioFileValue ; - - :subjectClassConstraint :AudioRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDDDFileValue - -:hasDDDFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat 3D-Datei"@de , - "has 3D-file"@en , - "a ficher de 3D"@fr , - "ha file 3D"@it ; - - rdfs:comment "Connects a Representation to a 3D-file"@en ; - - :objectClassConstraint :DDDFileValue ; - - :subjectClassConstraint :DDDRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasTextFileValue - -:hasTextFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Textdatei"@de , - "has text file"@en , - "a fichier de texte"@fr , - "ha file testo"@it ; - - rdfs:comment "Connects a Representation to a text file"@en ; - - :objectClassConstraint :TextFileValue ; - - :subjectClassConstraint :TextRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDocumentFileValue - -:hasDocumentFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Dokument"@de , - "has document"@en , - "a document"@fr , - "ha documento"@it ; - - rdfs:comment "Connects a Representation to a document"@en ; - - :objectClassConstraint :DocumentFileValue ; - - :subjectClassConstraint :DocumentRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasGeometry - -:hasGeometry rdf:type owl:ObjectProperty ; - - rdfs:label "Geometrie"@de , - "Geometry"@en , - "Géometrie"@fr , - "Geometria"@it ; - - rdfs:comment """Represents a geometrical shape."""@en ; - - rdfs:subPropertyOf :hasValue ; - - salsah-gui:guiElement salsah-gui:Geometry ; - - :isEditable true ; - - :objectClassConstraint :GeomValue ; - - :subjectClassConstraint :Region . - - - -### http://www.knora.org/ontology/knora-base#hasLinkTo - -:hasLinkTo rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#hasLinkToValue - -:hasLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentation - -:hasRepresentation rdf:type owl:ObjectProperty ; - - rdfs:label "hat Repräsentation"@de , - "has Representation"@en , - "a Répresentation"@fr , - "ha Rappresentazione"@it ; - - rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; - - :objectClassConstraint :Representation ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentationValue - -:hasRepresentationValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo - -:hasStandoffLinkTo rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue - -:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasLink - -:standoffTagHasLink rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :StandoffLinkTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference - -:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :StandoffInternalReferenceTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStart - -:standoffTagHasStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEnd - -:standoffTagHasEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex - -:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex - -:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor - -:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent - -:standoffTagHasStartParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent - -:standoffTagHasEndParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasUUID - -:standoffTagHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:string . - - -:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#hasSubListNode - -:hasSubListNode rdf:type owl:ObjectProperty ; - - rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :ListNode ; - - :subjectClassConstraint :ListNode . - - -### http://www.knora.org/ontology/knora-base#hasValue - -:hasValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Value . - - -### http://www.knora.org/ontology/knora-base#isAnnotationOf - -:isAnnotationOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Annotation von"@de , - "is Annotation of"@en , - "est Annotation de"@fr , - "è Annotation di"@it ; - - :subjectClassConstraint :Annotation ; - - :objectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isAnnotationOfValue - -:isAnnotationOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Annotation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isPartOf - -:isPartOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Teil von"@de , - "is part of"@en , - "fait partie de"@fr , - "fa parte di"@it ; - - rdfs:comment "Indicates that this resource is part of another resource"@en ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isPartOfValue - -:isPartOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isRegionOf - -:isRegionOf rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :subjectClassConstraint :Region ; - - :objectClassConstraint :Representation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isRegionOfValue - -:isRegionOfValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Region ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#previousValue - -:previousValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "Points to the previous verson of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectClassConstraint :Value . - - - -### http://www.knora.org/ontology/knora-base#seqnum - -:seqnum rdf:type owl:ObjectProperty ; - - :objectClassConstraint :IntValue ; - - rdfs:subPropertyOf :hasValue ; - - rdfs:label "Sequenznummer"@de , - "Sequence number"@en , - "Numéro de séquence"@fr , - "Numero di sequenza"@it ; - - rdfs:comment "Indicates the position of a resource within a sequence"@en . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID - -:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - - -### http://www.knora.org/ontology/knora-base#valueHasStandoff - -:valueHasStandoff rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasLanguage - -:valueHasLanguage rdf:type owl:DatatypeProperty ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasMapping - -:valueHasMapping rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :XMLToStandoffMapping ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#hasMappingElement - -:hasMappingElement rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "mapping element"@en ; - - rdfs:comment """Represents an element in a mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :MappingElement . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname - -:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML tag"@en ; - - rdfs:comment """name of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace - -:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "namespace of the XML tag"@en ; - - rdfs:comment """namespace of the XML tag"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLClass - -:mappingHasXMLClass rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "class of the XML tag"@en ; - - rdfs:comment """class of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass - -:mappingHasStandoffClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff class"@en ; - - rdfs:comment """IRI of the standoff class"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectClassConstraint owl:Class . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute - -:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename - -:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty - -:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff property"@en ; - - rdfs:comment """IRI of the standoff property"""@en ; - - :subjectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass - -:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "datatype of the XML tag"@en ; - - rdfs:comment """datatype of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingStandoffDataTypeClass . - - -### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator - -:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "indicates if the element requires a separator in the text"@en ; - - rdfs:comment """indicates if the element requires a separator in the text"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation - -:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "default XSL Transformation"@en ; - - rdfs:comment """default XSL Transformation for this mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :XSLTransformation . - - -### http://www.knora.org/ontology/knora-base#deletedBy - -:deletedBy rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates who deleted a resource or value"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectClassConstraint knora-admin:User . - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#creationDate - -:creationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource was created"@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#deleteDate - -:deleteDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource or value was deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:dateTime . - - -### http://www.knora.org/ontology/knora-base#dimX - -:dimX rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#dimY - -:dimY rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#duration - -:duration rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#extResAccessInfo - -:extResAccessInfo rdf:type owl:DatatypeProperty ; - - rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResId - -:extResId rdf:type owl:DatatypeProperty ; - - rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResProvider - -:extResProvider rdf:type owl:DatatypeProperty ; - - rdfs:comment "The name of the external provider of the resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - - -### http://www.knora.org/ontology/knora-base#fps - -:fps rdf:type owl:DatatypeProperty ; - - rdfs:label "Frames per second"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :MovingImageFileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#internalFilename - -:internalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#internalMimeType - -:internalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isDeleted - -:isDeleted rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the resource has been deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#isRootNode - -:isRootNode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#hasRootNode - -:hasRootNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint :ListNode . - - - - -### http://www.knora.org/ontology/knora-base#lastModificationDate - -:lastModificationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#listNodePosition - -:listNodePosition rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#listNodeName - -:listNodeName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalFilename - -:originalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalMimeType - -:originalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasComment - -:valueHasComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment on a value"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#deleteComment - -:deleteComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueCreationDate - -:valueCreationDate rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :Value ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#valueHas - -:valueHas rdf:type rdf:Property ; - - :subjectClassConstraint :ValueBase ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . - - - -### http://www.knora.org/ontology/knora-base#valueHasUUID - -:valueHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "The UUID of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasCalendar - -:valueHasCalendar rdf:type owl:DatatypeProperty ; - - rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasColor - -:valueHasColor rdf:type owl:DatatypeProperty ; - - rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ColorBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndJDN - -:valueHasEndJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndPrecision - -:valueHasEndPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasDecimal - -:valueHasDecimal rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DecimalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeometry - -:valueHasGeometry rdf:type owl:DatatypeProperty ; - - rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeomValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeonameCode - -:valueHasGeonameCode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeonameValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasInteger - -:valueHasInteger rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasBoolean - -:valueHasBoolean rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :BooleanBase ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#valueHasUri - -:valueHasUri rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :UriBase ; - - :objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd - -:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart - -:valueHasIntervalStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasListNode - -:valueHasListNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ListValue ; - - :objectClassConstraint :ListNode . - - - -### http://www.knora.org/ontology/knora-base#valueHasOrder - -:valueHasOrder rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#valueHasRefCount - -:valueHasRefCount rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :LinkValue ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartJDN - -:valueHasStartJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartPrecision - -:valueHasStartPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasString - -:valueHasString rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#hasPermissions - -:hasPermissions rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string . - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#Annotation - -:Annotation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOf ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOfValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Annotation"@de , - "Annotation"@en , - "Annotation"@fr , - "Annotation"@it ; - - :canBeInstantiated true ; - - rdfs:comment "A generic class for representing annotations"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioFileValue - -:AudioFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an audio file"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioRepresentation - -:AudioRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasAudioFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Audio)"@de , - "Representation (Audio)"@en , - "Répresentation (Audio)"@fr , - "Rappresentazione (Audio)"@it ; - - rdfs:comment "Represents a file containing audio data"@en . - - -### http://www.knora.org/ontology/knora-base#ColorBase - -:ColorBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#ColorValue - -:ColorValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :ColorBase ; - - rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . - - - -### http://www.knora.org/ontology/knora-base#DDDFileValue - -:DDDFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#DDDRepresentation - -:DDDRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDDDFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (3D)"@de , - "Representation (3D)"@en , - "Répresentation (3D)"@fr , - "Rappresentazione (3D)"@it ; - - rdfs:comment "Represents a file containg 3D data"@en . - - -### http://www.knora.org/ontology/knora-base#DateBase - -:DateBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasCalendar ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DateValue - -:DateValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DateBase ; - - rdfs:comment "Represents a Knora date value"@en . - - - -### http://www.knora.org/ontology/knora-base#DocumentFileValue - -:DocumentFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue . - - - -### http://www.knora.org/ontology/knora-base#DocumentRepresentation - -:DocumentRepresentation rdf:type owl:Class ; - - rdfs:label "Repräsentation (Dokument)"@de , - "Representation (Document)"@en , - "Répresentation (Document)"@fr , - "Rappresentazione (Documento)"@it ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDocumentFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResValue - -:ExternalResValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :extResId ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResProvider ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResAccessInfo ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResource - -:ExternalResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasExtResValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Externe Ressource"@de , - "External Resource"@en , - "Ressource Externe"@fr , - "Risorsa esterna"@it ; - - rdfs:comment "Represents a proxy for an object stored by an external provider"@en . - - - -### http://www.knora.org/ontology/knora-base#FileValue - -:FileValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :originalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :originalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DecimalBase - -:DecimalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasDecimal ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#DecimalValue - -:DecimalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DecimalBase ; - - rdfs:comment "Represents an arbitrary-precision decimal value"@en . - - - -### http://www.knora.org/ontology/knora-base#GeomValue - -:GeomValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeometry ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a geometrical objects as JSON string"@en . - - - -### http://www.knora.org/ontology/knora-base#GeonameValue - -:GeonameValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeonameCode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntBase - -:IntBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasInteger ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntValue - -:IntValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :IntBase ; - - rdfs:comment "Represents an integer value"@en . - -### http://www.knora.org/ontology/knora-base#BooleanBase - -:BooleanBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasBoolean ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#BooleanValue - -:BooleanValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :BooleanBase ; - - rdfs:comment "Represents a boolean value"@en . - - - -### http://www.knora.org/ontology/knora-base#UriBase - -:UriBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUri ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - -### http://www.knora.org/ontology/knora-base#UriValue - -:UriValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :UriBase ; - - rdfs:comment "Represents a URI"@en . - -### http://www.knora.org/ontology/knora-base#IntervalBase - -:IntervalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#IntervalValue - -:IntervalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :IntervalBase ; - - rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkObj - -:LinkObj rdf:type owl:Class ; - - rdfs:label "Verknüpfungsobjekt"@de , - "Link Object"@en , - "Objet de lien"@fr , - "Oggetto di connessione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkTo ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkToValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "link.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Verknüpfung mehrerer Resourcen"@de , - "Represents a generic link object"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkValue - -:LinkValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - rdf:Statement , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasRefCount ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:subject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:predicate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:object ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A reification node that describes direct links between resources"@en . - - - -### http://www.knora.org/ontology/knora-base#ListNode - -:ListNode rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :hasSubListNode ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodePosition ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodeName ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "Represents a flat or hierarchical list"@en . - - - -### http://www.knora.org/ontology/knora-base#ListValue - -:ListValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasListNode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#MovingImageFileValue - -:MovingImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :fps ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a moving image file"@en . - - - -### http://www.knora.org/ontology/knora-base#MovingImageRepresentation - -:MovingImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasMovingImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Video)"@de , - "Representation (Movie)"@en , - "Répresentation (Film)"@fr , - "Rappresentazione (Film)"@it ; - - rdfs:comment "A resource containing moving image data"@en . - - - -### http://www.knora.org/ontology/knora-base#Region - -:Region rdf:type owl:Class ; - - rdfs:label "Region"@de , - "Region"@en , - "Région"@fr , - "Regione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOf ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasGeometry ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOfValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "region.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . - - - -### http://www.knora.org/ontology/knora-base#Representation - -:Representation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation"@de , - "Representation"@en , - "Répresentation"@fr , - "Rappresentazione"@it ; - - rdfs:comment "A resource that can store a file"@en . - - - -### http://www.knora.org/ontology/knora-base#Resource - -:Resource rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkTo ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkToValue ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :creationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :lastModificationDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Ressource"@de , - "Resource"@en , - "Ressource"@fr , - "Risorsa"@it ; - - rdfs:comment "Represents something in the world, or an abstract thing"@en . - - -################################################################# -# -# Generic Standoff Tag -# -################################################################# - - -:standoffParentClassConstraint rdf:type owl:ObjectProperty . - - -### http://www.knora.org/ontology/knora-base#StandoffTag - -:StandoffTag rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasUUID ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasOriginalXMLID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartIndex ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffParentClassConstraint; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a standoff markup tag"@en . - - - -################################################################# -# -# Abstract Standoff Data Type Tag -# -################################################################# - -### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag - -:StandoffDataTypeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag ; - - rdfs:comment "Represents a knora-base value type in a TextValue"@en . - - -################################################################# -# -# Standoff Data Type Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#StandoffLinkTag - -:StandoffLinkTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasLink ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffUriTag - -:StandoffUriTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag , - :UriBase ; - - rdfs:comment "Represents an arbitrary URI in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDateTag - -:StandoffDateTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DateBase ; - - rdfs:comment "Represents a date in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffColorTag - -:StandoffColorTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ColorBase ; - - rdfs:comment "Represents a color in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntegerTag - -:StandoffIntegerTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntBase ; - - rdfs:comment "Represents an integer value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDecimalTag - -:StandoffDecimalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DecimalBase ; - - rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntervalTag - -:StandoffIntervalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntervalBase ; - - rdfs:comment "Represents an interval in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffBooleanTag - -:StandoffBooleanTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :BooleanBase ; - - rdfs:comment "Represents a boolean in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag - -:StandoffInternalReferenceTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasInternalReference ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an internal reference in a TextValue"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageFileValue - -:StillImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A file containing a two-dimensional still image"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageRepresentation - -:StillImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStillImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Bild)"@de , - "Representation (Image)"@en , - "Répresentation (Image)"@fr , - "Rappresentazione (Imagine)"@it ; - - rdfs:comment "A resource that can contain a two-dimensional still image file"@en . - - - -### http://www.knora.org/ontology/knora-base#TextFileValue - -:TextFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#TextRepresentation - -:TextRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Text)"@de , - "Representation (Text)"@en , - "Répresentation (Texte)"@fr , - "Rappresentazione (testo)"@it ; - - rdfs:comment "A resource containing a text file"@en . - - -### http://www.knora.org/ontology/knora-base#ForbiddenResource - -:ForbiddenResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ]; - - rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; - - rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . - -### http://www.knora.org/ontology/knora-base#XSLTransformation - -:XSLTransformation rdf:type owl:Class ; - - rdfs:subClassOf :TextRepresentation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; - - rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . - - -### http://www.knora.org/ontology/knora-base#MappingComponent - -:MappingComponent rdf:type owl:Class ; - - rdfs:label "Component of a mapping"@en ; - - rdfs:comment "Component of a mapping" . - - -### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass - -:MappingStandoffDataTypeClass rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingXMLAttribute - -:MappingXMLAttribute rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffProperty ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingElement - -:MappingElement rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLTagname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttribute ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffDataTypeClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingElementRequiresSeparator ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping - -:XMLToStandoffMapping rdf:type owl:Class ; - - rdfs:subClassOf - [ rdf:type owl:Restriction ; - owl:onProperty :hasMappingElement ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasDefaultXSLTransformation ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#TextValue - -:TextValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStandoff ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMaxStandoffStartIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasLanguage ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMapping ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ValueBase - -:ValueBase rdf:type owl:Class . - - -### http://www.knora.org/ontology/knora-base#Value - -:Value rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :valueCreationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasOrder ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :previousValue ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasString ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUUID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - - rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1367/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1367/knora-ontologies/salsah-gui.ttl deleted file mode 100644 index 6c183c0f51..0000000000 --- a/upgrade/plugins/pr1367/knora-ontologies/salsah-gui.ttl +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@prefix knora-base: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The salsah-gui ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Properties -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#guiOrder - -:guiOrder rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint owl:Restriction ; - - knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . - - - -### http://www.knora.org/ontology/salsah-gui#guiElement - -:guiElement rdf:type owl:ObjectProperty . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttribute - -:guiAttribute rdf:type owl:DatatypeProperty ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition - -:guiAttributeDefinition rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint :Guielement ; - - knora-base:objectDatatypeConstraint xsd:string . - - - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Guielement - -:Guielement rdf:type owl:Class . - - - - - -################################################################# -# -# Individuals -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Colorpicker - -:Colorpicker rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "ncolors:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Date - -:Date rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geometry - -:Geometry rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geonames - -:Geonames rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Iconclass - -# :Iconclass rdf:type :Guielement , -# owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Interval - -:Interval rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#List - -:List rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Pulldown - -:Pulldown rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Radio - -:Radio rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Richtext - -:Richtext rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Searchbox - -:Searchbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "numprops:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#SimpleText - -:SimpleText rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "size:integer" , - "maxlength:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Slider - -:Slider rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max(required):decimal" , - "min(required):decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Spinbox - -:Spinbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max:decimal" , - "min:decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Textarea - -:Textarea rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "cols:integer" , - "rows:integer" , - "width:percent" , - "wrap:string(soft|hard)" . - - -### http://www.knora.org/ontology/salsah-gui#Checkbox - -:Checkbox rdf:type :Guielement , - owl:NamedIndividual . - - -### http://www.knora.org/ontology/salsah-gui#Fileupload - -:Fileupload rdf:type :Guielement , - owl:NamedIndividual . diff --git a/upgrade/plugins/pr1367/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1367/knora-ontologies/standoff-onto.ttl deleted file mode 100644 index f5113c5028..0000000000 --- a/upgrade/plugins/pr1367/knora-ontologies/standoff-onto.ttl +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix salsah-gui: . -@base . - -@prefix : . - - rdf:type owl:Ontology ; - - rdfs:label "The standoff ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Standoff Properties -# -################################################################# - -### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType - -:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the document type"@en ; - - knora-base:subjectClassConstraint :StandoffRootTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget - -:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the target settings of a hyperlink"@en ; - - knora-base:subjectClassConstraint :StandoffHyperlinkTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -################################################################# -# -# Intermediate Standoff Tags -# -################################################################# - -### http://www.knora.org/ontology/standoff#StandoffVisualTag - -:StandoffVisualTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents visual markup information in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStructuralTag - -:StandoffStructuralTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents structural markup information in a TextValue"@en . - - -################################################################# -# -# Standoff Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/standoff#StandoffRootTag - -:StandoffRootTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffRootTagHasDocumentType ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . - -### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag - -:StandoffHyperlinkTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffUriTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffHyperlinkTagHasTarget ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a hyperlink in a text"@en . - -### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag - -:StandoffBlockquoteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section that is quoted from another source in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffCodeTag - -:StandoffCodeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section of computer source code in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffParagraphTag - -:StandoffParagraphTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a paragraph in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader1Tag - -:StandoffHeader1Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 1 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader2Tag - -:StandoffHeader2Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 2 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader3Tag - -:StandoffHeader3Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 3 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader4Tag - -:StandoffHeader4Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 4 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader5Tag - -:StandoffHeader5Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 5 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader6Tag - -:StandoffHeader6Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 6 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffOrderedListTag - -:StandoffOrderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an ordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag - -:StandoffUnorderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an unordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffListElementTag - -:StandoffListElementTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a list element in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableBodyTag - -:StandoffTableBodyTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table body in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableTag - -:StandoffTableTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableRowTag - -:StandoffTableRowTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a row in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableCellTag - -:StandoffTableCellTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a cell in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBrTag - -:StandoffBrTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a linebreak"@en . - - - -### http://www.knora.org/ontology/standoff#StandoffItalicTag - -:StandoffItalicTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents italics in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBoldTag - -:StandoffBoldTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents bold text in a TextValue"@en . - -### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag - -:StandoffCiteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents the title of a work in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnderlineTag - -:StandoffUnderlineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents underlined text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag - -:StandoffStrikethroughTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents struck text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag - -:StandoffSuperscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents superscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSubscriptTag - -:StandoffSubscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents subscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag - -:StandoffLineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a line to seperate content in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag - -:StandoffPreTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1367/test_1367.py b/upgrade/plugins/pr1367/test_1367.py deleted file mode 100644 index 3016d1f3e1..0000000000 --- a/upgrade/plugins/pr1367/test_1367.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import tempfile -import rdflib -from rdflib.term import URIRef, Literal -from rdflib.namespace import XSD -from plugins.pr1367.update import GraphTransformer - - -save_output = False - - -def test_update(): - input_graph = rdflib.Graph() - input_graph.parse("plugins/pr1367/test_data.ttl", format="turtle") - - transformer = GraphTransformer() - output_graph = transformer.transform(input_graph) - objects = list(output_graph.objects(URIRef("http://rdfh.ch/0001/thing-with-history/values/1"), URIRef("http://www.knora.org/ontology/knora-base#valueHasDecimal"))) - assert objects == [Literal("1.2", datatype=XSD.decimal)] - - if save_output: - temp_dir = tempfile.mkdtemp() - output_file_path = temp_dir + "/output.ttl" - output_graph.serialize(destination=output_file_path, format="turtle") - print("Wrote output to", output_file_path) diff --git a/upgrade/plugins/pr1367/test_data.ttl b/upgrade/plugins/pr1367/test_data.ttl deleted file mode 100644 index 36c6f863e8..0000000000 --- a/upgrade/plugins/pr1367/test_data.ttl +++ /dev/null @@ -1,26 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix anything: . - - a anything:Thing; - knora-base:isDeleted false; - knora-base:attachedToUser ; - knora-base:attachedToProject ; - rdfs:label "A thing with a decimal value"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; - knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; - anything:hasDecimal . - - a knora-base:DecimalValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasDecimal "1.2"^^xsd:valueHasDecimal; - knora-base:valueHasOrder 0; - knora-base:valueHasString "1.2"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser . diff --git a/upgrade/plugins/pr1367/update.py b/upgrade/plugins/pr1367/update.py deleted file mode 100644 index affb017e1b..0000000000 --- a/upgrade/plugins/pr1367/update.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import rdflib -from rdflib.namespace import XSD -from updatelib import rdftools - - -# The incorrect IRI of xsd:valueHasDecimal. -xsd_value_has_decimal = rdflib.term.URIRef("http://www.w3.org/2001/XMLSchema#valueHasDecimal") - - -# Updates datatypes for PR 1367. -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - output_graph = rdflib.Graph() - - for (s, p, o) in graph: - if o.__class__.__name__ == "Literal" and o.datatype == xsd_value_has_decimal: - new_o = rdflib.Literal(str(o), datatype=XSD.decimal) - output_graph.add((s, p, new_o)) - else: - output_graph.add((s, p, o)) - - return output_graph diff --git a/upgrade/plugins/pr1372/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1372/knora-ontologies/knora-admin.ttl deleted file mode 100644 index c731a6f7e4..0000000000 --- a/upgrade/plugins/pr1372/knora-ontologies/knora-admin.ttl +++ /dev/null @@ -1,777 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix knora-base: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora admin ontology"@en ; - - knora-base:attachedToProject :SystemProject . - - -################################################################# -# -# Object Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#belongsToInstitution - -:belongsToInstitution rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which Institution a project belongs to."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectClassConstraint :Institution . - - - -### http://www.knora.org/ontology/knora-admin#belongsToProject - -:belongsToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which project a group belongs to."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#currentproject - -:currentproject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isInGroup - -:isInGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :UserGroup . - - - -### http://www.knora.org/ontology/knora-admin#isInProject - -:isInProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isAdminForProject - -:isInProjectAdminGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project's ProjectAdmin group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-admin#address - -:address rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:comment "The address of a person or an institution"@en . - - -### http://www.knora.org/ontology/knora-admin#groupName - -:groupName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The group's name."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:subPropertyOf . - - - -### http://www.knora.org/ontology/knora-admin#groupDescription - -:groupDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a user group"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled - -:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if users can add themselves to the project or group."@en ; - - # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#institutionName - -:institutionName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The institutions's name."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionDescription - -:institutionDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of an institution."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionWebsite - -:institutionWebsite rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The URL of a web site."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-admin#isActiveUser - -:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#givenName - -:givenName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's given name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#familyName - -:familyName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's family name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#password - -:password rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "An encrypted credential for access"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#phone - -:phone rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The phone number of a person, institution, etc."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#preferredLanguage - -:preferredLanguage rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The ISO 639-1 code of the user's preferred language."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectDescription - -:projectDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a Knora project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectKeyword - -:projectKeyword rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A keyword describing a project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLongname - -:projectLongname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The longname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLogo - -:projectLogo rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the projects's logo."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize - -:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark - -:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the restricted view watermark."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectShortname - -:projectShortname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique shortname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectShortcode - -:projectShortcode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique short code of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#username - -:username rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The username and login name of a user."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#email - -:email rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The email address and login name of a user."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#status - -:status rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)."@en ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -################################################################# -# -# Classes -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#Institution - -:Institution rdf:type owl:Class ; - - rdfs:subClassOf foaf:Organization , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionWebsite ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :phone ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "An institution that has data in Knora."@en . - - - -### http://www.knora.org/ontology/knora-admin#User - -:User rdf:type owl:Class ; - - rdfs:subClassOf foaf:Person , - [ rdf:type owl:Restriction ; - owl:onProperty :username ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :familyName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :givenName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :password ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :preferredLanguage ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInProject ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInGroup ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInSystemAdminGroup ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a Knora user."@en . - - - -### http://www.knora.org/ontology/knora-admin#UserGroup - -:UserGroup rdf:type owl:Class ; - - rdfs:subClassOf foaf:Group , - [ rdf:type owl:Restriction ; - owl:onProperty :groupName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :groupDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "A group of Knora users."@en . - - - - -### http://www.knora.org/ontology/knora-admin#knoraProject - -:knoraProject rdf:type owl:Class ; - - rdfs:subClassOf foaf:Project , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortcode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLongname ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectDescription ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectKeyword ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLogo ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewSize ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewWatermark ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToInstitution ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a project that uses Knora."@en . - - - - -################################################################# -# -# Individuals -# -################################################################# - -### http://www.knora.org/ontology/knora-admin#UnknownUser -:UnknownUser rdf:type :UserGroup ; - :groupName "UnknownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#KnownUser -:KnownUser rdf:type :UserGroup ; - :groupName "KnownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#Creator -:Creator rdf:type :UserGroup ; - :groupName "Creator" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectMember -:ProjectMember rdf:type :UserGroup ; - :groupName "ProjectMember" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectAdmin -:ProjectAdmin rdf:type :UserGroup ; - :groupName "ProjectAdmin" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemAdmin -:SystemAdmin rdf:type :UserGroup ; - :groupName "SystemAdmin" ; - :belongsToProject :SystemProject ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemUser -:SystemUser rdf:type :User ; - rdfs:comment "A built-in system user."@en ; - :username "system"; - :email "system@localhost" ; - :givenName "Knora" ; - :familyName "System" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#AnonymousUser -:AnonymousUser rdf:type :User ; - rdfs:comment "A built-in anonymous user."@en ; - :username "anonymous" ; - :email "anonymous@localhost" ; - :givenName "Knora" ; - :familyName "Anonymous" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemProject -:SystemProject rdf:type :knoraProject ; - rdfs:comment "A built-in project representing the Knora System."@en ; - :projectShortname "SystemProject" ; - :projectShortcode "FFFF" ; - :projectLongname "Knora System Project" ; - :projectDescription "Knora System Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - - -### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject -:DefaultSharedOntologiesProject rdf:type :knoraProject ; - rdfs:comment "The default project for shared ontologies."@en ; - :projectShortname "DefaultSharedOntologiesProject" ; - :projectShortcode "0000" ; - :projectLongname "Knora Default Shared Ontologies Project" ; - :projectDescription "Knora Shared Ontologies Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -# -## -### Permission Class Properties -## -# -### http://www.knora.org/ontology/knora-admin#forProject - -:forProject rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a knoraProject."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :knoraProject . - -### http://www.knora.org/ontology/knora-admin#forGroup -:forGroup rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a UserGroup."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :UserGroup . - -### http://www.knora.org/ontology/knora-admin#forResourceClass -:forResourceClass rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource class."@en ; - knora-base:subjectClassConstraint :Permission . - -### http://www.knora.org/ontology/knora-admin#forProperty -:forProperty rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource property."@en ; - knora-base:subjectClassConstraint :Permission . - - -# -## -### Permission Class and Sub-Classes -## -# -### http://www.knora.org/ontology/knora-admin#Permission -:Permission rdf:type owl:Class ; - rdfs:comment "Base Permission class."@en. - - -### http://www.knora.org/ontology/knora-admin#AdministrativePermission -:AdministrativePermission rdf:type owl:Class ; - rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; - rdfs:subClassOf :Permission . - -### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission -:DefaultObjectAccessPermission rdf:type owl:Class ; - rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; - rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1372/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1372/knora-ontologies/knora-base.ttl deleted file mode 100644 index c6005e648d..0000000000 --- a/upgrade/plugins/pr1372/knora-ontologies/knora-base.ttl +++ /dev/null @@ -1,2710 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@prefix salsah-gui: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora base ontology"@en ; - - :attachedToProject knora-admin:SystemProject ; - - :ontologyVersion "PR 1372" . - - - -################################################################# -# -# Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-base#ontologyVersion - -:ontologyVersion rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; - - :subjectClassConstraint owl:Ontology ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isMainResource - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:isMainResource rdf:type owl:DatatypeProperty ; - - rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted - -:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; - - rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . - - - -### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint - -:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; - - rdfs:comment "Specifies the type required as the object of a datatype property"@en . - - - -### http://www.knora.org/ontology/knora-base#resourceIcon - -:resourceIcon rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#resourceProperty - -:resourceProperty rdf:type owl:ObjectProperty ; - - rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#subjectClassConstraint - -:subjectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#objectClassConstraint - -:objectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#isEditable - -:isEditable rdf:type owl:AnnotationProperty ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "is editable"@en ; - - rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#canBeInstantiated - -:canBeInstantiated rdf:type owl:AnnotationProperty ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "can be instantiated"@en ; - - rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#attachedToProject - -:attachedToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to project"@en ; - - rdfs:comment "Connects something to a project"@en ; - - :objectClassConstraint knora-admin:knoraProject . - - - -### http://www.knora.org/ontology/knora-base#attachedToUser - -:attachedToUser rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to user"@en ; - - rdfs:comment "Connects something to a user"@en ; - - :objectClassConstraint knora-admin:User . - - -### http://www.knora.org/ontology/knora-base#hasColor - -:hasColor rdf:type owl:ObjectProperty ; - - rdfs:label "Farbe"@de , - "Color"@en , - "Couleur"@fr , - "Colore"@it ; - - rdfs:comment """Specifies the color of a region."""@en ; - - salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; - - :objectClassConstraint :ColorValue ; - - :subjectClassConstraint :Region ; - - rdfs:subPropertyOf :hasValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Colorpicker . - - - -### http://www.knora.org/ontology/knora-base#hasComment - -:hasComment rdf:type owl:ObjectProperty ; - - rdfs:label "Kommentar"@de , - "Comment"@en , - "Commentaire"@fr , - "Commento"@it ; - - rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :TextValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Richtext ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasExtResValue - -:hasExtResValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat externen Wert"@de , - "has external Value"@en , - "a valeur externe"@fr , - "ha valore esterno"@it ; - - :objectClassConstraint :ExternalResValue ; - - :subjectClassConstraint :ExternalResource ; - - rdfs:subPropertyOf :hasValue . - - -### http://www.knora.org/ontology/knora-base#hasFileValue - -:hasFileValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :FileValue ; - - rdfs:label "hat Datei"@de , - "has file"@en , - "a fichier"@fr , - "ha file"@it ; - - rdfs:comment "Connects a Representation to a file"@en ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - :subjectClassConstraint :Representation ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasStillImageFileValue - -:hasStillImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Bilddatei"@de , - "has image file"@en , - "a fichier d'image"@fr , - "ha file imagine"@it ; - - rdfs:comment "Connects a Representation to an image file"@en ; - - :objectClassConstraint :StillImageFileValue ; - - :subjectClassConstraint :StillImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue - -:hasMovingImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Filmdatei"@de , - "has movie file"@en , - "a fichier de film"@fr , - "ha file film"@it ; - - rdfs:comment "Connects a Representation to a movie file"@en ; - - :objectClassConstraint :MovingImageFileValue ; - - :subjectClassConstraint :MovingImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasAudioFileValue - -:hasAudioFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Audiodatei"@de , - "has audio file"@en , - "a fichier d'audio"@fr , - "ha file audio"@it ; - - rdfs:comment "Connects a Representation to an audio file"@en ; - - :objectClassConstraint :AudioFileValue ; - - :subjectClassConstraint :AudioRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDDDFileValue - -:hasDDDFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat 3D-Datei"@de , - "has 3D-file"@en , - "a ficher de 3D"@fr , - "ha file 3D"@it ; - - rdfs:comment "Connects a Representation to a 3D-file"@en ; - - :objectClassConstraint :DDDFileValue ; - - :subjectClassConstraint :DDDRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasTextFileValue - -:hasTextFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Textdatei"@de , - "has text file"@en , - "a fichier de texte"@fr , - "ha file testo"@it ; - - rdfs:comment "Connects a Representation to a text file"@en ; - - :objectClassConstraint :TextFileValue ; - - :subjectClassConstraint :TextRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDocumentFileValue - -:hasDocumentFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Dokument"@de , - "has document"@en , - "a document"@fr , - "ha documento"@it ; - - rdfs:comment "Connects a Representation to a document"@en ; - - :objectClassConstraint :DocumentFileValue ; - - :subjectClassConstraint :DocumentRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasGeometry - -:hasGeometry rdf:type owl:ObjectProperty ; - - rdfs:label "Geometrie"@de , - "Geometry"@en , - "Géometrie"@fr , - "Geometria"@it ; - - rdfs:comment """Represents a geometrical shape."""@en ; - - rdfs:subPropertyOf :hasValue ; - - salsah-gui:guiElement salsah-gui:Geometry ; - - :isEditable true ; - - :objectClassConstraint :GeomValue ; - - :subjectClassConstraint :Region . - - - -### http://www.knora.org/ontology/knora-base#hasLinkTo - -:hasLinkTo rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#hasLinkToValue - -:hasLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentation - -:hasRepresentation rdf:type owl:ObjectProperty ; - - rdfs:label "hat Repräsentation"@de , - "has Representation"@en , - "a Répresentation"@fr , - "ha Rappresentazione"@it ; - - rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; - - :objectClassConstraint :Representation ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentationValue - -:hasRepresentationValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo - -:hasStandoffLinkTo rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue - -:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasLink - -:standoffTagHasLink rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :StandoffLinkTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference - -:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :StandoffInternalReferenceTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStart - -:standoffTagHasStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEnd - -:standoffTagHasEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex - -:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex - -:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor - -:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent - -:standoffTagHasStartParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent - -:standoffTagHasEndParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasUUID - -:standoffTagHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:string . - - -:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#hasSubListNode - -:hasSubListNode rdf:type owl:ObjectProperty ; - - rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :ListNode ; - - :subjectClassConstraint :ListNode . - - -### http://www.knora.org/ontology/knora-base#hasValue - -:hasValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Value . - - -### http://www.knora.org/ontology/knora-base#isAnnotationOf - -:isAnnotationOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Annotation von"@de , - "is Annotation of"@en , - "est Annotation de"@fr , - "è Annotation di"@it ; - - :subjectClassConstraint :Annotation ; - - :objectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isAnnotationOfValue - -:isAnnotationOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Annotation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isPartOf - -:isPartOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Teil von"@de , - "is part of"@en , - "fait partie de"@fr , - "fa parte di"@it ; - - rdfs:comment "Indicates that this resource is part of another resource"@en ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isPartOfValue - -:isPartOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isRegionOf - -:isRegionOf rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :subjectClassConstraint :Region ; - - :objectClassConstraint :Representation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isRegionOfValue - -:isRegionOfValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Region ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#previousValue - -:previousValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "Points to the previous verson of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectClassConstraint :Value . - - - -### http://www.knora.org/ontology/knora-base#seqnum - -:seqnum rdf:type owl:ObjectProperty ; - - :objectClassConstraint :IntValue ; - - rdfs:subPropertyOf :hasValue ; - - rdfs:label "Sequenznummer"@de , - "Sequence number"@en , - "Numéro de séquence"@fr , - "Numero di sequenza"@it ; - - rdfs:comment "Indicates the position of a resource within a sequence"@en . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID - -:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - - -### http://www.knora.org/ontology/knora-base#valueHasStandoff - -:valueHasStandoff rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasLanguage - -:valueHasLanguage rdf:type owl:DatatypeProperty ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasMapping - -:valueHasMapping rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :XMLToStandoffMapping ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#hasMappingElement - -:hasMappingElement rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "mapping element"@en ; - - rdfs:comment """Represents an element in a mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :MappingElement . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname - -:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML tag"@en ; - - rdfs:comment """name of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace - -:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "namespace of the XML tag"@en ; - - rdfs:comment """namespace of the XML tag"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLClass - -:mappingHasXMLClass rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "class of the XML tag"@en ; - - rdfs:comment """class of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass - -:mappingHasStandoffClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff class"@en ; - - rdfs:comment """IRI of the standoff class"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectClassConstraint owl:Class . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute - -:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename - -:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty - -:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff property"@en ; - - rdfs:comment """IRI of the standoff property"""@en ; - - :subjectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass - -:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "datatype of the XML tag"@en ; - - rdfs:comment """datatype of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingStandoffDataTypeClass . - - -### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator - -:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "indicates if the element requires a separator in the text"@en ; - - rdfs:comment """indicates if the element requires a separator in the text"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation - -:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "default XSL Transformation"@en ; - - rdfs:comment """default XSL Transformation for this mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :XSLTransformation . - - -### http://www.knora.org/ontology/knora-base#deletedBy - -:deletedBy rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates who deleted a resource or value"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectClassConstraint knora-admin:User . - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#creationDate - -:creationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource was created"@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#deleteDate - -:deleteDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource or value was deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:dateTime . - - -### http://www.knora.org/ontology/knora-base#dimX - -:dimX rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#dimY - -:dimY rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#duration - -:duration rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#extResAccessInfo - -:extResAccessInfo rdf:type owl:DatatypeProperty ; - - rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResId - -:extResId rdf:type owl:DatatypeProperty ; - - rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResProvider - -:extResProvider rdf:type owl:DatatypeProperty ; - - rdfs:comment "The name of the external provider of the resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - - -### http://www.knora.org/ontology/knora-base#fps - -:fps rdf:type owl:DatatypeProperty ; - - rdfs:label "Frames per second"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :MovingImageFileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#internalFilename - -:internalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#internalMimeType - -:internalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isDeleted - -:isDeleted rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the resource has been deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#isRootNode - -:isRootNode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#hasRootNode - -:hasRootNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint :ListNode . - - - - -### http://www.knora.org/ontology/knora-base#lastModificationDate - -:lastModificationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#listNodePosition - -:listNodePosition rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#listNodeName - -:listNodeName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalFilename - -:originalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalMimeType - -:originalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasComment - -:valueHasComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment on a value"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#deleteComment - -:deleteComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueCreationDate - -:valueCreationDate rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :Value ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#valueHas - -:valueHas rdf:type rdf:Property ; - - :subjectClassConstraint :ValueBase ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . - - - -### http://www.knora.org/ontology/knora-base#valueHasUUID - -:valueHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "The UUID of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasCalendar - -:valueHasCalendar rdf:type owl:DatatypeProperty ; - - rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasColor - -:valueHasColor rdf:type owl:DatatypeProperty ; - - rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ColorBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndJDN - -:valueHasEndJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndPrecision - -:valueHasEndPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasDecimal - -:valueHasDecimal rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DecimalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeometry - -:valueHasGeometry rdf:type owl:DatatypeProperty ; - - rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeomValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeonameCode - -:valueHasGeonameCode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeonameValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasInteger - -:valueHasInteger rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasBoolean - -:valueHasBoolean rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :BooleanBase ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#valueHasUri - -:valueHasUri rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :UriBase ; - - :objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd - -:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart - -:valueHasIntervalStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasListNode - -:valueHasListNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ListValue ; - - :objectClassConstraint :ListNode . - - - -### http://www.knora.org/ontology/knora-base#valueHasOrder - -:valueHasOrder rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#valueHasRefCount - -:valueHasRefCount rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :LinkValue ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartJDN - -:valueHasStartJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartPrecision - -:valueHasStartPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasString - -:valueHasString rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#hasPermissions - -:hasPermissions rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string . - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#Annotation - -:Annotation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOf ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOfValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Annotation"@de , - "Annotation"@en , - "Annotation"@fr , - "Annotation"@it ; - - :canBeInstantiated true ; - - rdfs:comment "A generic class for representing annotations"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioFileValue - -:AudioFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an audio file"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioRepresentation - -:AudioRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasAudioFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Audio)"@de , - "Representation (Audio)"@en , - "Répresentation (Audio)"@fr , - "Rappresentazione (Audio)"@it ; - - rdfs:comment "Represents a file containing audio data"@en . - - -### http://www.knora.org/ontology/knora-base#ColorBase - -:ColorBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#ColorValue - -:ColorValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :ColorBase ; - - rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . - - - -### http://www.knora.org/ontology/knora-base#DDDFileValue - -:DDDFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#DDDRepresentation - -:DDDRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDDDFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (3D)"@de , - "Representation (3D)"@en , - "Répresentation (3D)"@fr , - "Rappresentazione (3D)"@it ; - - rdfs:comment "Represents a file containg 3D data"@en . - - -### http://www.knora.org/ontology/knora-base#DateBase - -:DateBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasCalendar ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DateValue - -:DateValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DateBase ; - - rdfs:comment "Represents a Knora date value"@en . - - - -### http://www.knora.org/ontology/knora-base#DocumentFileValue - -:DocumentFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue . - - - -### http://www.knora.org/ontology/knora-base#DocumentRepresentation - -:DocumentRepresentation rdf:type owl:Class ; - - rdfs:label "Repräsentation (Dokument)"@de , - "Representation (Document)"@en , - "Répresentation (Document)"@fr , - "Rappresentazione (Documento)"@it ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDocumentFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResValue - -:ExternalResValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :extResId ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResProvider ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResAccessInfo ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResource - -:ExternalResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasExtResValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Externe Ressource"@de , - "External Resource"@en , - "Ressource Externe"@fr , - "Risorsa esterna"@it ; - - rdfs:comment "Represents a proxy for an object stored by an external provider"@en . - - - -### http://www.knora.org/ontology/knora-base#FileValue - -:FileValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :originalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :originalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DecimalBase - -:DecimalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasDecimal ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#DecimalValue - -:DecimalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DecimalBase ; - - rdfs:comment "Represents an arbitrary-precision decimal value"@en . - - - -### http://www.knora.org/ontology/knora-base#GeomValue - -:GeomValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeometry ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a geometrical objects as JSON string"@en . - - - -### http://www.knora.org/ontology/knora-base#GeonameValue - -:GeonameValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeonameCode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntBase - -:IntBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasInteger ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntValue - -:IntValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :IntBase ; - - rdfs:comment "Represents an integer value"@en . - -### http://www.knora.org/ontology/knora-base#BooleanBase - -:BooleanBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasBoolean ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#BooleanValue - -:BooleanValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :BooleanBase ; - - rdfs:comment "Represents a boolean value"@en . - - - -### http://www.knora.org/ontology/knora-base#UriBase - -:UriBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUri ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - -### http://www.knora.org/ontology/knora-base#UriValue - -:UriValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :UriBase ; - - rdfs:comment "Represents a URI"@en . - -### http://www.knora.org/ontology/knora-base#IntervalBase - -:IntervalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#IntervalValue - -:IntervalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :IntervalBase ; - - rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkObj - -:LinkObj rdf:type owl:Class ; - - rdfs:label "Verknüpfungsobjekt"@de , - "Link Object"@en , - "Objet de lien"@fr , - "Oggetto di connessione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkTo ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkToValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "link.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Verknüpfung mehrerer Resourcen"@de , - "Represents a generic link object"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkValue - -:LinkValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - rdf:Statement , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasRefCount ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:subject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:predicate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:object ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A reification node that describes direct links between resources"@en . - - - -### http://www.knora.org/ontology/knora-base#ListNode - -:ListNode rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :hasSubListNode ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodePosition ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodeName ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "Represents a flat or hierarchical list"@en . - - - -### http://www.knora.org/ontology/knora-base#ListValue - -:ListValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasListNode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#MovingImageFileValue - -:MovingImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :fps ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a moving image file"@en . - - - -### http://www.knora.org/ontology/knora-base#MovingImageRepresentation - -:MovingImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasMovingImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Video)"@de , - "Representation (Movie)"@en , - "Répresentation (Film)"@fr , - "Rappresentazione (Film)"@it ; - - rdfs:comment "A resource containing moving image data"@en . - - - -### http://www.knora.org/ontology/knora-base#Region - -:Region rdf:type owl:Class ; - - rdfs:label "Region"@de , - "Region"@en , - "Région"@fr , - "Regione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOf ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasGeometry ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOfValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "region.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . - - - -### http://www.knora.org/ontology/knora-base#Representation - -:Representation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation"@de , - "Representation"@en , - "Répresentation"@fr , - "Rappresentazione"@it ; - - rdfs:comment "A resource that can store a file"@en . - - - -### http://www.knora.org/ontology/knora-base#Resource - -:Resource rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkTo ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkToValue ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :creationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :lastModificationDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Ressource"@de , - "Resource"@en , - "Ressource"@fr , - "Risorsa"@it ; - - rdfs:comment "Represents something in the world, or an abstract thing"@en . - - -################################################################# -# -# Generic Standoff Tag -# -################################################################# - - -:standoffParentClassConstraint rdf:type owl:ObjectProperty . - - -### http://www.knora.org/ontology/knora-base#StandoffTag - -:StandoffTag rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasUUID ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasOriginalXMLID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartIndex ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffParentClassConstraint; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a standoff markup tag"@en . - - - -################################################################# -# -# Abstract Standoff Data Type Tag -# -################################################################# - -### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag - -:StandoffDataTypeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag ; - - rdfs:comment "Represents a knora-base value type in a TextValue"@en . - - -################################################################# -# -# Standoff Data Type Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#StandoffLinkTag - -:StandoffLinkTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasLink ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffUriTag - -:StandoffUriTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag , - :UriBase ; - - rdfs:comment "Represents an arbitrary URI in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDateTag - -:StandoffDateTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DateBase ; - - rdfs:comment "Represents a date in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffColorTag - -:StandoffColorTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ColorBase ; - - rdfs:comment "Represents a color in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntegerTag - -:StandoffIntegerTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntBase ; - - rdfs:comment "Represents an integer value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDecimalTag - -:StandoffDecimalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DecimalBase ; - - rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntervalTag - -:StandoffIntervalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntervalBase ; - - rdfs:comment "Represents an interval in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffBooleanTag - -:StandoffBooleanTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :BooleanBase ; - - rdfs:comment "Represents a boolean in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag - -:StandoffInternalReferenceTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasInternalReference ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an internal reference in a TextValue"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageFileValue - -:StillImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A file containing a two-dimensional still image"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageRepresentation - -:StillImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStillImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Bild)"@de , - "Representation (Image)"@en , - "Répresentation (Image)"@fr , - "Rappresentazione (Imagine)"@it ; - - rdfs:comment "A resource that can contain a two-dimensional still image file"@en . - - - -### http://www.knora.org/ontology/knora-base#TextFileValue - -:TextFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#TextRepresentation - -:TextRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Text)"@de , - "Representation (Text)"@en , - "Répresentation (Texte)"@fr , - "Rappresentazione (testo)"@it ; - - rdfs:comment "A resource containing a text file"@en . - - -### http://www.knora.org/ontology/knora-base#ForbiddenResource - -:ForbiddenResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ]; - - rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; - - rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . - -### http://www.knora.org/ontology/knora-base#XSLTransformation - -:XSLTransformation rdf:type owl:Class ; - - rdfs:subClassOf :TextRepresentation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; - - rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . - - -### http://www.knora.org/ontology/knora-base#MappingComponent - -:MappingComponent rdf:type owl:Class ; - - rdfs:label "Component of a mapping"@en ; - - rdfs:comment "Component of a mapping" . - - -### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass - -:MappingStandoffDataTypeClass rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingXMLAttribute - -:MappingXMLAttribute rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffProperty ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingElement - -:MappingElement rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLTagname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttribute ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffDataTypeClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingElementRequiresSeparator ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping - -:XMLToStandoffMapping rdf:type owl:Class ; - - rdfs:subClassOf - [ rdf:type owl:Restriction ; - owl:onProperty :hasMappingElement ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasDefaultXSLTransformation ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#TextValue - -:TextValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStandoff ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMaxStandoffStartIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasLanguage ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMapping ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ValueBase - -:ValueBase rdf:type owl:Class . - - -### http://www.knora.org/ontology/knora-base#Value - -:Value rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :valueCreationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasOrder ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :previousValue ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasString ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUUID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - - rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1372/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1372/knora-ontologies/salsah-gui.ttl deleted file mode 100644 index 6c183c0f51..0000000000 --- a/upgrade/plugins/pr1372/knora-ontologies/salsah-gui.ttl +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@prefix knora-base: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The salsah-gui ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Properties -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#guiOrder - -:guiOrder rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint owl:Restriction ; - - knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . - - - -### http://www.knora.org/ontology/salsah-gui#guiElement - -:guiElement rdf:type owl:ObjectProperty . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttribute - -:guiAttribute rdf:type owl:DatatypeProperty ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition - -:guiAttributeDefinition rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint :Guielement ; - - knora-base:objectDatatypeConstraint xsd:string . - - - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Guielement - -:Guielement rdf:type owl:Class . - - - - - -################################################################# -# -# Individuals -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Colorpicker - -:Colorpicker rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "ncolors:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Date - -:Date rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geometry - -:Geometry rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geonames - -:Geonames rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Iconclass - -# :Iconclass rdf:type :Guielement , -# owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Interval - -:Interval rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#List - -:List rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Pulldown - -:Pulldown rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Radio - -:Radio rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Richtext - -:Richtext rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Searchbox - -:Searchbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "numprops:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#SimpleText - -:SimpleText rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "size:integer" , - "maxlength:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Slider - -:Slider rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max(required):decimal" , - "min(required):decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Spinbox - -:Spinbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max:decimal" , - "min:decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Textarea - -:Textarea rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "cols:integer" , - "rows:integer" , - "width:percent" , - "wrap:string(soft|hard)" . - - -### http://www.knora.org/ontology/salsah-gui#Checkbox - -:Checkbox rdf:type :Guielement , - owl:NamedIndividual . - - -### http://www.knora.org/ontology/salsah-gui#Fileupload - -:Fileupload rdf:type :Guielement , - owl:NamedIndividual . diff --git a/upgrade/plugins/pr1372/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1372/knora-ontologies/standoff-onto.ttl deleted file mode 100644 index f5113c5028..0000000000 --- a/upgrade/plugins/pr1372/knora-ontologies/standoff-onto.ttl +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix salsah-gui: . -@base . - -@prefix : . - - rdf:type owl:Ontology ; - - rdfs:label "The standoff ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Standoff Properties -# -################################################################# - -### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType - -:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the document type"@en ; - - knora-base:subjectClassConstraint :StandoffRootTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget - -:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the target settings of a hyperlink"@en ; - - knora-base:subjectClassConstraint :StandoffHyperlinkTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -################################################################# -# -# Intermediate Standoff Tags -# -################################################################# - -### http://www.knora.org/ontology/standoff#StandoffVisualTag - -:StandoffVisualTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents visual markup information in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStructuralTag - -:StandoffStructuralTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents structural markup information in a TextValue"@en . - - -################################################################# -# -# Standoff Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/standoff#StandoffRootTag - -:StandoffRootTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffRootTagHasDocumentType ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . - -### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag - -:StandoffHyperlinkTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffUriTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffHyperlinkTagHasTarget ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a hyperlink in a text"@en . - -### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag - -:StandoffBlockquoteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section that is quoted from another source in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffCodeTag - -:StandoffCodeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section of computer source code in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffParagraphTag - -:StandoffParagraphTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a paragraph in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader1Tag - -:StandoffHeader1Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 1 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader2Tag - -:StandoffHeader2Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 2 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader3Tag - -:StandoffHeader3Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 3 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader4Tag - -:StandoffHeader4Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 4 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader5Tag - -:StandoffHeader5Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 5 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader6Tag - -:StandoffHeader6Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 6 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffOrderedListTag - -:StandoffOrderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an ordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag - -:StandoffUnorderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an unordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffListElementTag - -:StandoffListElementTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a list element in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableBodyTag - -:StandoffTableBodyTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table body in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableTag - -:StandoffTableTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableRowTag - -:StandoffTableRowTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a row in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableCellTag - -:StandoffTableCellTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a cell in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBrTag - -:StandoffBrTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a linebreak"@en . - - - -### http://www.knora.org/ontology/standoff#StandoffItalicTag - -:StandoffItalicTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents italics in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBoldTag - -:StandoffBoldTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents bold text in a TextValue"@en . - -### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag - -:StandoffCiteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents the title of a work in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnderlineTag - -:StandoffUnderlineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents underlined text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag - -:StandoffStrikethroughTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents struck text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag - -:StandoffSuperscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents superscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSubscriptTag - -:StandoffSubscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents subscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag - -:StandoffLineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a line to seperate content in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag - -:StandoffPreTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1372/test_1372.py b/upgrade/plugins/pr1372/test_1372.py deleted file mode 100644 index 5b5a1fce64..0000000000 --- a/upgrade/plugins/pr1372/test_1372.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import tempfile -import rdflib -from rdflib.term import URIRef -from plugins.pr1372.update import GraphTransformer - - -save_output = False - - -def test_update(): - input_graph = rdflib.Graph() - input_graph.parse("plugins/pr1372/test_data.ttl", format="turtle") - transformer = GraphTransformer() - output_graph = transformer.transform(input_graph) - - query_result = output_graph.query( - """ - PREFIX knora-base: - - SELECT ?value WHERE { - ?value knora-base:valueCreationDate ?creationDate ; - knora-base:hasPermissions ?permissions . - } - """ - ) - - values_with_permissions = set([row["value"] for row in query_result]) - - assert values_with_permissions == { - URIRef('http://rdfh.ch/0001/thing-with-history/values/1c'), - URIRef('http://rdfh.ch/0001/thing-with-history/values/2c'), - URIRef('http://rdfh.ch/0001/thing-with-history/values/3b') - } - - if save_output: - temp_dir = tempfile.mkdtemp() - output_file_path = temp_dir + "/output.ttl" - output_graph.serialize(destination=output_file_path, format="turtle") - print("Wrote output to", output_file_path) diff --git a/upgrade/plugins/pr1372/test_data.ttl b/upgrade/plugins/pr1372/test_data.ttl deleted file mode 100644 index b03133b098..0000000000 --- a/upgrade/plugins/pr1372/test_data.ttl +++ /dev/null @@ -1,103 +0,0 @@ -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix anything: . - - a anything:Thing; - knora-base:isDeleted false; - knora-base:attachedToUser ; - knora-base:attachedToProject ; - rdfs:label "A thing with version history"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; - knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; - anything:hasInteger ; - anything:hasText ; - anything:hasOtherThing ; - anything:hasOtherThingValue . - - a knora-base:IntValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 1; - knora-base:valueHasOrder 0; - knora-base:valueHasString "1"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser . - - a knora-base:IntValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 2; - knora-base:valueHasOrder 0; - knora-base:valueHasString "2"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:IntValue; - knora-base:valueHasUUID "pLlW4ODASumZfZFbJdpw1g"^^xsd:string; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; - knora-base:valueHasInteger 3; - knora-base:valueHasOrder 0; - knora-base:valueHasString "3"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "one"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser . - - a knora-base:TextValue; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "two"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:TextValue; - knora-base:valueHasUUID "W5fm67e0QDWxRZumcXcs6g"^^xsd:string; - knora-base:isDeleted false; - knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; - knora-base:valueHasOrder 0; - knora-base:valueHasString "three"; - knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; - knora-base:attachedToUser ; - knora-base:previousValue . - - a knora-base:LinkValue; - rdf:subject ; - rdf:predicate anything:hasOtherThing; - rdf:object ; - knora-base:isDeleted false; - knora-base:attachedToUser ; - knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; - knora-base:valueCreationDate "2019-02-10T10:30:10Z"^^xsd:dateTime; - knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; - knora-base:valueHasRefCount 1 . - - a knora-base:LinkValue; - knora-base:valueHasUUID "IZGOjVqxTfSNO4ieKyp0SA"^^xsd:string; - rdf:subject ; - rdf:predicate anything:hasOtherThing; - rdf:object ; - knora-base:isDeleted true; - knora-base:deleteDate "2019-02-13T09:00:10Z"^^xsd:dateTime; - knora-base:deletedBy ; - knora-base:attachedToUser ; - knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; - knora-base:valueCreationDate "2019-02-13T09:00:10Z"^^xsd:dateTime; - knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; - knora-base:valueHasRefCount 0; - knora-base:previousValue . diff --git a/upgrade/plugins/pr1372/update.py b/upgrade/plugins/pr1372/update.py deleted file mode 100644 index 65a751a50e..0000000000 --- a/upgrade/plugins/pr1372/update.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import rdflib -from updatelib import rdftools - - -# The IRI of knora-base:valueCreationDate. -value_creation_date = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#valueCreationDate") - -# The IRI of knora-base:previousValue. -previous_value = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#previousValue") - -# The IRI of knora-base:hasPermissions. -has_permissions = rdflib.term.URIRef("http://www.knora.org/ontology/knora-base#hasPermissions") - - -# Updates values for PR 1372. -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - # Group the statements in the named graph by subject and by predicate. - grouped_statements = rdftools.group_statements(graph) - - # Collect the IRIs of values to be transformed. - value_iris = collect_value_iris(graph, grouped_statements) - - # Remove knora-base:hasPermissions from those values. - for value_iri in value_iris: - for o in graph.objects(value_iri, has_permissions): - graph.remove((value_iri, has_permissions, o)) - - return graph - - -# Given a graph, collects the IRIs of all values that are past value versions. -def collect_value_iris(graph, grouped_statements): - value_iris = set() - - for subj, pred_objs in grouped_statements.items(): - if value_creation_date in pred_objs: - # This is a value. Is it a past value version? - if not rdftools.generator_is_empty(graph.subjects(previous_value, subj)): - # Yes. Include its IRI. - value_iris.add(subj) - - return value_iris diff --git a/upgrade/plugins/pr1440/knora-ontologies/knora-admin.ttl b/upgrade/plugins/pr1440/knora-ontologies/knora-admin.ttl deleted file mode 100644 index 3bf3c8988d..0000000000 --- a/upgrade/plugins/pr1440/knora-ontologies/knora-admin.ttl +++ /dev/null @@ -1,781 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix knora-base: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora admin ontology"@en ; - - knora-base:attachedToProject :SystemProject . - - -################################################################# -# -# Object Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#belongsToInstitution - -:belongsToInstitution rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which Institution a project belongs to."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectClassConstraint :Institution . - - - -### http://www.knora.org/ontology/knora-admin#belongsToProject - -:belongsToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates which project a group belongs to."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#currentproject - -:currentproject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "This property indicates, which is the \"current project\" of a given user. A user can be part of any number of projects, but only one can be the active project."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isInGroup - -:isInGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :UserGroup . - - - -### http://www.knora.org/ontology/knora-admin#isInProject - -:isInProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -### http://www.knora.org/ontology/knora-admin#isAdminForProject - -:isInProjectAdminGroup rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The given user is part of the given project's ProjectAdmin group."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectClassConstraint :knoraProject . - - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-admin#address - -:address rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:comment "The address of a person or an institution"@en . - - -### http://www.knora.org/ontology/knora-admin#groupName - -:groupName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The group's name."@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string ; - - rdfs:subPropertyOf . - - - -### http://www.knora.org/ontology/knora-admin#groupDescription - -:groupDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a user group"@en ; - - knora-base:subjectClassConstraint :UserGroup ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#hasSelfJoinEnabled - -:hasSelfJoinEnabled rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if users can add themselves to the project or group."@en ; - - # No knora-base:subjectClassConstraint, because this can be used with :knoraProject or :UserGroup. - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#institutionName - -:institutionName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The institutions's name."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionDescription - -:institutionDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of an institution."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#institutionWebsite - -:institutionWebsite rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The URL of a web site."@en ; - - knora-base:subjectClassConstraint :Institution ; - - knora-base:objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-admin#isActiveUser - -:isInSystemAdminGroup rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the user is a member of the SystemAdmin group."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-admin#givenName - -:givenName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:givenName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's given name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#familyName - -:familyName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf foaf:familyName, :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The user's family name."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#password - -:password rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "An encrypted credential for access"@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#phone - -:phone rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The phone number of a person, institution, etc."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#preferredLanguage - -:preferredLanguage rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The ISO 639-1 code of the user's preferred language."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectDescription - -:projectDescription rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A description of a Knora project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectKeyword - -:projectKeyword rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "A keyword describing a project."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLongname - -:projectLongname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The longname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectLogo - -:projectLogo rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the projects's logo."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewSize - -:projectRestrictedViewSize rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The size of the image (as defined by IIIF) returned for restricted view."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectRestrictedViewWatermark - -:projectRestrictedViewWatermark rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The path to the restricted view watermark."@en ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-admin#projectShortname - -:projectShortname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique shortname of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#projectShortcode - -:projectShortcode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The unique short code of a Knora project."@en ; - - rdfs:subPropertyOf ; - - knora-base:subjectClassConstraint :knoraProject ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#username - -:username rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The username and login name of a user."@en ; - - knora-base:subjectClassConstraint :User ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#email - -:email rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The email address and login name of a user."@en ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-admin#status - -:status rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "The status of the user / group / project. It is false if the entity has been deactivated (deleted)."@en ; - - knora-base:objectDatatypeConstraint xsd:boolean . - - - -################################################################# -# -# Classes -# -################################################################# - - - -### http://www.knora.org/ontology/knora-admin#Institution - -:Institution rdf:type owl:Class ; - - rdfs:subClassOf foaf:Organization , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :institutionWebsite ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :phone ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "An institution that has data in Knora."@en . - - - -### http://www.knora.org/ontology/knora-admin#User - -:User rdf:type owl:Class ; - - rdfs:subClassOf foaf:Person , - [ rdf:type owl:Restriction ; - owl:onProperty :username ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :email ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :familyName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :givenName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :password ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :preferredLanguage ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInProject ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInGroup ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isInSystemAdminGroup ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a Knora user."@en . - - - -### http://www.knora.org/ontology/knora-admin#UserGroup - -:UserGroup rdf:type owl:Class ; - - rdfs:subClassOf foaf:Group , - [ rdf:type owl:Restriction ; - owl:onProperty :groupName ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :groupDescription ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A group of Knora users."@en . - - - - -### http://www.knora.org/ontology/knora-admin#knoraProject - -:knoraProject rdf:type owl:Class ; - - rdfs:subClassOf foaf:Project , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectShortcode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLongname ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectDescription ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectKeyword ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectLogo ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewSize ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :projectRestrictedViewWatermark ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :belongsToInstitution ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :status ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasSelfJoinEnabled ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a project that uses Knora."@en . - - - - -################################################################# -# -# Individuals -# -################################################################# - -### http://www.knora.org/ontology/knora-admin#UnknownUser -:UnknownUser rdf:type :UserGroup ; - :groupName "UnknownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#KnownUser -:KnownUser rdf:type :UserGroup ; - :groupName "KnownUser" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#Creator -:Creator rdf:type :UserGroup ; - :groupName "Creator" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectMember -:ProjectMember rdf:type :UserGroup ; - :groupName "ProjectMember" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#ProjectAdmin -:ProjectAdmin rdf:type :UserGroup ; - :groupName "ProjectAdmin" ; - :status "true"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemAdmin -:SystemAdmin rdf:type :UserGroup ; - :groupName "SystemAdmin" ; - :belongsToProject :SystemProject ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemUser -:SystemUser rdf:type :User ; - rdfs:comment "A built-in system user."@en ; - :username "system"; - :email "system@localhost" ; - :givenName "Knora" ; - :familyName "System" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#AnonymousUser -:AnonymousUser rdf:type :User ; - rdfs:comment "A built-in anonymous user."@en ; - :username "anonymous" ; - :email "anonymous@localhost" ; - :givenName "Knora" ; - :familyName "Anonymous" ; - :password "-" ; - :status "true"^^xsd:boolean ; - :preferredLanguage "en" ; - :isInSystemAdminGroup "false"^^xsd:boolean . - -### http://www.knora.org/ontology/knora-admin#SystemProject -:SystemProject rdf:type :knoraProject ; - rdfs:comment "A built-in project representing the Knora System."@en ; - :projectShortname "SystemProject" ; - :projectShortcode "FFFF" ; - :projectLongname "Knora System Project" ; - :projectDescription "Knora System Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - - -### http://www.knora.org/ontology/knora-admin#SharedOntologiesProject -:DefaultSharedOntologiesProject rdf:type :knoraProject ; - rdfs:comment "The default project for shared ontologies."@en ; - :projectShortname "DefaultSharedOntologiesProject" ; - :projectShortcode "0000" ; - :projectLongname "Knora Default Shared Ontologies Project" ; - :projectDescription "Knora Shared Ontologies Project"@en ; - :status "true"^^xsd:boolean ; - :hasSelfJoinEnabled "false"^^xsd:boolean . - -# -## -### Permission Class Properties -## -# -### http://www.knora.org/ontology/knora-admin#forProject - -:forProject rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a knoraProject."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :knoraProject . - -### http://www.knora.org/ontology/knora-admin#forGroup -:forGroup rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a UserGroup."@en ; - knora-base:subjectClassConstraint :Permission ; - knora-base:objectClassConstraint :UserGroup . - -### http://www.knora.org/ontology/knora-admin#forResourceClass -:forResourceClass rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource class."@en ; - knora-base:subjectClassConstraint :Permission . - -### http://www.knora.org/ontology/knora-admin#forProperty -:forProperty rdf:type rdf:Property ; - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - rdfs:comment "Permission property pointing to a resource property."@en ; - knora-base:subjectClassConstraint :Permission . - - -# -## -### Permission Class and Sub-Classes -## -# -### http://www.knora.org/ontology/knora-admin#Permission -:Permission rdf:type owl:Class ; - rdfs:comment "Base Permission class."@en. - - -### http://www.knora.org/ontology/knora-admin#AdministrativePermission -:AdministrativePermission rdf:type owl:Class ; - rdfs:comment "Administrative Permission class used to create instances for storing administrative permissions on groups."@en ; - rdfs:subClassOf :Permission . - -### http://www.knora.org/ontology/knora-admin#DefaultObjectAccessPermission -:DefaultObjectAccessPermission rdf:type owl:Class ; - rdfs:comment "Default Object Access Permission class used to create instances for storing default object access permission for a project and either groups, resource classes, or properties."@en ; - rdfs:subClassOf :Permission . diff --git a/upgrade/plugins/pr1440/knora-ontologies/knora-base.ttl b/upgrade/plugins/pr1440/knora-ontologies/knora-base.ttl deleted file mode 100644 index 0b56cc12a6..0000000000 --- a/upgrade/plugins/pr1440/knora-ontologies/knora-base.ttl +++ /dev/null @@ -1,2721 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xml: . -@prefix xsd: . -@prefix foaf: . -@prefix dcterms: . -@prefix salsah-gui: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The Knora base ontology"@en ; - - :attachedToProject knora-admin:SystemProject ; - - :ontologyVersion "PR 1440" . - - - -################################################################# -# -# Properties -# -################################################################# - - - -### http://www.knora.org/ontology/knora-base#ontologyVersion - -:ontologyVersion rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates the version of the Knora built-in ontologies in a repository."@en ; - - :subjectClassConstraint owl:Ontology ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isMainResource - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:isMainResource rdf:type owl:DatatypeProperty ; - - rdfs:comment "Indicates if the given resource is the main resource of a request or a resource referred to by a link property."@en; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#objectCannotBeMarkedAsDeleted - -:objectCannotBeMarkedAsDeleted rdf:type rdf:Property ; - - rdfs:comment "The base property of properties whose objects can't be marked as deleted"@en . - - - -### http://www.knora.org/ontology/knora-base#objectDatatypeConstraint - -:objectDatatypeConstraint rdf:type owl:DatatypeProperty ; - - rdfs:comment "Specifies the type required as the object of a datatype property"@en . - - - -### http://www.knora.org/ontology/knora-base#resourceIcon - -:resourceIcon rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#resourceProperty - -:resourceProperty rdf:type owl:ObjectProperty ; - - rdfs:comment "The base property of properties that point from Knora resources to Knora resources or values. These properties are required to have cardinalities in the resource classes in which they are used."@en ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#subjectClassConstraint - -:subjectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the subject of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#objectClassConstraint - -:objectClassConstraint rdf:type owl:ObjectProperty ; - - rdfs:comment "Specifies the OWL class that the object of a property must belong to"@en . - - - -### http://www.knora.org/ontology/knora-base#isEditable - -:isEditable rdf:type owl:AnnotationProperty ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "is editable"@en ; - - rdfs:comment "Indicates whether a property's values can be updated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#canBeInstantiated - -:canBeInstantiated rdf:type owl:AnnotationProperty ; - - :subjectClassConstraint owl:Class ; - - :objectDatatypeConstraint xsd:boolean ; - - rdfs:label "can be instantiated"@en ; - - rdfs:comment "Indicates whether a resource class can be instantiated via the Knora API."@en . - - - -### http://www.knora.org/ontology/knora-base#attachedToProject - -:attachedToProject rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to project"@en ; - - rdfs:comment "Connects something to a project"@en ; - - :objectClassConstraint knora-admin:knoraProject . - - - -### http://www.knora.org/ontology/knora-base#attachedToUser - -:attachedToUser rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "attached to user"@en ; - - rdfs:comment "Connects something to a user"@en ; - - :objectClassConstraint knora-admin:User . - - -### http://www.knora.org/ontology/knora-base#hasColor - -:hasColor rdf:type owl:ObjectProperty ; - - rdfs:label "Farbe"@de , - "Color"@en , - "Couleur"@fr , - "Colore"@it ; - - rdfs:comment """Specifies the color of a region."""@en ; - - salsah-gui:guiAttribute "ncolors=8"^^xsd:string ; - - :objectClassConstraint :ColorValue ; - - :subjectClassConstraint :Region ; - - rdfs:subPropertyOf :hasValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Colorpicker . - - - -### http://www.knora.org/ontology/knora-base#hasComment - -:hasComment rdf:type owl:ObjectProperty ; - - rdfs:label "Kommentar"@de , - "Comment"@en , - "Commentaire"@fr , - "Commento"@it ; - - rdfs:comment """Represents a comment on a resource as a knora-base:TextValue"""@de ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :TextValue ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Richtext ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasExtResValue - -:hasExtResValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat externen Wert"@de , - "has external Value"@en , - "a valeur externe"@fr , - "ha valore esterno"@it ; - - :objectClassConstraint :ExternalResValue ; - - :subjectClassConstraint :ExternalResource ; - - rdfs:subPropertyOf :hasValue . - - -### http://www.knora.org/ontology/knora-base#hasFileValue - -:hasFileValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :FileValue ; - - rdfs:label "hat Datei"@de , - "has file"@en , - "a fichier"@fr , - "ha file"@it ; - - rdfs:comment "Connects a Representation to a file"@en ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - :subjectClassConstraint :Representation ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasStillImageFileValue - -:hasStillImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Bilddatei"@de , - "has image file"@en , - "a fichier d'image"@fr , - "ha file imagine"@it ; - - rdfs:comment "Connects a Representation to an image file"@en ; - - :objectClassConstraint :StillImageFileValue ; - - :subjectClassConstraint :StillImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasMovingImageFileValue - -:hasMovingImageFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Filmdatei"@de , - "has movie file"@en , - "a fichier de film"@fr , - "ha file film"@it ; - - rdfs:comment "Connects a Representation to a movie file"@en ; - - :objectClassConstraint :MovingImageFileValue ; - - :subjectClassConstraint :MovingImageRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasAudioFileValue - -:hasAudioFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Audiodatei"@de , - "has audio file"@en , - "a fichier d'audio"@fr , - "ha file audio"@it ; - - rdfs:comment "Connects a Representation to an audio file"@en ; - - :objectClassConstraint :AudioFileValue ; - - :subjectClassConstraint :AudioRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDDDFileValue - -:hasDDDFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat 3D-Datei"@de , - "has 3D-file"@en , - "a ficher de 3D"@fr , - "ha file 3D"@it ; - - rdfs:comment "Connects a Representation to a 3D-file"@en ; - - :objectClassConstraint :DDDFileValue ; - - :subjectClassConstraint :DDDRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasTextFileValue - -:hasTextFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Textdatei"@de , - "has text file"@en , - "a fichier de texte"@fr , - "ha file testo"@it ; - - rdfs:comment "Connects a Representation to a text file"@en ; - - :objectClassConstraint :TextFileValue ; - - :subjectClassConstraint :TextRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasDocumentFileValue - -:hasDocumentFileValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Dokument"@de , - "has document"@en , - "a document"@fr , - "ha documento"@it ; - - rdfs:comment "Connects a Representation to a document"@en ; - - :objectClassConstraint :DocumentFileValue ; - - :subjectClassConstraint :DocumentRepresentation ; - - :isEditable true ; - - salsah-gui:guiElement salsah-gui:Fileupload ; - - rdfs:subPropertyOf :hasFileValue . - - - -### http://www.knora.org/ontology/knora-base#hasGeometry - -:hasGeometry rdf:type owl:ObjectProperty ; - - rdfs:label "Geometrie"@de , - "Geometry"@en , - "Géometrie"@fr , - "Geometria"@it ; - - rdfs:comment """Represents a geometrical shape."""@en ; - - rdfs:subPropertyOf :hasValue ; - - salsah-gui:guiElement salsah-gui:Geometry ; - - :isEditable true ; - - :objectClassConstraint :GeomValue ; - - :subjectClassConstraint :Region . - - - -### http://www.knora.org/ontology/knora-base#hasLinkTo - -:hasLinkTo rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource . - - - -### http://www.knora.org/ontology/knora-base#hasLinkToValue - -:hasLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Points to a LinkValue reification describing a link between two resources"@en ; - - rdfs:label "hat Link zu"@de , - "has Link to"@en , - "a lien vers"@fr , - "ha Link verso"@it ; - - rdfs:comment "Represents a direct connection between two resources"@en ; - - :isEditable true ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasValue . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentation - -:hasRepresentation rdf:type owl:ObjectProperty ; - - rdfs:label "hat Repräsentation"@de , - "has Representation"@en , - "a Répresentation"@fr , - "ha Rappresentazione"@it ; - - rdfs:comment "References an instance of a Representation. A Representation contains the metadata of a digital object (= file) which represents some physical entity such as an image, a sound, an encoded text etc."@en ; - - :objectClassConstraint :Representation ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasRepresentationValue - -:hasRepresentationValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkTo - -:hasStandoffLinkTo rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#hasStandoffLinkToValue - -:hasStandoffLinkToValue rdf:type owl:ObjectProperty ; - - rdfs:label "hat Standoff Link zu"@de , - "has Standoff Link to"@en , - "a standoff lien vers"@fr , - "ha standoff link verso"@it ; - - rdfs:comment "Repräsentiert einen Link im Standoff Markup von einer Ressource zu einer anderen"@de , - "Represents a link in standoff markup from one resource to another."@en ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasLink - -:standoffTagHasLink rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :Resource ; - - :subjectClassConstraint :StandoffLinkTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasInternalReference - -:standoffTagHasInternalReference rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :StandoffInternalReferenceTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStart - -:standoffTagHasStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEnd - -:standoffTagHasEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartIndex - -:standoffTagHasStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndIndex - -:standoffTagHasEndIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartAncestor - -:standoffTagHasStartAncestor rdf:type owl:ObjectProperty, owl:TransitiveProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasStartParent - -:standoffTagHasStartParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted, :standoffTagHasStartAncestor ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasEndParent - -:standoffTagHasEndParent rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasUUID - -:standoffTagHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :StandoffTag ; - - :objectDatatypeConstraint xsd:string . - - -:valueHasMaxStandoffStartIndex rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#hasSubListNode - -:hasSubListNode rdf:type owl:ObjectProperty ; - - rdfs:comment "A hierarchical list is formed using the \"hasSubListNode\"-property"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectClassConstraint :ListNode ; - - :subjectClassConstraint :ListNode . - - -### http://www.knora.org/ontology/knora-base#hasValue - -:hasValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :resourceProperty ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Value . - - -### http://www.knora.org/ontology/knora-base#isAnnotationOf - -:isAnnotationOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Annotation von"@de , - "is Annotation of"@en , - "est Annotation de"@fr , - "è Annotation di"@it ; - - :subjectClassConstraint :Annotation ; - - :objectClassConstraint :Resource ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isAnnotationOfValue - -:isAnnotationOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Annotation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isPartOf - -:isPartOf rdf:type owl:ObjectProperty ; - - rdfs:label "ist Teil von"@de , - "is part of"@en , - "fait partie de"@fr , - "fa parte di"@it ; - - rdfs:comment "Indicates that this resource is part of another resource"@en ; - - :subjectClassConstraint :Resource ; - - :objectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isPartOfValue - -:isPartOfValue rdf:type owl:ObjectProperty ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Resource ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#isRegionOf - -:isRegionOf rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :subjectClassConstraint :Region ; - - :objectClassConstraint :Representation ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkTo . - - - -### http://www.knora.org/ontology/knora-base#isRegionOfValue - -:isRegionOfValue rdf:type owl:ObjectProperty ; - - rdfs:comment "Region of interest within a digital object (e.g. an image)"@en ; - - rdfs:label "is Region von"@de , - "is region of"@en , - "est région de"@fr , - "è regione di"@it ; - - :objectClassConstraint :LinkValue ; - - :subjectClassConstraint :Region ; - - :isEditable true ; - - rdfs:subPropertyOf :hasLinkToValue . - - - -### http://www.knora.org/ontology/knora-base#previousValue - -:previousValue rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "Points to the previous verson of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectClassConstraint :Value . - - - -### http://www.knora.org/ontology/knora-base#seqnum - -:seqnum rdf:type owl:ObjectProperty ; - - :objectClassConstraint :IntValue ; - - rdfs:subPropertyOf :hasValue ; - - rdfs:label "Sequenznummer"@de , - "Sequence number"@en , - "Numéro de séquence"@fr , - "Numero di sequenza"@it ; - - rdfs:comment "Indicates the position of a resource within a sequence"@en . - - -### http://www.knora.org/ontology/knora-base#standoffTagHasOriginalXMLID - -:standoffTagHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#targetHasOriginalXMLID - -# This property is generated by a SPARQL CONSTRUCT query, it is not used in the triplestore and not used in the API - -:targetHasOriginalXMLID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :StandoffTag . - - -### http://www.knora.org/ontology/knora-base#valueHasStandoff - -:valueHasStandoff rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :StandoffTag ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasLanguage - -:valueHasLanguage rdf:type owl:DatatypeProperty ; - - :objectDatatypeConstraint xsd:string ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#valueHasMapping - -:valueHasMapping rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :objectClassConstraint :XMLToStandoffMapping ; - - :subjectClassConstraint :TextValue . - - -### http://www.knora.org/ontology/knora-base#hasMappingElement - -:hasMappingElement rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "mapping element"@en ; - - rdfs:comment """Represents an element in a mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :MappingElement . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLTagname - -:mappingHasXMLTagname rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML tag"@en ; - - rdfs:comment """name of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLNamespace - -:mappingHasXMLNamespace rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "namespace of the XML tag"@en ; - - rdfs:comment """namespace of the XML tag"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLClass - -:mappingHasXMLClass rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "class of the XML tag"@en ; - - rdfs:comment """class of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffClass - -:mappingHasStandoffClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff class"@en ; - - rdfs:comment """IRI of the standoff class"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectClassConstraint owl:Class . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttribute - -:mappingHasXMLAttribute rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasXMLAttributename - -:mappingHasXMLAttributename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "name of the XML attribute"@en ; - - rdfs:comment """name of the XML attribute"""@en ; - - :subjectClassConstraint :MappingComponent ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffProperty - -:mappingHasStandoffProperty rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "IRI of the standoff property"@en ; - - rdfs:comment """IRI of the standoff property"""@en ; - - :subjectClassConstraint :MappingXMLAttribute . - - -### http://www.knora.org/ontology/knora-base#mappingHasStandoffDataTypeClass - -:mappingHasStandoffDataTypeClass rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "datatype of the XML tag"@en ; - - rdfs:comment """datatype of the XML tag"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectClassConstraint :MappingStandoffDataTypeClass . - - -### http://www.knora.org/ontology/knora-base#mappingElementRequiresSeparator - -:mappingElementRequiresSeparator rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "indicates if the element requires a separator in the text"@en ; - - rdfs:comment """indicates if the element requires a separator in the text"""@en ; - - :subjectClassConstraint :MappingElement ; - - :objectDatatypeConstraint xsd:boolean . - - -### http://www.knora.org/ontology/knora-base#mappingHasDefaultXSLTransformation - -:mappingHasDefaultXSLTransformation rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:label "default XSL Transformation"@en ; - - rdfs:comment """default XSL Transformation for this mapping"""@en ; - - :subjectClassConstraint :XMLToStandoffMapping ; - - :objectClassConstraint :XSLTransformation . - - -### http://www.knora.org/ontology/knora-base#deletedBy - -:deletedBy rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates who deleted a resource or value"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectClassConstraint knora-admin:User . - - -################################################################# -# -# Datatype properties -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#creationDate - -:creationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource was created"@en ; - - :subjectClassConstraint :Resource ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#deleteDate - -:deleteDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Indicates when a resource or value was deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:dateTime . - - -### http://www.knora.org/ontology/knora-base#dimX - -:dimX rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#dimY - -:dimY rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :FileValue ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#duration - -:duration rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#extResAccessInfo - -:extResAccessInfo rdf:type owl:DatatypeProperty ; - - rdfs:comment "Information (URL etc.) for accessing an external resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResId - -:extResId rdf:type owl:DatatypeProperty ; - - rdfs:comment "The ID of the external resource. The form of the ID is dependent on the provider."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#extResProvider - -:extResProvider rdf:type owl:DatatypeProperty ; - - rdfs:comment "The name of the external provider of the resource"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ExternalResValue ; - - :objectDatatypeConstraint xsd:string . - - - - -### http://www.knora.org/ontology/knora-base#fps - -:fps rdf:type owl:DatatypeProperty ; - - rdfs:label "Frames per second"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :MovingImageFileValue ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#internalFilename - -:internalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#internalMimeType - -:internalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#isDeleted - -:isDeleted rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - rdfs:comment "Exists and is true if the resource has been deleted"@en ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#isRootNode - -:isRootNode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#hasRootNode - -:hasRootNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint :ListNode . - - - - -### http://www.knora.org/ontology/knora-base#lastModificationDate - -:lastModificationDate rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#listNodePosition - -:listNodePosition rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#listNodeName - -:listNodeName rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :subjectClassConstraint :ListNode ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalFilename - -:originalFilename rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#originalMimeType - -:originalMimeType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :FileValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasComment - -:valueHasComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment on a value"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#deleteComment - -:deleteComment rdf:type owl:DatatypeProperty ; - - rdfs:comment "A comment explaining why a resource or value was marked as deleted"@en ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - # No :subjectClassConstraint, because this can be used with :Resource or :Value. - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueCreationDate - -:valueCreationDate rdf:type owl:DatatypeProperty ; - - :subjectClassConstraint :Value ; - - rdfs:subPropertyOf :valueHas ; - - :objectDatatypeConstraint xsd:dateTime . - - - -### http://www.knora.org/ontology/knora-base#valueHas - -:valueHas rdf:type rdf:Property ; - - :subjectClassConstraint :ValueBase ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted . - - - -### http://www.knora.org/ontology/knora-base#valueHasUUID - -:valueHasUUID rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "The UUID of a value"@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasCalendar - -:valueHasCalendar rdf:type owl:DatatypeProperty ; - - rdfs:comment "Name of the calendar to be used, such as \"GREGORIAN\" or \"JULIAN\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasColor - -:valueHasColor rdf:type owl:DatatypeProperty ; - - rdfs:comment "Color in the form of #rrggbb (as defining web colors)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ColorBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndJDN - -:valueHasEndJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the end of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasEndPrecision - -:valueHasEndPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "Precision of knowledge about the end of the date. Allowed are \"DAY\", \"MONTH\" or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasDecimal - -:valueHasDecimal rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DecimalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeometry - -:valueHasGeometry rdf:type owl:DatatypeProperty ; - - rdfs:comment "JSON string describing a geometry (e.g. a region). Currently geometries are limited to 2D unions of primitive objects like circles, squares and polygons."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeomValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasGeonameCode - -:valueHasGeonameCode rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :GeonameValue ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasInteger - -:valueHasInteger rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasBoolean - -:valueHasBoolean rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :BooleanBase ; - - :objectDatatypeConstraint xsd:boolean . - - - -### http://www.knora.org/ontology/knora-base#valueHasUri - -:valueHasUri rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :UriBase ; - - :objectDatatypeConstraint xsd:anyURI . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalEnd - -:valueHasIntervalEnd rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart - -:valueHasIntervalStart rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :IntervalBase ; - - :objectDatatypeConstraint xsd:decimal . - - - -### http://www.knora.org/ontology/knora-base#valueHasListNode - -:valueHasListNode rdf:type owl:ObjectProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :ListValue ; - - :objectClassConstraint :ListNode . - - - -### http://www.knora.org/ontology/knora-base#valueHasOrder - -:valueHasOrder rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:integer . - - -### http://www.knora.org/ontology/knora-base#valueHasRefCount - -:valueHasRefCount rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :LinkValue ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartJDN - -:valueHasStartJDN rdf:type owl:DatatypeProperty ; - - rdfs:comment "Contains the start of a date as a Julian Day Number (JDN)"@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:integer . - - - -### http://www.knora.org/ontology/knora-base#valueHasStartPrecision - -:valueHasStartPrecision rdf:type owl:DatatypeProperty ; - - rdfs:comment "The precision the start of a date. Allowed values are \"DAY\", \"MONTH\", or \"YEAR\"."@en ; - - rdfs:subPropertyOf :valueHas ; - - :subjectClassConstraint :DateBase ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#valueHasString - -:valueHasString rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :valueHas ; - - rdfs:comment "A string representation of a value, required for full-text searches and search results."@en ; - - :subjectClassConstraint :Value ; - - :objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/knora-base#hasPermissions - -:hasPermissions rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf :objectCannotBeMarkedAsDeleted ; - - :objectDatatypeConstraint xsd:string . - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#Annotation - -:Annotation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOf ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isAnnotationOfValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Annotation"@de , - "Annotation"@en , - "Annotation"@fr , - "Annotation"@it ; - - :canBeInstantiated true ; - - rdfs:comment "A generic class for representing annotations"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioFileValue - -:AudioFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an audio file"@en . - - - -### http://www.knora.org/ontology/knora-base#AudioRepresentation - -:AudioRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasAudioFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Audio)"@de , - "Representation (Audio)"@en , - "Répresentation (Audio)"@fr , - "Rappresentazione (Audio)"@it ; - - rdfs:comment "Represents a file containing audio data"@en . - - -### http://www.knora.org/ontology/knora-base#ColorBase - -:ColorBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#ColorValue - -:ColorValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :ColorBase ; - - rdfs:comment "Represents a color in HTML format, e.g. \"#33eeff\""@en . - - - -### http://www.knora.org/ontology/knora-base#DDDFileValue - -:DDDFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "This represents some 3D-object with mesh data, point cloud, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#DDDRepresentation - -:DDDRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDDDFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (3D)"@de , - "Representation (3D)"@en , - "Répresentation (3D)"@fr , - "Rappresentazione (3D)"@it ; - - rdfs:comment "Represents a file containg 3D data"@en . - - -### http://www.knora.org/ontology/knora-base#DateBase - -:DateBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasCalendar ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasEndJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartPrecision ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStartJDN ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DateValue - -:DateValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DateBase ; - - rdfs:comment "Represents a Knora date value"@en . - - - -### http://www.knora.org/ontology/knora-base#DocumentFileValue - -:DocumentFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue . - - - -### http://www.knora.org/ontology/knora-base#DocumentRepresentation - -:DocumentRepresentation rdf:type owl:Class ; - - rdfs:label "Repräsentation (Dokument)"@de , - "Representation (Document)"@en , - "Répresentation (Document)"@fr , - "Rappresentazione (Documento)"@it ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasDocumentFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResValue - -:ExternalResValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :extResId ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResProvider ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :extResAccessInfo ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ExternalResource - -:ExternalResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasExtResValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Externe Ressource"@de , - "External Resource"@en , - "Ressource Externe"@fr , - "Risorsa esterna"@it ; - - rdfs:comment "Represents a proxy for an object stored by an external provider"@en . - - - -### http://www.knora.org/ontology/knora-base#FileValue - -:FileValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :originalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :internalMimeType ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :originalFilename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#DecimalBase - -:DecimalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasDecimal ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#DecimalValue - -:DecimalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :DecimalBase ; - - rdfs:comment "Represents an arbitrary-precision decimal value"@en . - - - -### http://www.knora.org/ontology/knora-base#GeomValue - -:GeomValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeometry ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a geometrical objects as JSON string"@en . - - - -### http://www.knora.org/ontology/knora-base#GeonameValue - -:GeonameValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasGeonameCode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntBase - -:IntBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasInteger ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#IntValue - -:IntValue rdf:type owl:Class ; - - rdfs:subClassOf :Value, :IntBase ; - - rdfs:comment "Represents an integer value"@en . - -### http://www.knora.org/ontology/knora-base#BooleanBase - -:BooleanBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasBoolean ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#BooleanValue - -:BooleanValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :BooleanBase ; - - rdfs:comment "Represents a boolean value"@en . - - - -### http://www.knora.org/ontology/knora-base#UriBase - -:UriBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUri ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - -### http://www.knora.org/ontology/knora-base#UriValue - -:UriValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :UriBase ; - - rdfs:comment "Represents a URI"@en . - -### http://www.knora.org/ontology/knora-base#IntervalBase - -:IntervalBase rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasIntervalStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - -### http://www.knora.org/ontology/knora-base#IntervalValue - -:IntervalValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - :IntervalBase ; - - rdfs:comment "Represents a time interval, e.g. in an audio recording"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkObj - -:LinkObj rdf:type owl:Class ; - - rdfs:label "Verknüpfungsobjekt"@de , - "Link Object"@en , - "Objet de lien"@fr , - "Oggetto di connessione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkTo ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasLinkToValue ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "link.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Verknüpfung mehrerer Resourcen"@de , - "Represents a generic link object"@en . - - - -### http://www.knora.org/ontology/knora-base#LinkValue - -:LinkValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - rdf:Statement , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasRefCount ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:subject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:predicate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdf:object ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A reification node that describes direct links between resources"@en . - - - -### http://www.knora.org/ontology/knora-base#ListNode - -:ListNode rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :hasSubListNode ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodePosition ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :listNodeName ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasRootNode ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:comment "Represents a flat or hierarchical list"@en . - - - -### http://www.knora.org/ontology/knora-base#ListValue - -:ListValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasListNode ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#MovingImageFileValue - -:MovingImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :fps ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :duration ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a moving image file"@en . - - - -### http://www.knora.org/ontology/knora-base#MovingImageRepresentation - -:MovingImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasMovingImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Video)"@de , - "Representation (Movie)"@en , - "Répresentation (Film)"@fr , - "Rappresentazione (Film)"@it ; - - rdfs:comment "A resource containing moving image data"@en . - - - -### http://www.knora.org/ontology/knora-base#Region - -:Region rdf:type owl:Class ; - - rdfs:label "Region"@de , - "Region"@en , - "Région"@fr , - "Regione"@it ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasColor ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOf ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasGeometry ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isRegionOfValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] ; - - :resourceIcon "region.gif"^^xsd:string ; - - :canBeInstantiated true ; - - rdfs:comment "Represents a geometric region of a resource. The geometry is represented currently as JSON string."@en . - - - -### http://www.knora.org/ontology/knora-base#Representation - -:Representation rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation"@de , - "Representation"@en , - "Répresentation"@fr , - "Rappresentazione"@it ; - - rdfs:comment "A resource that can store a file"@en . - - - -### http://www.knora.org/ontology/knora-base#Resource - -:Resource rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty rdfs:label ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkTo ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStandoffLinkToValue ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToProject ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :creationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :lastModificationDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Ressource"@de , - "Resource"@en , - "Ressource"@fr , - "Risorsa"@it ; - - rdfs:comment "Represents something in the world, or an abstract thing"@en . - - -################################################################# -# -# Generic Standoff Tag -# -################################################################# - - -:standoffParentClassConstraint rdf:type owl:ObjectProperty . - - -### http://www.knora.org/ontology/knora-base#StandoffTag - -:StandoffTag rdf:type owl:Class ; - - rdfs:subClassOf [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStart ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEnd ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasUUID ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasOriginalXMLID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartIndex ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasStartParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasEndParent ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffParentClassConstraint; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a standoff markup tag"@en . - - - -################################################################# -# -# Abstract Standoff Data Type Tag -# -################################################################# - -### http://www.knora.org/ontology/knora-base#StandoffDataTypeTag - -:StandoffDataTypeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag ; - - rdfs:comment "Represents a knora-base value type in a TextValue"@en . - - -################################################################# -# -# Standoff Data Type Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/knora-base#StandoffLinkTag - -:StandoffLinkTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasLink ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a reference to a Knora resource in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffUriTag - -:StandoffUriTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag , - :UriBase ; - - rdfs:comment "Represents an arbitrary URI in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDateTag - -:StandoffDateTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DateBase ; - - rdfs:comment "Represents a date in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffColorTag - -:StandoffColorTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ColorBase ; - - rdfs:comment "Represents a color in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntegerTag - -:StandoffIntegerTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntBase ; - - rdfs:comment "Represents an integer value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffDecimalTag - -:StandoffDecimalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :DecimalBase ; - - rdfs:comment "Represents a decimal (floating point) value in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffIntervalTag - -:StandoffIntervalTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :IntervalBase ; - - rdfs:comment "Represents an interval in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffBooleanTag - -:StandoffBooleanTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :BooleanBase ; - - rdfs:comment "Represents a boolean in a TextValue"@en . - - -### http://www.knora.org/ontology/knora-base#StandoffInternalReferenceTag - -:StandoffInternalReferenceTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffDataTypeTag, - :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :standoffTagHasInternalReference ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents an internal reference in a TextValue"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageFileValue - -:StillImageFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue , - [ rdf:type owl:Restriction ; - owl:onProperty :dimY ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :dimX ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "A file containing a two-dimensional still image"@en . - - - -### http://www.knora.org/ontology/knora-base#StillImageRepresentation - -:StillImageRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasStillImageFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Bild)"@de , - "Representation (Image)"@en , - "Répresentation (Image)"@fr , - "Rappresentazione (Imagine)"@it ; - - rdfs:comment "A resource that can contain a two-dimensional still image file"@en . - - - -### http://www.knora.org/ontology/knora-base#TextFileValue - -:TextFileValue rdf:type owl:Class ; - - rdfs:subClassOf :FileValue ; - - rdfs:comment "A text file such as plain Unicode text, LaTeX, TEI/XML, etc."@en . - - - -### http://www.knora.org/ontology/knora-base#TextRepresentation - -:TextRepresentation rdf:type owl:Class ; - - rdfs:subClassOf :Representation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Repräsentation (Text)"@de , - "Representation (Text)"@en , - "Répresentation (Texte)"@fr , - "Rappresentazione (testo)"@it ; - - rdfs:comment "A resource containing a text file"@en . - - -### http://www.knora.org/ontology/knora-base#ForbiddenResource - -:ForbiddenResource rdf:type owl:Class ; - - rdfs:subClassOf :Resource , - [ rdf:type owl:Restriction ; - owl:onProperty :hasComment ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ]; - - rdfs:label """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en ; - - rdfs:comment """A ForbiddenResource is a proxy for a resource that the client has insufficient permissions to see."""@en . - -### http://www.knora.org/ontology/knora-base#XSLTransformation - -:XSLTransformation rdf:type owl:Class ; - - rdfs:subClassOf :TextRepresentation , - [ rdf:type owl:Restriction ; - owl:onProperty :hasTextFileValue ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en ; - - rdfs:comment "a TextRepresentation representing an XSL transformation that can be applied to an XML created from standoff. The transformation's result is ecptected to be HTML."@en . - - -### http://www.knora.org/ontology/knora-base#MappingComponent - -:MappingComponent rdf:type owl:Class ; - - rdfs:label "Component of a mapping"@en ; - - rdfs:comment "Component of a mapping" . - - -### http://www.knora.org/ontology/knora-base#MappingStandoffDataTypeClass - -:MappingStandoffDataTypeClass rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingXMLAttribute - -:MappingXMLAttribute rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttributename ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffProperty ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML attributes to standoff properties"@en ; - - rdfs:comment "Mapping from XML attributes to standoff properties" . - - -### http://www.knora.org/ontology/knora-base#MappingElement - -:MappingElement rdf:type owl:Class ; - - rdfs:subClassOf :MappingComponent , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLTagname ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLNamespace ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffClass ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasXMLAttribute ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasStandoffDataTypeClass ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :mappingElementRequiresSeparator ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ]; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#XMLToStandoffMapping - -:XMLToStandoffMapping rdf:type owl:Class ; - - rdfs:subClassOf - [ rdf:type owl:Restriction ; - owl:onProperty :hasMappingElement ; - owl:minCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :mappingHasDefaultXSLTransformation ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:label "Mapping from XML to standoff entities"@en ; - - rdfs:comment "Mapping from XML to standoff entities" . - -### http://www.knora.org/ontology/knora-base#TextValue - -:TextValue rdf:type owl:Class ; - - rdfs:subClassOf :Value , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasStandoff ; - owl:minCardinality "0"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMaxStandoffStartIndex ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasLanguage ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ], - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasMapping ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] . - - - -### http://www.knora.org/ontology/knora-base#ValueBase - -:ValueBase rdf:type owl:Class . - - -### http://www.knora.org/ontology/knora-base#Value - -:Value rdf:type owl:Class ; - - rdfs:subClassOf :ValueBase, - [ rdf:type owl:Restriction ; - owl:onProperty :valueCreationDate ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :attachedToUser ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :hasPermissions ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasOrder ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :isDeleted ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteDate ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deletedBy ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :deleteComment ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :previousValue ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasString ; - owl:cardinality "1"^^xsd:nonNegativeInteger - ] , - [ rdf:type owl:Restriction ; - owl:onProperty :valueHasUUID ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - - rdfs:comment "The base class of classes representing Knora values"@en . diff --git a/upgrade/plugins/pr1440/knora-ontologies/salsah-gui.ttl b/upgrade/plugins/pr1440/knora-ontologies/salsah-gui.ttl deleted file mode 100644 index 6c183c0f51..0000000000 --- a/upgrade/plugins/pr1440/knora-ontologies/salsah-gui.ttl +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix : . -@prefix owl: . -@prefix rdf: . -@prefix xml: . -@prefix xsd: . -@prefix rdfs: . -@prefix knora-base: . -@prefix knora-admin: . -@base . - - rdf:type owl:Ontology ; - - rdfs:label "The salsah-gui ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Properties -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#guiOrder - -:guiOrder rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint owl:Restriction ; - - knora-base:objectDatatypeConstraint xsd:nonNegativeInteger . - - - -### http://www.knora.org/ontology/salsah-gui#guiElement - -:guiElement rdf:type owl:ObjectProperty . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttribute - -:guiAttribute rdf:type owl:DatatypeProperty ; - - knora-base:objectDatatypeConstraint xsd:string . - - - -### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition - -:guiAttributeDefinition rdf:type owl:DatatypeProperty ; - - knora-base:subjectClassConstraint :Guielement ; - - knora-base:objectDatatypeConstraint xsd:string . - - - - - -################################################################# -# -# Classes -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Guielement - -:Guielement rdf:type owl:Class . - - - - - -################################################################# -# -# Individuals -# -################################################################# - - -### http://www.knora.org/ontology/salsah-gui#Colorpicker - -:Colorpicker rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "ncolors:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Date - -:Date rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geometry - -:Geometry rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Geonames - -:Geonames rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Iconclass - -# :Iconclass rdf:type :Guielement , -# owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Interval - -:Interval rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#List - -:List rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Pulldown - -:Pulldown rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Radio - -:Radio rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "hlist(required):iri" . - - - -### http://www.knora.org/ontology/salsah-gui#Richtext - -:Richtext rdf:type :Guielement , - owl:NamedIndividual . - - - -### http://www.knora.org/ontology/salsah-gui#Searchbox - -:Searchbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "numprops:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#SimpleText - -:SimpleText rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "size:integer" , - "maxlength:integer" . - - - -### http://www.knora.org/ontology/salsah-gui#Slider - -:Slider rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max(required):decimal" , - "min(required):decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Spinbox - -:Spinbox rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "max:decimal" , - "min:decimal" . - - - -### http://www.knora.org/ontology/salsah-gui#Textarea - -:Textarea rdf:type :Guielement , - owl:NamedIndividual ; - - :guiAttributeDefinition "cols:integer" , - "rows:integer" , - "width:percent" , - "wrap:string(soft|hard)" . - - -### http://www.knora.org/ontology/salsah-gui#Checkbox - -:Checkbox rdf:type :Guielement , - owl:NamedIndividual . - - -### http://www.knora.org/ontology/salsah-gui#Fileupload - -:Fileupload rdf:type :Guielement , - owl:NamedIndividual . diff --git a/upgrade/plugins/pr1440/knora-ontologies/standoff-data.ttl b/upgrade/plugins/pr1440/knora-ontologies/standoff-data.ttl deleted file mode 100644 index b449590294..0000000000 --- a/upgrade/plugins/pr1440/knora-ontologies/standoff-data.ttl +++ /dev/null @@ -1,631 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix salsah-gui: . -@prefix standoff: . - - a knora-base:XMLToStandoffMapping ; - rdfs:label "mapping for HTML"@en ; - knora-base:hasMappingElement - , - , - , - , - , - , - , - , - , - , - , - - #### additional elements - - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffRootTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingHasXMLTagname "text"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLAttribute . - - - a knora-base:MappingXMLAttribute ; - knora-base:mappingHasStandoffProperty standoff:standoffRootTagHasDocumentType ; - knora-base:mappingHasXMLAttributename "documentType"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffParagraphTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "p"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffItalicTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "em"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffBoldTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "strong"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffUnderlineTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "u"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffSubscriptTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "sub"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffSuperscriptTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "sup"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffStrikethroughTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "strike"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass knora-base:StandoffUriTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "a"^^xsd:string ; - knora-base:mappingHasStandoffDataTypeClass . - - - a knora-base:MappingStandoffDataTypeClass ; - knora-base:mappingHasStandoffClass knora-base:StandoffUriTag ; - knora-base:mappingHasXMLAttributename "href"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass knora-base:StandoffLinkTag ; - knora-base:mappingHasXMLClass "salsah-link" ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "a"^^xsd:string ; - knora-base:mappingHasStandoffDataTypeClass . - - - a knora-base:MappingStandoffDataTypeClass ; - knora-base:mappingHasStandoffClass knora-base:StandoffLinkTag ; - knora-base:mappingHasXMLAttributename "href"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass knora-base:StandoffInternalReferenceTag ; - knora-base:mappingHasXMLClass "internal-link" ; - knora-base:mappingHasXMLNamespace "noNamespace" ; - knora-base:mappingElementRequiresSeparator false ; - knora-base:mappingHasXMLTagname "a" ; - knora-base:mappingHasStandoffDataTypeClass . - - - a knora-base:MappingStandoffDataTypeClass ; - knora-base:mappingHasStandoffClass knora-base:StandoffInternalReferenceTag ; - knora-base:mappingHasXMLAttributename "href" . - - -###################### additional elements - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader1Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "h1"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader2Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "h2"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader3Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingHasXMLTagname "h3"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader4Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "h4"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader5Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "h5"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffHeader6Tag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "h6"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffOrderedListTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "ol"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffUnorderedListTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "ul"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffListElementTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "li"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffTableTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "table"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffTableBodyTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "tbody"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffTableRowTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "tr"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffTableCellTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "td"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffBrTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "br"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffLineTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingHasXMLTagname "hr"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffPreTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingHasXMLTagname "pre"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffCiteTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingHasXMLTagname "cite"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffBlockquoteTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "blockquote"^^xsd:string . - - - a knora-base:MappingElement ; - knora-base:mappingHasStandoffClass standoff:StandoffCodeTag ; - knora-base:mappingHasXMLClass "noClass"^^xsd:string ; - knora-base:mappingHasXMLNamespace "noNamespace"^^xsd:string ; - knora-base:mappingElementRequiresSeparator true ; - knora-base:mappingHasXMLTagname "code"^^xsd:string . - -### TEI Mapping for standard standoff tags - - a knora-base:XMLToStandoffMapping ; - rdfs:label "mapping for TEI"@en . - - . - - a ; - "text" ; - "noNamespace" ; - "noClass" ; - ; - . - - a ; - "noNamespace" ; - "documentType" ; - . - - "false"^^xsd:boolean . - - . - - a ; - "entity" ; - "noNamespace" ; - "noClass" ; - ; - . - - a ; - ; - "ref" . - - "false"^^xsd:boolean . - - . - - a ; - "a" ; - "noNamespace" ; - "noClass" ; - ; - . - - a ; - ; - "href" . - - "false"^^xsd:boolean . - - . - - a ; - "ref" ; - "noNamespace" ; - "noClass" ; - ; - . - - a ; - ; - "target" . - - "false"^^xsd:boolean . - - . - - a ; - "quote" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "code" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "p" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header1" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header2" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header3" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header4" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header5" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "header6" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "ol" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "ul" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "listitem" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "table" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "tablebody" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "row" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "cell" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "br" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "cite" ; - "noNamespace" ; - "noClass" ; - ; - "true"^^xsd:boolean . - - . - - a ; - "em" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "b" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "u" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "strike" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "sup" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "sub" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "line" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . - - . - - a ; - "pre" ; - "noNamespace" ; - "noClass" ; - ; - "false"^^xsd:boolean . diff --git a/upgrade/plugins/pr1440/knora-ontologies/standoff-onto.ttl b/upgrade/plugins/pr1440/knora-ontologies/standoff-onto.ttl deleted file mode 100644 index f5113c5028..0000000000 --- a/upgrade/plugins/pr1440/knora-ontologies/standoff-onto.ttl +++ /dev/null @@ -1,356 +0,0 @@ -# Copyright © 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - -@prefix xml: . -@prefix xsd: . -@prefix rdf: . -@prefix rdfs: . -@prefix owl: . -@prefix foaf: . -@prefix knora-base: . -@prefix knora-admin: . -@prefix salsah-gui: . -@base . - -@prefix : . - - rdf:type owl:Ontology ; - - rdfs:label "The standoff ontology"@en ; - - knora-base:attachedToProject knora-admin:SystemProject . - - -################################################################# -# -# Standoff Properties -# -################################################################# - -### http://www.knora.org/ontology/standoff#standoffRootTagHasDocumentType - -:standoffRootTagHasDocumentType rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the document type"@en ; - - knora-base:subjectClassConstraint :StandoffRootTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -### http://www.knora.org/ontology/standoff#standoffHyperlinkTagHasTarget - -:standoffHyperlinkTagHasTarget rdf:type owl:DatatypeProperty ; - - rdfs:subPropertyOf knora-base:objectCannotBeMarkedAsDeleted ; - - rdfs:comment "describes the target settings of a hyperlink"@en ; - - knora-base:subjectClassConstraint :StandoffHyperlinkTag ; - - knora-base:objectDatatypeConstraint xsd:string . - - -################################################################# -# -# Intermediate Standoff Tags -# -################################################################# - -### http://www.knora.org/ontology/standoff#StandoffVisualTag - -:StandoffVisualTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents visual markup information in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStructuralTag - -:StandoffStructuralTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag ; - - rdfs:comment "Represents structural markup information in a TextValue"@en . - - -################################################################# -# -# Standoff Tags that can be instantiated -# -################################################################# - - -### http://www.knora.org/ontology/standoff#StandoffRootTag - -:StandoffRootTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffRootTagHasDocumentType ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents the root node if the TextValue has been created from XML"@en . - -### http://www.knora.org/ontology/standoff#StandoffHyperlinkTag - -:StandoffHyperlinkTag rdf:type owl:Class ; - - rdfs:subClassOf knora-base:StandoffUriTag , - [ rdf:type owl:Restriction ; - owl:onProperty :standoffHyperlinkTagHasTarget ; - owl:maxCardinality "1"^^xsd:nonNegativeInteger - ] ; - - rdfs:comment "Represents a hyperlink in a text"@en . - -### http://www.knora.org/ontology/standoff#StandoffBlockquoteTag - -:StandoffBlockquoteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section that is quoted from another source in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffCodeTag - -:StandoffCodeTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a section of computer source code in a text"@en . - - -### http://www.knora.org/ontology/standoff#StandoffParagraphTag - -:StandoffParagraphTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a paragraph in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader1Tag - -:StandoffHeader1Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 1 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader2Tag - -:StandoffHeader2Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 2 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader3Tag - -:StandoffHeader3Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 3 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader4Tag - -:StandoffHeader4Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 4 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader5Tag - -:StandoffHeader5Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 5 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffHeader6Tag - -:StandoffHeader6Tag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a header of level 6 in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffOrderedListTag - -:StandoffOrderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an ordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnorderedListTag - -:StandoffUnorderedListTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents an unordered list in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffListElementTag - -:StandoffListElementTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a list element in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableBodyTag - -:StandoffTableBodyTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table body in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableTag - -:StandoffTableTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a table in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableRowTag - -:StandoffTableRowTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a row in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffTableCellTag - -:StandoffTableCellTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a cell in a table"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBrTag - -:StandoffBrTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents a linebreak"@en . - - - -### http://www.knora.org/ontology/standoff#StandoffItalicTag - -:StandoffItalicTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents italics in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffBoldTag - -:StandoffBoldTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents bold text in a TextValue"@en . - -### http://www.knora.org/ontology/standoff-html-editor#StandoffCiteTag - -:StandoffCiteTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffStructuralTag ; - - rdfs:comment "Represents the title of a work in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffUnderlineTag - -:StandoffUnderlineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents underlined text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffStrikethroughTag - -:StandoffStrikethroughTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents struck text in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSuperscriptTag - -:StandoffSuperscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents superscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff#StandoffSubscriptTag - -:StandoffSubscriptTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents subscript in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffLineTag - -:StandoffLineTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a line to seperate content in a TextValue"@en . - - -### http://www.knora.org/ontology/standoff-html-editor#StandoffPreTag - -:StandoffPreTag rdf:type owl:Class ; - - rdfs:subClassOf :StandoffVisualTag ; - - rdfs:comment "Represents a preformatted content in a TextValue"@en . diff --git a/upgrade/plugins/pr1440/update.py b/upgrade/plugins/pr1440/update.py deleted file mode 100644 index db6f636b60..0000000000 --- a/upgrade/plugins/pr1440/update.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -from updatelib import rdftools - - -class GraphTransformer(rdftools.GraphTransformer): - def transform(self, graph): - # Nothing to do, because this plugin only updates the built-in ontologies. - return graph diff --git a/upgrade/src/main/scala/org.knora.upgrade/Main.scala b/upgrade/src/main/scala/org.knora.upgrade/Main.scala new file mode 100644 index 0000000000..fd6da9249a --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/Main.scala @@ -0,0 +1,260 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade + +import java.io._ + +import org.eclipse.rdf4j.model.impl.{LinkedHashModel, SimpleValueFactory} +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.{Model, Statement} +import org.eclipse.rdf4j.rio.helpers.StatementCollector +import org.eclipse.rdf4j.rio.{RDFFormat, RDFParser, Rio} +import org.knora.upgrade.plugins._ +import org.knora.webapi.util.{Debug, FileUtil} +import org.knora.webapi.util.JavaUtil._ +import org.knora.webapi.{InconsistentTriplestoreDataException, OntologyConstants} +import org.rogach.scallop._ + +import scala.collection.JavaConverters._ +import scala.io.{BufferedSource, Codec, Source} + + +/** + * Updates a dump of a Knora repository to accommodate changes in Knora. + */ +object Main extends App { + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * A list of all plugins in chronological order. + */ + val pluginsForVersions: Seq[PluginForKnoraBaseVersion] = Seq( + PluginForKnoraBaseVersion(versionNumber = 1, plugin = new UpgradePluginPR1307, prBasedVersionString = Some("PR 1307")), + PluginForKnoraBaseVersion(versionNumber = 2, plugin = new UpgradePluginPR1322, prBasedVersionString = Some("PR 1322")), + PluginForKnoraBaseVersion(versionNumber = 3, plugin = new UpgradePluginPR1367, prBasedVersionString = Some("PR 1367")), + PluginForKnoraBaseVersion(versionNumber = 4, plugin = new UpgradePluginPR1372, prBasedVersionString = Some("PR 1372")), + PluginForKnoraBaseVersion(versionNumber = 5, plugin = new NoopPlugin, prBasedVersionString = Some("PR 1440")), + PluginForKnoraBaseVersion(versionNumber = 6, plugin = new NoopPlugin) // PR 1403 + ) + + /** + * The built-in named graphs that are always updated when there is a new version of knora-base. + */ + val builtInNamedGraphs: Set[BuiltInNamedGraph] = Set( + BuiltInNamedGraph( + filename = "knora-ontologies/knora-admin.ttl", + iri = "http://www.knora.org/ontology/knora-admin" + ), + BuiltInNamedGraph( + filename = "knora-ontologies/knora-base.ttl", + iri = "http://www.knora.org/ontology/knora-base" + ), + BuiltInNamedGraph( + filename = "knora-ontologies/salsah-gui.ttl", + iri = "http://www.knora.org/ontology/salsah-gui" + ), + BuiltInNamedGraph( + filename = "knora-ontologies/standoff-onto.ttl", + iri = "http://www.knora.org/ontology/standoff" + ), + BuiltInNamedGraph( + filename = "knora-ontologies/standoff-data.ttl", + iri = "http://www.knora.org/data/standoff" + ) + ) + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Represents an update plugin with its knora-base version number and version string. + * + * @param versionNumber the knora-base version number that the plugin's transformation produces. + * @param plugin the plugin. + * @param prBasedVersionString the plugin's PR-based version string (not used for new plugins). + */ + case class PluginForKnoraBaseVersion(versionNumber: Int, plugin: UpgradePlugin, prBasedVersionString: Option[String] = None) { + lazy val versionString: String = { + prBasedVersionString match { + case Some(str) => str + case None => s"knora-base v$versionNumber" + } + } + } + + /** + * Represents a Knora built-in named graph. + * + * @param filename the filename containing the named graph. + * @param iri the IRI of the named graph. + */ + case class BuiltInNamedGraph(filename: String, iri: String) + + // Debug.printResources(builtInNamedGraphs.map(_.filename).toSeq) + + /** + * Constructs RDF4J values. + */ + val valueFactory = SimpleValueFactory.getInstance + + /** + * A map of version strings to plugins. + */ + val pluginsForVersionsMap: Map[String, PluginForKnoraBaseVersion] = pluginsForVersions.map { + knoraBaseVersion => knoraBaseVersion.versionString -> knoraBaseVersion + }.toMap + + // Parse the command-line arguments. + val conf = new TransformDataConf(args) + val inputFile = new File(conf.input()) + val outputFile = new File(conf.output()) + + // Parse the input file. + println("Reading input file...") + val model = readFileIntoModel(inputFile, RDFFormat.TRIG) + println(s"Read ${model.size} statements.") + + // Get the repository's version string, if any. + val maybeRepositoryVersionString: Option[String] = Models.getPropertyLiteral( + model, + valueFactory.createIRI(OntologyConstants.KnoraBase.KnoraBaseOntologyIri), + valueFactory.createIRI(OntologyConstants.KnoraBase.OntologyVersion) + ).toOption.map(_.stringValue) + + // Is the repository up to date? + if (maybeRepositoryVersionString.contains(org.knora.webapi.KnoraBaseVersion)) { + // Yes. Nothing more to do. + println(s"Repository is up to date at version ${org.knora.webapi.KnoraBaseVersion}.") + } else { + // No. Construct the list of updates that it needs. + val pluginsForNeededUpdates: Seq[PluginForKnoraBaseVersion] = maybeRepositoryVersionString match { + case Some(repositoryVersion) => + // The repository has a version string. Get the plugins for all subsequent versions. + val pluginForRepositoryVersion: PluginForKnoraBaseVersion = pluginsForVersionsMap.getOrElse( + repositoryVersion, + throw InconsistentTriplestoreDataException(s"No such repository version $repositoryVersion") + ) + + pluginsForVersions.filter(_.versionNumber > pluginForRepositoryVersion.versionNumber) + + case None => + // The repository has no version string. Include all updates. + pluginsForVersions + } + + println(s"Needed transformations: ${pluginsForNeededUpdates.map(_.versionString).mkString(", ")}") + + // Run the update plugins. + for (pluginForNeededUpdate <- pluginsForNeededUpdates) { + println(s"Running transformation for ${pluginForNeededUpdate.versionString}...") + pluginForNeededUpdate.plugin.transform(model) + } + + // Update the built-in named graphs. + + println("Updating built-in named graphs...") + + for (builtInNamedGraph <- builtInNamedGraphs) { + val context = valueFactory.createIRI(builtInNamedGraph.iri) + model.remove(null, null, null, context) + + val namedGraphModel: Model = readResourceIntoModel(builtInNamedGraph.filename, RDFFormat.TURTLE) + + // Set the context on each statement. + for (statement: Statement <- namedGraphModel.asScala.toSet) { + namedGraphModel.remove( + statement.getSubject, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + namedGraphModel.add( + statement.getSubject, + statement.getPredicate, + statement.getObject, + context + ) + } + + model.addAll(namedGraphModel) + } + + // Write the output file. + println(s"Writing output file (${model.size} statements)...") + val fileWriter = new FileWriter(outputFile) + val bufferedWriter = new BufferedWriter(fileWriter) + Rio.write(model, fileWriter, RDFFormat.TRIG) + bufferedWriter.close() + fileWriter.close() + } + + /** + * Reads an RDF file into a [[Model]]. + * + * @param file the file. + * @param format the file format. + * @return a [[Model]] representing the contents of the file. + */ + def readFileIntoModel(file: File, format: RDFFormat): Model = { + val fileReader = new FileReader(file) + val bufferedReader = new BufferedReader(fileReader) + val model = new LinkedHashModel() + val trigParser: RDFParser = Rio.createParser(format) + trigParser.setRDFHandler(new StatementCollector(model)) + trigParser.parse(bufferedReader, "") + fileReader.close() + bufferedReader.close() + model + } + + /** + * Reads a file from the CLASSPATH into a [[Model]]. + * + * @param filename the filename. + * @param format the file format. + * @return a [[Model]] representing the contents of the file. + */ + def readResourceIntoModel(filename: String, format: RDFFormat): Model = { + val fileContent: String = FileUtil.readTextResource(filename) + val stringReader = new StringReader(fileContent) + val model = new LinkedHashModel() + val trigParser: RDFParser = Rio.createParser(format) + trigParser.setRDFHandler(new StatementCollector(model)) + trigParser.parse(stringReader, "") + model + } + + /** + * Parses command-line arguments. + */ + class TransformDataConf(arguments: Seq[String]) extends ScallopConf(arguments) { + banner( + s""" + |Updates a dump of a repository to accommodate changes in Knora. + | + |Usage: org.knora.webapi.util.UpdateRepository input output + """.stripMargin) + + val input: ScallopOption[String] = trailArg[String](required = true, descr = "Input TriG file") + val output: ScallopOption[String] = trailArg[String](required = true, descr = "Output TriG file") + verify() + } + +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/UpgradePlugin.scala b/upgrade/src/main/scala/org.knora.upgrade/UpgradePlugin.scala new file mode 100644 index 0000000000..2c4093a3dd --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/UpgradePlugin.scala @@ -0,0 +1,34 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade + +import org.eclipse.rdf4j.model.Model + +/** + * A trait for plugins that update a repository. + */ +trait UpgradePlugin { + /** + * Transforms a repository. + * + * @param model a [[Model]] containing the repository data. + */ + def transform(model: Model): Unit +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/plugins/NoopPlugin.scala b/upgrade/src/main/scala/org.knora.upgrade/plugins/NoopPlugin.scala new file mode 100644 index 0000000000..3317622074 --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/plugins/NoopPlugin.scala @@ -0,0 +1,30 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.Model +import org.knora.upgrade.UpgradePlugin + +/** + * An update plugin that does nothing. Used for updates in which only the built-in named graphs have changed. + */ +class NoopPlugin extends UpgradePlugin { + override def transform(model: Model): Unit = {} +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1307.scala b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1307.scala new file mode 100644 index 0000000000..a289b6702e --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1307.scala @@ -0,0 +1,197 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.vocabulary.RDF +import org.eclipse.rdf4j.model.{IRI, Model, Statement, Value} +import org.knora.upgrade.UpgradePlugin +import org.knora.webapi.util.JavaUtil._ +import org.knora.webapi.{InconsistentTriplestoreDataException, OntologyConstants} + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1307. + */ +class UpgradePluginPR1307 extends UpgradePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val TextValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.TextValue) + private val ValueHasStandoffIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasStandoff) + private val StandoffTagHasStartIndexIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasStartIndex) + private val StandoffTagHasStartParentIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasStartParent) + private val StandoffTagHasEndParentIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasEndParent) + private val ValueHasMaxStandoffStartIndexIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasMaxStandoffStartIndex) + + /** + * Represents a standoff tag to be transformed. + * + * @param oldIri the tag's old IRI. + * @param statements the statements about the tag. + */ + case class StandoffRdf(oldIri: IRI, statements: Model) { + /** + * The value of knora-base:standoffTagHasStartIndex. + */ + val startIndex: Int = Models.getPropertyLiteral(statements, oldIri, StandoffTagHasStartIndexIri).toOption match { + case Some(index) => index.intValue + case None => throw InconsistentTriplestoreDataException(s"$oldIri has no knora-base:standoffTagHasStartIndex") + } + + /** + * The tag's new IRI. + */ + lazy val newIri: IRI = { + val oldSubjStr: String = oldIri.stringValue + val slashPos: Int = oldSubjStr.lastIndexOf('/') + valueFactory.createIRI(oldSubjStr.substring(0, slashPos + 1) + startIndex.toString) + } + + def transform(model: Model, standoff: Map[IRI, StandoffRdf]): Unit = { + for (statement: Statement <- statements.asScala.toSet) { + // Change statements with knora-base:standoffTagHasStartParent and knora-base:standoffTagHasEndParent to point + // to the new IRIs of those tags. + val newStatementObj: Value = if (statement.getPredicate == StandoffTagHasStartParentIri || statement.getPredicate == StandoffTagHasEndParentIri) { + val targetTagOldIri: IRI = valueFactory.createIRI(statement.getObject.stringValue) + standoff(targetTagOldIri).newIri + } else { + statement.getObject + } + + // Remove each statement that uses this tag's old IRI. + model.remove( + oldIri, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + // Replace it with a statement that uses this tag's new IRI. + model.add( + newIri, + statement.getPredicate, + newStatementObj, + statement.getContext + ) + } + } + } + + /** + * Represents a `knora-base:TextValue` to be transformed. + * + * @param iri the text value's IRI. + * @param context the text value's context. + * @param valueHasStandoffStatements the statements whose subject is the text value and whose predicate is + * `knora-base:valueHasStandoff`. + * @param standoff the standoff tags attached to this text value, as a map of old standoff tag IRIs to + * [[StandoffRdf]] objects. + */ + case class TextValueRdf(iri: IRI, context: IRI, valueHasStandoffStatements: Model, standoff: Map[IRI, StandoffRdf]) { + def transform(model: Model): Unit = { + // Transform the text value's standoff tags. + for (standoffTag <- standoff.values) { + standoffTag.transform(model = model, standoff = standoff) + } + + if (standoff.nonEmpty) { + for (statement: Statement <- valueHasStandoffStatements.asScala.toSet) { + // Replace each statement in valueHasStandoffStatements with one that points to the standoff + // tag's new IRI. + + val targetTagOldIri: IRI = valueFactory.createIRI(statement.getObject.stringValue) + val targetTagNewIri: IRI = standoff(targetTagOldIri).newIri + + model.remove( + iri, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + model.add( + iri, + statement.getPredicate, + targetTagNewIri, + statement.getContext + ) + } + + // Add a statement to the text value with the predicate knora-base:valueHasMaxStandoffStartIndex. + model.add( + iri, + ValueHasMaxStandoffStartIndexIri, + valueFactory.createLiteral(new java.math.BigInteger(standoff.values.map(_.startIndex).max.toString)), + context + ) + } + } + } + + override def transform(model: Model): Unit = { + for (textValue <- collectTextValues(model)) { + textValue.transform(model) + } + } + + /** + * Collects the text values and standoff tags in the repository. + */ + private def collectTextValues(model: Model): Vector[TextValueRdf] = { + // Pairs of text value IRI and text value context. + val textValueSubjectsAndContexts: Vector[(IRI, IRI)] = model.filter(null, RDF.TYPE, TextValueIri).asScala.map { + statement => + (valueFactory.createIRI(statement.getSubject.stringValue), valueFactory.createIRI(statement.getContext.stringValue)) + }.toVector + + textValueSubjectsAndContexts.map { + case (textValueSubj: IRI, textValueContext: IRI) => + // Get the statements about the text value. + val textValueStatements: Model = model.filter(textValueSubj, null, null) + + // Get the statements whose subject is the text value and whose predicate is knora-base:valueHasStandoff. + val valueHasStandoffStatements: Model = textValueStatements.filter(null, ValueHasStandoffIri, null) + + // Get the IRIs of the text value's standoff tags. + val standoffSubjects: Set[IRI] = valueHasStandoffStatements.objects.asScala.map { + value => valueFactory.createIRI(value.stringValue) + }.toSet + + // Make a map of standoff IRIs to StandoffRdf objects. + val standoff: Map[IRI, StandoffRdf] = standoffSubjects.map { + standoffSubj: IRI => + standoffSubj -> StandoffRdf( + oldIri = standoffSubj, + statements = model.filter(standoffSubj, null, null) + ) + }.toMap + + TextValueRdf( + iri = textValueSubj, + context = textValueContext, + valueHasStandoffStatements = valueHasStandoffStatements, + standoff = standoff + ) + } + } +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1322.scala b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1322.scala new file mode 100644 index 0000000000..efd7166df4 --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1322.scala @@ -0,0 +1,63 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Model, Resource} +import org.knora.webapi.OntologyConstants +import org.knora.upgrade.UpgradePlugin +import org.knora.webapi.util.StringFormatter + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1322. + */ +class UpgradePluginPR1322 extends UpgradePlugin { + private val valueFactory = SimpleValueFactory.getInstance + private implicit val stringFormatter: StringFormatter = StringFormatter.getInstanceForConstantOntologies + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val ValueHasUUIDIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasUUID) + private val ValueCreationDateIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.ValueCreationDate) + private val PreviousValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.PreviousValue) + + override def transform(model: Model): Unit = { + // Add a random UUID to each current value version. + for (valueIri: IRI <- collectCurrentValueIris(model)) { + model.add( + valueIri, + ValueHasUUIDIri, + valueFactory.createLiteral(stringFormatter.makeRandomBase64EncodedUuid) + ) + } + } + + /** + * Collects the IRIs of all values that are current value versions. + */ + private def collectCurrentValueIris(model: Model): Set[IRI] = { + model.filter(null, ValueCreationDateIri, null).subjects.asScala.toSet.filter { + resource: Resource => model.filter(null, PreviousValueIri, resource).asScala.toSet.isEmpty + }.map { + resource: Resource => valueFactory.createIRI(resource.stringValue) + } + } +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1367.scala b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1367.scala new file mode 100644 index 0000000000..3f0783c652 --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1367.scala @@ -0,0 +1,62 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Literal, Model, Statement} +import org.knora.upgrade.UpgradePlugin + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1367. + */ +class UpgradePluginPR1367 extends UpgradePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val XsdValueHasDecimalIri: IRI = valueFactory.createIRI("http://www.w3.org/2001/XMLSchema#valueHasDecimal") + + override def transform(model: Model): Unit = { + // Fix the datatypes of decimal literals. + for (statement: Statement <- model.asScala.toSet) { + statement.getObject match { + case literal: Literal => + if (literal.getDatatype == XsdValueHasDecimalIri) { + model.remove( + statement.getSubject, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + model.add( + statement.getSubject, + statement.getPredicate, + valueFactory.createLiteral(BigDecimal(statement.getObject.stringValue).underlying), + statement.getContext + ) + } + + case _ => () + } + } + } +} diff --git a/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1372.scala b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1372.scala new file mode 100644 index 0000000000..f6eb977ef8 --- /dev/null +++ b/upgrade/src/main/scala/org.knora.upgrade/plugins/UpgradePluginPR1372.scala @@ -0,0 +1,61 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Model, Resource} +import org.knora.webapi.OntologyConstants +import org.knora.upgrade.UpgradePlugin + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1372. + */ +class UpgradePluginPR1372 extends UpgradePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val ValueCreationDateIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.ValueCreationDate) + private val PreviousValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.PreviousValue) + private val HasPermissionsIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.HasPermissions) + + override def transform(model: Model): Unit = { + // Remove knora-base:hasPermissions from all past value versions. + for (valueIri: IRI <- collectPastValueIris(model)) { + model.remove( + valueIri, + HasPermissionsIri, + null + ) + } + } + + /** + * Collects the IRIs of all values that are past value versions. + */ + private def collectPastValueIris(model: Model): Set[IRI] = { + model.filter(null, ValueCreationDateIri, null).subjects.asScala.toSet.filter { + resource: Resource => model.filter(null, PreviousValueIri, resource).asScala.toSet.nonEmpty + }.map { + resource: Resource => valueFactory.createIRI(resource.stringValue) + } + } +} diff --git a/upgrade/src/test/resources/test-data/pr1307.trig b/upgrade/src/test/resources/test-data/pr1307.trig new file mode 100644 index 0000000000..a260d149ac --- /dev/null +++ b/upgrade/src/test/resources/test-data/pr1307.trig @@ -0,0 +1,100 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix standoff: . +@prefix anything: . + + { + a anything:Thing; + rdfs:label "Something with a lot of markup"; + knora-base:isDeleted false; + knora-base:attachedToProject ; + knora-base:creationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; + knora-base:attachedToUser ; + anything:hasRichtext . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueHasStandoff , + , + , + , + , + , + , + ; + knora-base:valueHasMapping ; + knora-base:valueCreationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "Something with a lot of different markup. And more markup."; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; + knora-base:attachedToUser . + + + a standoff:StandoffBoldTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 9; + knora-base:standoffTagHasStartIndex 2; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "7f3af890-c77d-4bf8-a81c-6786632520dd" . + + + a standoff:StandoffSuperscriptTag; + knora-base:standoffTagHasStart 34; + knora-base:standoffTagHasEnd 40; + knora-base:standoffTagHasStartIndex 6; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "e2ab65d2-6c80-494e-88ba-66767ed885f9" . + + + a standoff:StandoffParagraphTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 58; + knora-base:standoffTagHasStartIndex 1; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "f3c0773a-2eb3-4d2e-9a6f-c8f2582a146e" . + + + a knora-base:StandoffUriTag; + knora-base:standoffTagHasStart 51; + knora-base:standoffTagHasEnd 57; + knora-base:standoffTagHasStartIndex 7; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "7b9f4609-3ba6-43e5-b945-d4329a155ca7"; + knora-base:valueHasUri "http://www.google.ch"^^xsd:anyURI . + + + a standoff:StandoffUnderlineTag; + knora-base:standoffTagHasStart 24; + knora-base:standoffTagHasEnd 33; + knora-base:standoffTagHasStartIndex 5; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "df348cfa-c362-45e6-9e13-601442214064" . + + + a standoff:StandoffRootTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 59; + knora-base:standoffTagHasStartIndex 0; + knora-base:standoffTagHasUUID "c41e4e78-8b4f-47fc-9d17-8af0a279c80c" . + + + a standoff:StandoffItalicTag; + knora-base:standoffTagHasStart 10; + knora-base:standoffTagHasEnd 14; + knora-base:standoffTagHasStartIndex 3; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "13f66d42-2b1f-4fb4-91aa-6c55e350b0f4" . + + + a standoff:StandoffStrikethroughTag; + knora-base:standoffTagHasStart 17; + knora-base:standoffTagHasEnd 20; + knora-base:standoffTagHasStartIndex 4; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "0aaa6e47-0e9b-494f-9b6a-f42c66471d30" . +} diff --git a/upgrade/src/test/resources/test-data/pr1322.trig b/upgrade/src/test/resources/test-data/pr1322.trig new file mode 100644 index 0000000000..c3d8cc7662 --- /dev/null +++ b/upgrade/src/test/resources/test-data/pr1322.trig @@ -0,0 +1,75 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with version history"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasInteger ; + anything:hasText . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 1; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 2; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 3; + knora-base:valueHasOrder 0; + knora-base:valueHasString "3"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "one"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "two"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "three"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . +} diff --git a/upgrade/src/test/resources/test-data/pr1367.trig b/upgrade/src/test/resources/test-data/pr1367.trig new file mode 100644 index 0000000000..fc02d1671a --- /dev/null +++ b/upgrade/src/test/resources/test-data/pr1367.trig @@ -0,0 +1,28 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with a decimal value"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasDecimal . + + a knora-base:DecimalValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasDecimal "1.2"^^xsd:valueHasDecimal; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1.2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . +} diff --git a/upgrade/src/test/resources/test-data/pr1372.trig b/upgrade/src/test/resources/test-data/pr1372.trig new file mode 100644 index 0000000000..ff3ec1a66b --- /dev/null +++ b/upgrade/src/test/resources/test-data/pr1372.trig @@ -0,0 +1,105 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with version history"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasInteger ; + anything:hasText ; + anything:hasOtherThing ; + anything:hasOtherThingValue . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 1; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 2; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:IntValue; + knora-base:valueHasUUID "pLlW4ODASumZfZFbJdpw1g"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 3; + knora-base:valueHasOrder 0; + knora-base:valueHasString "3"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "one"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "two"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:valueHasUUID "W5fm67e0QDWxRZumcXcs6g"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "three"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:LinkValue; + rdf:subject ; + rdf:predicate anything:hasOtherThing; + rdf:object ; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueCreationDate "2019-02-10T10:30:10Z"^^xsd:dateTime; + knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; + knora-base:valueHasRefCount 1 . + + a knora-base:LinkValue; + knora-base:valueHasUUID "IZGOjVqxTfSNO4ieKyp0SA"^^xsd:string; + rdf:subject ; + rdf:predicate anything:hasOtherThing; + rdf:object ; + knora-base:isDeleted true; + knora-base:deleteDate "2019-02-13T09:00:10Z"^^xsd:dateTime; + knora-base:deletedBy ; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueCreationDate "2019-02-13T09:00:10Z"^^xsd:dateTime; + knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; + knora-base:valueHasRefCount 0; + knora-base:previousValue . +} diff --git a/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1307Spec.scala b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1307Spec.scala new file mode 100644 index 0000000000..944e0f2750 --- /dev/null +++ b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1307Spec.scala @@ -0,0 +1,158 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpgradePluginPR1307Spec extends UpgradePluginSpec { + "Upgrade plugin PR1307" should { + "update text values with standoff" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/pr1307.trig") + + // Use the plugin to transform the input. + val plugin = new UpgradePluginPR1307 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that knora-base:valueHasMaxStandoffStartIndex was added. + + val query1: String = + """ + |PREFIX knora-base: + | + |SELECT ?s ?maxStartIndex WHERE { + | ?s knora-base:valueHasMaxStandoffStartIndex ?maxStartIndex . + |} + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query1, connection = connection) + + val expectedResult1: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "s" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ", + "maxStartIndex" -> "7" + ) + ) + ) + + assert(queryResult1.results == expectedResult1) + + // Check that the standoff tags' IRIs were changed correctly. + + val query2: String = + """ + |PREFIX knora-base: + | + |SELECT ?tag WHERE { + | knora-base:valueHasStandoff ?tag . + |} ORDER BY ?tag + |""".stripMargin + + val queryResult2: SparqlSelectResponse = doSelect(selectQuery = query2, connection = connection) + + val expectedResult2: SparqlSelectResponseBody = expectedResult( + Seq( + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7") + ) + ) + + assert(queryResult2.results == expectedResult2) + + // Check that the objects of knora-base:standoffTagHasStartParent were changed correctly. + + val query3: String = + """ + |PREFIX knora-base: + | + |SELECT ?tag ?startIndex ?startParent WHERE { + | ?tag knora-base:standoffTagHasStartIndex ?startIndex . + | + | OPTIONAL { + | ?tag knora-base:standoffTagHasStartParent ?startParent . + | } + |} ORDER BY ?tag + |""".stripMargin + + val queryResult3: SparqlSelectResponse = doSelect(selectQuery = query3, connection = connection) + + val expectedResult3: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "startIndex" -> "0", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0" + ), + Map( + "startIndex" -> "1", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1" + ), + Map( + "startIndex" -> "2", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2" + ), + Map( + "startIndex" -> "3", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3" + ), + Map( + "startIndex" -> "4", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4" + ), + Map( + "startIndex" -> "5", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5" + ), + Map( + "startIndex" -> "6", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6" + ), + Map( + "startIndex" -> "7", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7" + ) + ) + ) + + assert(queryResult3.results == expectedResult3) + connection.close() + repository.shutDown() + } + } +} diff --git a/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1322Spec.scala b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1322Spec.scala new file mode 100644 index 0000000000..0c27071526 --- /dev/null +++ b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1322Spec.scala @@ -0,0 +1,70 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpgradePluginPR1322Spec extends UpgradePluginSpec { + "Upgrade plugin PR1322" should { + "add UUIDs to values" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/pr1322.trig") + + // Use the plugin to transform the input. + val plugin = new UpgradePluginPR1322 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that UUIDs were added. + + val query: String = + """ + |PREFIX knora-base: + | + |SELECT ?value WHERE { + | ?value knora-base:valueHasUUID ?valueHasUUID . + |} ORDER BY ?value + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query, connection = connection) + + val expectedResultBody: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/1c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/2c" + ) + ) + ) + + assert(queryResult1.results == expectedResultBody) + + connection.close() + repository.shutDown() + } + } +} diff --git a/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1367Spec.scala b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1367Spec.scala new file mode 100644 index 0000000000..f8694c2aa1 --- /dev/null +++ b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1367Spec.scala @@ -0,0 +1,50 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.{Literal, Model} +import org.knora.webapi.OntologyConstants +import org.knora.webapi.util.JavaUtil._ + +class UpgradePluginPR1367Spec extends UpgradePluginSpec { + private val valueFactory = SimpleValueFactory.getInstance + + "Upgrade plugin PR1367" should { + "fix the datatypes of decimal literals" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/pr1367.trig") + + // Use the plugin to transform the input. + val plugin = new UpgradePluginPR1367 + plugin.transform(model) + + // Check that the decimal datatype was fixed. + val literal: Literal = Models.getPropertyLiteral( + model, + valueFactory.createIRI("http://rdfh.ch/0001/thing-with-history/values/1"), + valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasDecimal) + ).toOption.get + + assert(literal.getDatatype == valueFactory.createIRI(OntologyConstants.Xsd.Decimal)) + } + } +} diff --git a/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1372Spec.scala b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1372Spec.scala new file mode 100644 index 0000000000..5815996892 --- /dev/null +++ b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginPR1372Spec.scala @@ -0,0 +1,74 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpgradePluginPR1372Spec extends UpgradePluginSpec { + "Upgrade plugin PR1372" should { + "remove permissions from past versions of values" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/pr1372.trig") + + // Use the plugin to transform the input. + val plugin = new UpgradePluginPR1372 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that permissions were removed. + + val query: String = + """ + |PREFIX knora-base: + | + |SELECT ?value WHERE { + | ?value knora-base:valueCreationDate ?creationDate ; + | knora-base:hasPermissions ?permissions . + |} ORDER BY ?value + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query, connection = connection) + + val expectedResultBody: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/1c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/2c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/3b" + ) + ) + ) + + assert(queryResult1.results == expectedResultBody) + + connection.close() + repository.shutDown() + } + } +} diff --git a/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginSpec.scala b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginSpec.scala new file mode 100644 index 0000000000..3eff21eecb --- /dev/null +++ b/upgrade/src/test/scala/org.knora.upgrade/plugins/UpgradePluginSpec.scala @@ -0,0 +1,117 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.upgrade.plugins + +import java.io.{BufferedReader, FileReader} + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.model.impl.LinkedHashModel +import org.eclipse.rdf4j.query.{Binding, TupleQuery, TupleQueryResult} +import org.eclipse.rdf4j.repository.sail.{SailRepository, SailRepositoryConnection} +import org.eclipse.rdf4j.rio.helpers.StatementCollector +import org.eclipse.rdf4j.rio.{RDFFormat, RDFParser, Rio} +import org.eclipse.rdf4j.sail.memory.MemoryStore +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody, SparqlSelectResponseHeader, VariableResultsRow} +import org.knora.webapi.util.ErrorHandlingMap +import org.scalatest.{Matchers, WordSpecLike} + +import scala.collection.JavaConverters._ +import scala.collection.mutable.ArrayBuffer + +/** + * Provides helper methods for specs that test upgrade plugins. + */ +abstract class UpgradePluginSpec extends WordSpecLike with Matchers { + /** + * Parses a TriG file and returns it as an RDF4J [[Model]]. + * + * @param path the file path of the TriG file. + * @return a [[Model]]. + */ + def trigFileToModel(path: String): Model = { + val trigParser: RDFParser = Rio.createParser(RDFFormat.TRIG) + val fileReader = new BufferedReader(new FileReader(path)) + val model = new LinkedHashModel() + trigParser.setRDFHandler(new StatementCollector(model)) + trigParser.parse(fileReader, "") + model + } + + /** + * Makes an in-memory RDF4J [[SailRepository]] containing a [[Model]]. + * + * @param model the model to be added to the repository. + * @return the repository. + */ + def makeRepository(model: Model): SailRepository = { + val repository = new SailRepository(new MemoryStore()) + repository.init() + val connection: SailRepositoryConnection = repository.getConnection + connection.add(model) + connection.close() + repository + } + + /** + * Wraps expected SPARQL SELECT results in a [[SparqlSelectResponseBody]]. + * + * @param rows the expected results. + * @return a [[SparqlSelectResponseBody]] containing the expected results. + */ + def expectedResult(rows: Seq[Map[String, String]]): SparqlSelectResponseBody = { + val rowMaps = rows.map { + mapToWrap => VariableResultsRow(new ErrorHandlingMap[String, String](mapToWrap, { key: String => s"No value found for SPARQL query variable '$key' in query result row" })) + } + + SparqlSelectResponseBody(bindings = rowMaps) + } + + /** + * Does a SPARQL SELECT query using a connection to an RDF4J [[SailRepository]]. + * + * @param selectQuery the query. + * @param connection a connection to the repository. + * @return a [[SparqlSelectResponse]] containing the query results. + */ + def doSelect(selectQuery: String, connection: SailRepositoryConnection): SparqlSelectResponse = { + val tupleQuery: TupleQuery = connection.prepareTupleQuery(selectQuery) + val tupleQueryResult: TupleQueryResult = tupleQuery.evaluate + + val header = SparqlSelectResponseHeader(tupleQueryResult.getBindingNames.asScala) + val rowBuffer = ArrayBuffer.empty[VariableResultsRow] + + while (tupleQueryResult.hasNext) { + val bindings: Iterable[Binding] = tupleQueryResult.next.asScala + + val rowMap: Map[String, String] = bindings.map { + binding => binding.getName -> binding.getValue.stringValue + }.toMap + + rowBuffer.append(VariableResultsRow(new ErrorHandlingMap[String, String](rowMap, { key: String => s"No value found for SPARQL query variable '$key' in query result row" }))) + } + + tupleQueryResult.close() + + SparqlSelectResponse( + head = header, + results = SparqlSelectResponseBody(bindings = rowBuffer) + ) + } +} diff --git a/upgrade/test.sh b/upgrade/test.sh deleted file mode 100755 index 5eaaad8414..0000000000 --- a/upgrade/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -python3 -W ignore::DeprecationWarning -m pytest diff --git a/upgrade/update-repository.py b/upgrade/update-repository.py deleted file mode 100755 index de3c210606..0000000000 --- a/upgrade/update-repository.py +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import os -import time -from datetime import timedelta -import tempfile -import argparse -import getpass -import rdflib -import importlib -import re -from updatelib import rdftools - - -# A list of built-in Knora ontologies and data files. -knora_ontologies = [ - { - "filename": "knora-admin.ttl", - "context": "http://www.knora.org/ontology/knora-admin" - }, - { - "filename": "knora-base.ttl", - "context": "http://www.knora.org/ontology/knora-base" - }, - { - "filename": "salsah-gui.ttl", - "context": "http://www.knora.org/ontology/salsah-gui" - }, - { - "filename": "standoff-onto.ttl", - "context": "http://www.knora.org/ontology/standoff" - }, - { - "filename": "standoff-data.ttl", - "context": "http://www.knora.org/data/standoff" - } -] - -# A set of the IRIs of the named graphs containing built-in Knora ontologies. -knora_ontology_contexts = set([onto["context"] for onto in knora_ontologies]) - -# A regex that matches the object of knora-base:ontologyVersion. -knora_base_version_string_regex = re.compile(r"^PR ([0-9]+)$") - -# A regex that matches the name of a directory containing an update plugin. -plugin_dirname_regex = re.compile(r"^pr([0-9]+)$") - - -# Represents information about a GraphDB repository. -class GraphDBInfo: - def __init__(self, graphdb_host, repository, username, password): - self.graphdb_url = "http://{}:7200/repositories/{}".format(graphdb_host, repository) - self.contexts_url = self.graphdb_url + "/contexts" - self.statements_url = self.graphdb_url + "/statements" - self.username = username - self.password = password - - -# Represents a named graph. -class NamedGraph: - def __init__(self, context, graphdb_info, filename=None): - self.context = context - self.uri = "<" + context + ">" - self.graphdb_info = graphdb_info - - if filename is not None: - self.filename = filename - else: - self.filename = context.translate({ord(c): None for c in "/:"}) + ".ttl" - - self.namespaces = [] - - # Downloads the named graph from the repository to a file in download_dir. - def download(self, download_dir): - print("Downloading named graph {}...".format(self.context)) - downloaded_file_path = download_dir + "/" + self.filename - rdftools.do_download_request(graphdb_info=self.graphdb_info, context=self.uri, file_path=downloaded_file_path) - - # Parses the input graph. - def parse(self, download_dir): - print("Parsing input file for named graph {}...".format(self.context)) - input_file_path = download_dir + "/" + self.filename - graph = rdflib.Graph() - graph.parse(source=input_file_path, format="turtle") - self.namespaces = list(graph.namespace_manager.namespaces()) - return graph - - # Formats the output graph. - def format(self, graph, upload_dir): - for prefix, namespace in self.namespaces: - graph.namespace_manager.bind(prefix=prefix, namespace=namespace, override=True, replace=True) - - output_file_path = upload_dir + "/" + self.filename - print("Writing transformed file...") - graph.serialize(destination=output_file_path, format="turtle") - - def to_turtle_file(self, upload_dir): - return rdftools.TurtleFile( - context=rdflib.URIRef(self.context), - namespaces=self.namespaces, - file_path=upload_dir + "/" + self.filename - ) - - -# Represents a repository. -class Repository: - def __init__(self, graphdb_info): - self.graphdb_info = graphdb_info - self.named_graphs = [] - - # Downloads the repository, saving the named graphs in files in download_dir. - def download(self, download_dir): - print("Downloading named graphs...") - contexts = rdftools.do_contexts_request(graphdb_info=self.graphdb_info) - - for context in contexts: - if not (context in knora_ontology_contexts): - named_graph = NamedGraph(context=context, graphdb_info=self.graphdb_info) - named_graph.download(download_dir) - self.named_graphs.append(named_graph) - - print("Downloaded named graphs to", download_dir) - - # Uses a GraphTransformer to transform the named graphs in download_dir, saving the output in upload_dir. - def transform(self, graph_transformer, download_dir, upload_dir): - print("Transforming data...") - - for named_graph in self.named_graphs: - input_graph = named_graph.parse(download_dir) - graph_size = len(input_graph) - print("Transforming {} statements...".format(graph_size)) - output_graph = graph_transformer.transform(input_graph) - named_graph.format(output_graph, upload_dir) - - print("Wrote transformed data to " + upload_dir) - - # Deletes the contents of the repository. - def empty(self): - print("Emptying repository...") - rdftools.do_update_request(graphdb_info=self.graphdb_info, sparql="DROP ALL") - print("Emptied repository.") - - # Uploads the PR-specific knora ontologies and transformed named graphs to the repository. - def upload(self, knora_ontologies_dir, upload_dir): - print("Combining named graphs...") - - # Make a TurtleFile for each built-in Knora ontology. - - turtle_files = [] - - for ontology in knora_ontologies: - ontology_named_graph = NamedGraph( - context=ontology["context"], - graphdb_info=self.graphdb_info, - filename=ontology["filename"] - ) - - turtle_files.append(ontology_named_graph.to_turtle_file(knora_ontologies_dir)) - - # Make a TurtleFile for each transformed named graph. - - for named_graph in self.named_graphs: - turtle_files.append(named_graph.to_turtle_file(upload_dir)) - - # Upload the whole repository. - - trig_file_path = upload_dir + "/repository.trig" - - rdftools.do_upload_request( - graphdb_info=self.graphdb_info, - turtle_files=turtle_files, - trig_file_path=trig_file_path - ) - - print("Uploaded repository.") - - # Updates the Lucene index. - def update_lucene_index(self): - print("Updating Lucene index...") - - sparql = """ - PREFIX luc: - INSERT DATA { luc:fullTextSearchIndex luc:updateIndex _:b1 . } - """ - - rdftools.do_update_request(graphdb_info=self.graphdb_info, sparql=sparql) - print("Updated Lucene index.") - - -# Updates the repository using the specified list of GraphTransformer instances. -def run_updates(graphdb_info, transformers): - repository = Repository(graphdb_info) - last_upload_dir = None - last_transformer = None - - for transformer in transformers: - temp_dir = tempfile.mkdtemp() - print("Running transformation for PR {}...".format(transformer.pr_num)) - print("Using temporary directory {}".format(temp_dir)) - - upload_dir = temp_dir + "/upload" - os.mkdir(upload_dir) - - # Is this the first transformation? - if last_upload_dir is not None: - # No. Use the result of the last transformation as input. - repository.transform(graph_transformer=transformer, download_dir=last_upload_dir, upload_dir=upload_dir) - else: - # Yes. Download the repository. - download_dir = temp_dir + "/download" - os.mkdir(download_dir) - repository.download(download_dir) - repository.transform(graph_transformer=transformer, download_dir=download_dir, upload_dir=upload_dir) - - last_upload_dir = upload_dir - last_transformer = transformer - print("Transformation for PR {} complete.".format(transformer.pr_num)) - - # Empty the repository. - repository.empty() - - # Upload the results of the last transformation. - last_transformer_knora_ontologies_dir = "plugins/pr{}/knora-ontologies".format(last_transformer.pr_num) - repository.upload(knora_ontologies_dir=last_transformer_knora_ontologies_dir, upload_dir=last_upload_dir) - repository.update_lucene_index() - - -# Determines which transformations need to be run, and returns a corresponding list of GraphTransformer instances. -def load_transformers(graphdb_info): - # Get the list of available transformations. - - plugins_subdirs = os.listdir("plugins") - pr_nums = [] - - for dirname in plugins_subdirs: - match = plugin_dirname_regex.match(dirname) - - if match is not None: - pr_nums.append(int(match.group(1))) - - # Get the version string attached to knora-base in the repository. - - knora_base_pr_num_sparql = """ - PREFIX knora-base: - - SELECT ?ontologyVersion - WHERE { - knora-base:ontologyVersion ?ontologyVersion . - } - """ - - query_result_rows = rdftools.do_select_request(graphdb_info=graphdb_info, sparql=knora_base_pr_num_sparql) - - # Did we find a version string? - if len(query_result_rows) > 0: - # Yes. Parse it. - - ontology_version_string = query_result_rows[0]["ontologyVersion"]["value"] - match = knora_base_version_string_regex.match(ontology_version_string) - - if match is None: - raise rdftools.UpdateException("Could not parse knora-base:ontologyVersion: {}".format(ontology_version_string)) - - print("Repository version: {}".format(ontology_version_string)) - repository_pr_num = int(match.group(1)) - else: - # No. Run all available transformations. - repository_pr_num = 0 - print("Repository has no knora-base:ontologyVersion.") - - # Make a sorted list of transformations needed for this repository. - needed_pr_nums = sorted(list(filter(lambda pr_num: pr_num > repository_pr_num, pr_nums))) - - # If the list of transformations is empty, do nothing. - if len(needed_pr_nums) == 0: - return [] - - needed_pr_nums_str = ', '.join(map(str, needed_pr_nums)) - print("Required updates: " + needed_pr_nums_str) - transformers = [] - - # Load a GraphTransformer instance for each transformation. - for transformer_pr_num in needed_pr_nums: - # Load the transformer's module. - transformer_module = importlib.import_module("plugins.pr{}.update".format(transformer_pr_num)) - - # Get the transformer class definition from the module. - transformer_class = getattr(transformer_module, "GraphTransformer") - - # Make an instance of the transformer class. - transformer = transformer_class() - - # Add its PR number to it. - transformer.pr_num = transformer_pr_num - - # Add it to the list. - transformers.append(transformer) - - return transformers - - -# Command-line invocation. -def main(): - default_graphdb_host = "localhost" - default_repository = "knora-test" - - parser = argparse.ArgumentParser(description="Updates a Knora repository.") - parser.add_argument("-g", "--graphdb", default=default_graphdb_host, help="GraphDB host (default '{}')".format(default_graphdb_host), type=str) - parser.add_argument("-r", "--repository", default=default_repository, help="GraphDB repository (default '{}')".format(default_repository), - type=str) - parser.add_argument("-u", "--username", help="GraphDB username", type=str, required=True) - parser.add_argument("-p", "--password", help="GraphDB password (if not provided, will prompt for password)", - type=str) - parser.add_argument("-t", "--tempdir", help="temporary directory", type=str) - - args = parser.parse_args() - password = args.password - - if not password: - password = getpass.getpass() - - graphdb_info = GraphDBInfo( - graphdb_host=args.graphdb, - repository=args.repository, - username=args.username, - password=password - ) - - start = time.time() - transformers = load_transformers(graphdb_info) - - if len(transformers) > 0: - tempfile.tempdir = args.tempdir - run_updates(graphdb_info=graphdb_info, transformers=transformers) - elapsed = time.time() - start - print("Update complete. Elapsed time: {}.".format(str(timedelta(seconds=elapsed)))) - else: - print("No updates needed.") - - -if __name__ == "__main__": - main() diff --git a/upgrade/updatelib/rdftools.py b/upgrade/updatelib/rdftools.py deleted file mode 100644 index 84824c8bc0..0000000000 --- a/upgrade/updatelib/rdftools.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright @ 2015-2019 the contributors (see Contributors.md). -# -# This file is part of Knora. -# -# Knora is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Knora is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with Knora. If not, see . - - -import requests -import rdflib -from collections import defaultdict -from abc import ABC, abstractmethod -import re - - -# An abstract class representing a PR-specific graph transformation. Each -# implementation must be in its own module and be called GraphTransformer. -class GraphTransformer(ABC): - @abstractmethod - def transform(self, graph): - pass - - -# Raised when an error occurs during an update. -class UpdateException(Exception): - def __init__(self, message): - self.message = message - - -# Makes a SELECT request to the triplestore, returning the result as a list of rows. -def do_select_request(graphdb_info, sparql): - headers = { - "Content-Type": "application/sparql-query", - "Accept": "application/sparql-results+json" - } - - response = requests.post( - url=graphdb_info.graphdb_url, - headers=headers, - data=sparql, - auth=(graphdb_info.username, graphdb_info.password) - ) - - response.raise_for_status() - json_response = response.json() - return json_response["results"]["bindings"] - - -# Makes an update request to the triplestore. -def do_update_request(graphdb_info, sparql): - headers = { - "Content-Type": "application/sparql-update" - } - - response = requests.post( - url=graphdb_info.statements_url, - headers=headers, - data=sparql, - auth=(graphdb_info.username, graphdb_info.password) - ) - - response.raise_for_status() - - -# Returns a list of available named graphs from the triplestore. -def do_contexts_request(graphdb_info): - response = requests.get( - url=graphdb_info.contexts_url, - auth=(graphdb_info.username, graphdb_info.password) - ) - - response.raise_for_status() - contexts = response.text.splitlines() - - if contexts[0] != "contextID": - raise UpdateException("Unexpected response from GraphDB:\n" + response.text) - - contexts.pop(0) - return contexts - - -# Downloads a named graph from the triplestore in Turtle format and saves it to a file. -def do_download_request(graphdb_info, context, file_path): - params = { - "infer": "false", - "context": context - } - - headers = { - "Accept": "text/turtle" - } - - response = requests.get( - url=graphdb_info.statements_url, - params=params, - headers=headers, - auth=(graphdb_info.username, graphdb_info.password) - ) - - response.raise_for_status() - - with open(file_path, "wb") as downloaded_file: - for chunk in response.iter_content(chunk_size=1024): - downloaded_file.write(chunk) - - -# Represents a file in Turtle format. -class TurtleFile: - def __init__(self, context, namespaces, file_path): - self.context = context - self.namespaces = namespaces - self.file_path = file_path - - -# A regex that matches the name of a Knora named graph that needs a prefix. -context_regex = re.compile(r"^http://www.knora.org/(.+)/(.+)/(.+)$") - - -# Given a collection of TurtleFiles, combines them into a Trig file and uploads that file to the triplestore. -def do_upload_request(graphdb_info, turtle_files, trig_file_path): - namespaces = { - "ontology": rdflib.URIRef("http://www.knora.org/ontology/"), - "data": rdflib.URIRef("http://www.knora.org/data/") - } - - for turtle_file in turtle_files: - namespaces.update(turtle_file.namespaces) - - # Add prefixes, otherwise rdflib will add random ones. - - context_str = str(turtle_file.context) - match = context_regex.match(context_str) - - if match is not None: - prefix = match.group(1) + "-" + match.group(2) - namespaces[prefix] = "http://www.knora.org/{}/{}/".format(match.group(1), match.group(2)) - - dataset = rdflib.Dataset() - - for turtle_file in turtle_files: - print("Reading named graph {}...".format(turtle_file.context)) - graph = dataset.graph(turtle_file.context) - graph.parse(source=turtle_file.file_path, format="turtle") - - for prefix, namespace in namespaces.items(): - dataset.namespace_manager.bind(prefix=prefix, namespace=namespace, override=True, replace=True) - - print("Writing repository file for upload...") - - dataset.serialize(destination=trig_file_path, format="trig") - - headers = { - "Content-Type": "application/trig" - } - - print("Uploading repository...") - - with open(trig_file_path, "r") as file_to_upload: - file_content = file_to_upload.read().encode("utf-8") - - response = requests.post( - url=graphdb_info.statements_url, - headers=headers, - auth=(graphdb_info.username, graphdb_info.password), - data=file_content - ) - - response.raise_for_status() - - -# Groups statements by subject and by predicate. -def group_statements(input_graph): - grouped_statements = {} - - for subj in input_graph.subjects(): - grouped_pred_objs = defaultdict(list) - - for pred, obj in input_graph.predicate_objects(subj): - grouped_pred_objs[pred].append(obj) - - grouped_statements[subj] = grouped_pred_objs - - return grouped_statements - - -# Ungroups statements. -def ungroup_statements(grouped_statements): - ungrouped_statements = rdflib.Graph() - - for subj, pred_objs in grouped_statements.items(): - for pred, objs in pred_objs.items(): - for obj in objs: - ungrouped_statements.add((subj, pred, obj)) - - return ungrouped_statements - - -# Returns true if the specified generator is empty. -def generator_is_empty(gen): - try: - next(gen) - except StopIteration: - return True - - return False diff --git a/webapi/src/it/resources/logback-test.xml b/webapi/src/it/resources/logback-test.xml index 5b75df9568..424181f100 100644 --- a/webapi/src/it/resources/logback-test.xml +++ b/webapi/src/it/resources/logback-test.xml @@ -55,7 +55,7 @@ - + diff --git a/webapi/src/main/resources/logback.xml b/webapi/src/main/resources/logback.xml index a0075e179e..3fd9c856ad 100644 --- a/webapi/src/main/resources/logback.xml +++ b/webapi/src/main/resources/logback.xml @@ -35,7 +35,7 @@ - + diff --git a/webapi/src/main/scala/org/knora/webapi/package.scala b/webapi/src/main/scala/org/knora/webapi/package.scala index 124b1a716f..1d7a0e5f8f 100644 --- a/webapi/src/main/scala/org/knora/webapi/package.scala +++ b/webapi/src/main/scala/org/knora/webapi/package.scala @@ -27,7 +27,7 @@ package object webapi { * The version of `knora-base` and of the other built-in ontologies that this version of Knora requires. * Must be the same as the object of `knora-base:ontologyVersion` in the `knora-base` ontology being used. */ - val KnoraBaseVersion: String = "PR XXXX" + val KnoraBaseVersion: String = "knora-base v6" /** * `IRI` is a synonym for `String`, used to improve code readability. diff --git a/webapi/src/main/scala/org/knora/webapi/update/UpdatePlugin.scala b/webapi/src/main/scala/org/knora/webapi/update/UpdatePlugin.scala new file mode 100644 index 0000000000..bd66266d05 --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/UpdatePlugin.scala @@ -0,0 +1,36 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update + +import org.eclipse.rdf4j.model.Model + +/** + * A trait for plugins that update a repository. + */ +trait UpdatePlugin { + /** + * Transforms a repository. + * + * @param model a [[Model]] containing the repository data. + */ + def transform(model: Model): Unit +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/UpdateRepository.scala b/webapi/src/main/scala/org/knora/webapi/update/UpdateRepository.scala new file mode 100644 index 0000000000..7fcac9a8de --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/UpdateRepository.scala @@ -0,0 +1,245 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update + +import java.io._ + +import org.eclipse.rdf4j.model.impl.{LinkedHashModel, SimpleValueFactory} +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.{Model, Statement} +import org.eclipse.rdf4j.rio.helpers.StatementCollector +import org.eclipse.rdf4j.rio.{RDFFormat, RDFParser, Rio} +import org.knora.webapi.update.plugins._ +import org.knora.webapi.util.JavaUtil._ +import org.knora.webapi.{InconsistentTriplestoreDataException, OntologyConstants} +import org.rogach.scallop._ + +import scala.collection.JavaConverters._ + + +/** + * Updates a dump of a Knora repository to accommodate changes in Knora. + */ +object UpdateRepository extends App { + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * A list of all plugins in chronological order. + */ + val pluginsForVersions: Seq[PluginForKnoraBaseVersion] = Seq( + PluginForKnoraBaseVersion(versionNumber = 1, plugin = new UpdatePluginPR1307, prBasedVersionString = Some("PR 1307")), + PluginForKnoraBaseVersion(versionNumber = 2, plugin = new UpdatePluginPR1322, prBasedVersionString = Some("PR 1322")), + PluginForKnoraBaseVersion(versionNumber = 3, plugin = new UpdatePluginPR1367, prBasedVersionString = Some("PR 1367")), + PluginForKnoraBaseVersion(versionNumber = 4, plugin = new UpdatePluginPR1372, prBasedVersionString = Some("PR 1372")), + PluginForKnoraBaseVersion(versionNumber = 5, plugin = new NoopPlugin, prBasedVersionString = Some("PR 1440")) + ) + + /** + * The built-in named graphs that are always updated when there is a new version of knora-base. + */ + val builtInNamedGraphs: Set[BuiltInNamedGraph] = Set( + BuiltInNamedGraph( + filename = "knora-admin.ttl", + iri = "http://www.knora.org/ontology/knora-admin" + ), + BuiltInNamedGraph( + filename = "knora-base.ttl", + iri = "http://www.knora.org/ontology/knora-base" + ), + BuiltInNamedGraph( + filename = "salsah-gui.ttl", + iri = "http://www.knora.org/ontology/salsah-gui" + ), + BuiltInNamedGraph( + filename = "standoff-onto.ttl", + iri = "http://www.knora.org/ontology/standoff" + ), + BuiltInNamedGraph( + filename = "standoff-data.ttl", + iri = "http://www.knora.org/data/standoff" + ) + ) + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Represents an update plugin with its knora-base version number and version string. + * + * @param versionNumber the knora-base version number that the plugin's transformation produces. + * @param plugin the plugin. + * @param prBasedVersionString the plugin's PR-based version string (not used for new plugins). + */ + case class PluginForKnoraBaseVersion(versionNumber: Int, plugin: UpdatePlugin, prBasedVersionString: Option[String] = None) { + lazy val versionString: String = { + prBasedVersionString match { + case Some(str) => str + case None => s"knora-base v$versionNumber" + } + } + } + + /** + * Represents a Knora built-in named graph. + * + * @param filename the filename containing the named graph. + * @param iri the IRI of the named graph. + */ + case class BuiltInNamedGraph(filename: String, iri: String) + + /** + * Constructs RDF4J values. + */ + val valueFactory = SimpleValueFactory.getInstance + + /** + * A map of version strings to plugins. + */ + val pluginsForVersionsMap: Map[String, PluginForKnoraBaseVersion] = pluginsForVersions.map { + knoraBaseVersion => knoraBaseVersion.versionString -> knoraBaseVersion + }.toMap + + // Parse the command-line arguments. + val conf = new TransformDataConf(args) + val inputFile = new File(conf.input()) + val outputFile = new File(conf.output()) + + val updateStartTime = System.currentTimeMillis() + + // Parse the input file. + val parseStartTime = System.currentTimeMillis() + val model = readFileIntoModel(inputFile, RDFFormat.TRIG) + val parseEndTime = System.currentTimeMillis() + println(s"Parsed ${model.size} statements in ${parseEndTime - parseStartTime} ms") + + // Get the repository's version string, if any. + val maybeRepositoryVersionString: Option[String] = Models.getPropertyLiteral( + model, + valueFactory.createIRI(OntologyConstants.KnoraBase.KnoraBaseOntologyIri), + valueFactory.createIRI(OntologyConstants.KnoraBase.OntologyVersion) + ).toOption.map(_.stringValue) + + // Is the repository up to date? + if (maybeRepositoryVersionString.contains(org.knora.webapi.KnoraBaseVersion)) { + // Yes. Nothing more to do. + println(s"Repository is up to date at version ${org.knora.webapi.KnoraBaseVersion}.") + } else { + // No. Construct the list of updates that it needs. + val pluginsForNeededUpdates: Seq[PluginForKnoraBaseVersion] = maybeRepositoryVersionString match { + case Some(repositoryVersion) => + // The repository has a version string. Get the plugins for all subsequent versions. + val pluginForRepositoryVersion: PluginForKnoraBaseVersion = pluginsForVersionsMap.getOrElse( + repositoryVersion, + throw InconsistentTriplestoreDataException(s"No such repository version $repositoryVersion") + ) + + pluginsForVersions.filter(_.versionNumber > pluginForRepositoryVersion.versionNumber) + + case None => + // The repository has no version string. Include all updates. + pluginsForVersions + } + + println(s"Needed updates: ${pluginsForNeededUpdates.map(_.versionString).mkString(", ")}") + + // Run the update plugins. + for (pluginForNeededUpdate <- pluginsForNeededUpdates) { + println(s"Running update for ${pluginForNeededUpdate.versionString}...") + pluginForNeededUpdate.plugin.transform(model) + } + + // Update the built-in named graphs. + + println("Updating built-in named graphs...") + + for (builtInNamedGraph <- builtInNamedGraphs) { + println(s"<${builtInNamedGraph.iri}>...") + val context = valueFactory.createIRI(builtInNamedGraph.iri) + model.remove(null, null, null, context) + + val namedGraphTurtleFile = new File(s"../knora-ontologies/${builtInNamedGraph.filename}") + val namedGraphModel: Model = readFileIntoModel(namedGraphTurtleFile, RDFFormat.TURTLE) + + // Set the context on each statement. + for (statement: Statement <- namedGraphModel.asScala.toSet) { + namedGraphModel.remove( + statement.getSubject, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + namedGraphModel.add( + statement.getSubject, + statement.getPredicate, + statement.getObject, + context + ) + } + + model.addAll(namedGraphModel) + } + + // Write the output file. + println(s"Writing output file (${model.size} statements)...") + val fileWriter = new FileWriter(outputFile) + val bufferedWriter = new BufferedWriter(fileWriter) + Rio.write(model, fileWriter, RDFFormat.TRIG) + bufferedWriter.close() + fileWriter.close() + + val updateEndTime = System.currentTimeMillis + println(s"Update completed in ${updateEndTime - updateStartTime} ms.") + } + + /** + * Reads an RDF file into a [[Model]]. + * + * @param file the file. + * @param format the file format. + * @return a [[Model]] representing the contents of the file. + */ + def readFileIntoModel(file: File, format: RDFFormat): Model = { + val trigParser: RDFParser = Rio.createParser(format) + val fileReader = new FileReader(file) + val bufferedReader = new BufferedReader(fileReader) + val model = new LinkedHashModel() + trigParser.setRDFHandler(new StatementCollector(model)) + trigParser.parse(bufferedReader, "") + model + } + + /** + * Parses command-line arguments. + */ + class TransformDataConf(arguments: Seq[String]) extends ScallopConf(arguments) { + banner( + s""" + |Updates a dump of a repository to accommodate changes in Knora. + | + |Usage: org.knora.webapi.util.UpdateRepository input output + """.stripMargin) + + val input: ScallopOption[String] = trailArg[String](required = true, descr = "Input TriG file") + val output: ScallopOption[String] = trailArg[String](required = true, descr = "Output TriG file") + verify() + } +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/plugins/NoopPlugin.scala b/webapi/src/main/scala/org/knora/webapi/update/plugins/NoopPlugin.scala new file mode 100644 index 0000000000..5ed915cf6f --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/plugins/NoopPlugin.scala @@ -0,0 +1,32 @@ +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +/* +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.Model +import org.knora.webapi.update.UpdatePlugin + +/** + * An update plugin that does nothing. Used for updates in which only the built-in named graphs have changed. + */ +class NoopPlugin extends UpdatePlugin { + override def transform(model: Model): Unit = {} +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307.scala b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307.scala new file mode 100644 index 0000000000..a3b777e3f6 --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307.scala @@ -0,0 +1,199 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.vocabulary.RDF +import org.eclipse.rdf4j.model.{IRI, Model, Statement, Value} +import org.knora.webapi.update.UpdatePlugin +import org.knora.webapi.util.JavaUtil._ +import org.knora.webapi.{InconsistentTriplestoreDataException, OntologyConstants} + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1307. + */ +class UpdatePluginPR1307 extends UpdatePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val TextValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.TextValue) + private val ValueHasStandoffIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasStandoff) + private val StandoffTagHasStartIndexIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasStartIndex) + private val StandoffTagHasStartParentIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasStartParent) + private val StandoffTagHasEndParentIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.StandoffTagHasEndParent) + private val ValueHasMaxStandoffStartIndexIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasMaxStandoffStartIndex) + + /** + * Represents a standoff tag to be transformed. + * + * @param oldIri the tag's old IRI. + * @param statements the statements about the tag. + */ + case class StandoffRdf(oldIri: IRI, statements: Model) { + /** + * The value of knora-base:standoffTagHasStartIndex. + */ + val startIndex: Int = Models.getPropertyLiteral(statements, oldIri, StandoffTagHasStartIndexIri).toOption match { + case Some(index) => index.intValue + case None => throw InconsistentTriplestoreDataException(s"$oldIri has no knora-base:standoffTagHasStartIndex") + } + + /** + * The tag's new IRI. + */ + lazy val newIri: IRI = { + val oldSubjStr: String = oldIri.stringValue + val slashPos: Int = oldSubjStr.lastIndexOf('/') + valueFactory.createIRI(oldSubjStr.substring(0, slashPos + 1) + startIndex.toString) + } + + def transform(model: Model, standoff: Map[IRI, StandoffRdf]): Unit = { + for (statement: Statement <- statements.asScala.toSet) { + // Change statements with knora-base:standoffTagHasStartParent and knora-base:standoffTagHasEndParent to point + // to the new IRIs of those tags. + val newStatementObj: Value = if (statement.getPredicate == StandoffTagHasStartParentIri || statement.getPredicate == StandoffTagHasEndParentIri) { + val targetTagOldIri: IRI = valueFactory.createIRI(statement.getObject.stringValue) + standoff(targetTagOldIri).newIri + } else { + statement.getObject + } + + // Remove each statement that uses this tag's old IRI. + model.remove( + oldIri, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + // Replace it with a statement that uses this tag's new IRI. + model.add( + newIri, + statement.getPredicate, + newStatementObj, + statement.getContext + ) + } + } + } + + /** + * Represents a `knora-base:TextValue` to be transformed. + * + * @param iri the text value's IRI. + * @param context the text value's context. + * @param valueHasStandoffStatements the statements whose subject is the text value and whose predicate is + * `knora-base:valueHasStandoff`. + * @param standoff the standoff tags attached to this text value, as a map of old standoff tag IRIs to + * [[StandoffRdf]] objects. + */ + case class TextValueRdf(iri: IRI, context: IRI, valueHasStandoffStatements: Model, standoff: Map[IRI, StandoffRdf]) { + def transform(model: Model): Unit = { + // Transform the text value's standoff tags. + for (standoffTag <- standoff.values) { + standoffTag.transform(model = model, standoff = standoff) + } + + if (standoff.nonEmpty) { + for (statement: Statement <- valueHasStandoffStatements.asScala.toSet) { + // Replace each statement in valueHasStandoffStatements with one that points to the standoff + // tag's new IRI. + + val targetTagOldIri: IRI = valueFactory.createIRI(statement.getObject.stringValue) + val targetTagNewIri: IRI = standoff(targetTagOldIri).newIri + + model.remove( + iri, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + model.add( + iri, + statement.getPredicate, + targetTagNewIri, + statement.getContext + ) + } + + // Add a statement to the text value with the predicate knora-base:valueHasMaxStandoffStartIndex. + model.add( + iri, + ValueHasMaxStandoffStartIndexIri, + valueFactory.createLiteral(new java.math.BigInteger(standoff.values.map(_.startIndex).max.toString)), + context + ) + } + } + } + + override def transform(model: Model): Unit = { + for (textValue <- collectTextValues(model)) { + textValue.transform(model) + } + } + + /** + * Collects the text values and standoff tags in the repository. + */ + private def collectTextValues(model: Model): Vector[TextValueRdf] = { + // Pairs of text value IRI and text value context. + val textValueSubjectsAndContexts: Vector[(IRI, IRI)] = model.filter(null, RDF.TYPE, TextValueIri).asScala.map { + statement => + (valueFactory.createIRI(statement.getSubject.stringValue), valueFactory.createIRI(statement.getContext.stringValue)) + }.toVector + + textValueSubjectsAndContexts.map { + case (textValueSubj: IRI, textValueContext: IRI) => + // Get the statements about the text value. + val textValueStatements: Model = model.filter(textValueSubj, null, null) + + // Get the statements whose subject is the text value and whose predicate is knora-base:valueHasStandoff. + val valueHasStandoffStatements: Model = textValueStatements.filter(null, ValueHasStandoffIri, null) + + // Get the IRIs of the text value's standoff tags. + val standoffSubjects: Set[IRI] = valueHasStandoffStatements.objects.asScala.map { + value => valueFactory.createIRI(value.stringValue) + }.toSet + + // Make a map of standoff IRIs to StandoffRdf objects. + val standoff: Map[IRI, StandoffRdf] = standoffSubjects.map { + standoffSubj: IRI => + standoffSubj -> StandoffRdf( + oldIri = standoffSubj, + statements = model.filter(standoffSubj, null, null) + ) + }.toMap + + TextValueRdf( + iri = textValueSubj, + context = textValueContext, + valueHasStandoffStatements = valueHasStandoffStatements, + standoff = standoff + ) + } + } +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322.scala b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322.scala new file mode 100644 index 0000000000..895b40bd31 --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322.scala @@ -0,0 +1,65 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Model, Resource} +import org.knora.webapi.OntologyConstants +import org.knora.webapi.update.UpdatePlugin +import org.knora.webapi.util.StringFormatter + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1322. + */ +class UpdatePluginPR1322 extends UpdatePlugin { + private val valueFactory = SimpleValueFactory.getInstance + private implicit val stringFormatter: StringFormatter = StringFormatter.getInstanceForConstantOntologies + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val ValueHasUUIDIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasUUID) + private val ValueCreationDateIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.ValueCreationDate) + private val PreviousValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.PreviousValue) + + override def transform(model: Model): Unit = { + // Add a random UUID to each current value version. + for (valueIri: IRI <- collectCurrentValueIris(model)) { + model.add( + valueIri, + ValueHasUUIDIri, + valueFactory.createLiteral(stringFormatter.makeRandomBase64EncodedUuid) + ) + } + } + + /** + * Collects the IRIs of all values that are current value versions. + */ + private def collectCurrentValueIris(model: Model): Set[IRI] = { + model.filter(null, ValueCreationDateIri, null).subjects.asScala.toSet.filter { + resource: Resource => model.filter(null, PreviousValueIri, resource).asScala.toSet.isEmpty + }.map { + resource: Resource => valueFactory.createIRI(resource.stringValue) + } + } +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367.scala b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367.scala new file mode 100644 index 0000000000..cbd9f141e3 --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367.scala @@ -0,0 +1,64 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Literal, Model, Statement} +import org.knora.webapi.update.UpdatePlugin + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1367. + */ +class UpdatePluginPR1367 extends UpdatePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val XsdValueHasDecimalIri: IRI = valueFactory.createIRI("http://www.w3.org/2001/XMLSchema#valueHasDecimal") + + override def transform(model: Model): Unit = { + // Fix the datatypes of decimal literals. + for (statement: Statement <- model.asScala.toSet) { + statement.getObject match { + case literal: Literal => + if (literal.getDatatype == XsdValueHasDecimalIri) { + model.remove( + statement.getSubject, + statement.getPredicate, + statement.getObject, + statement.getContext + ) + + model.add( + statement.getSubject, + statement.getPredicate, + valueFactory.createLiteral(BigDecimal(statement.getObject.stringValue).underlying), + statement.getContext + ) + } + + case _ => () + } + } + } +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372.scala b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372.scala new file mode 100644 index 0000000000..fec4f2e7de --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372.scala @@ -0,0 +1,63 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.{IRI, Model, Resource} +import org.knora.webapi.OntologyConstants +import org.knora.webapi.update.UpdatePlugin + +import scala.collection.JavaConverters._ + +/** + * Transforms a repository for Knora PR 1372. + */ +class UpdatePluginPR1372 extends UpdatePlugin { + private val valueFactory = SimpleValueFactory.getInstance + + // RDF4J IRI objects representing the IRIs used in this transformation. + private val ValueCreationDateIri : IRI= valueFactory.createIRI(OntologyConstants.KnoraBase.ValueCreationDate) + private val PreviousValueIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.PreviousValue) + private val HasPermissionsIri: IRI = valueFactory.createIRI(OntologyConstants.KnoraBase.HasPermissions) + + override def transform(model: Model): Unit = { + // Remove knora-base:hasPermissions from all past value versions. + for (valueIri: IRI <- collectPastValueIris(model)) { + model.remove( + valueIri, + HasPermissionsIri, + null + ) + } + } + + /** + * Collects the IRIs of all values that are past value versions. + */ + private def collectPastValueIris(model: Model): Set[IRI] = { + model.filter(null, ValueCreationDateIri, null).subjects.asScala.toSet.filter { + resource: Resource => model.filter(null, PreviousValueIri, resource).asScala.toSet.nonEmpty + }.map { + resource: Resource => valueFactory.createIRI(resource.stringValue) + } + } +} +*/ diff --git a/webapi/src/main/scala/org/knora/webapi/util/Debug.scala b/webapi/src/main/scala/org/knora/webapi/util/Debug.scala new file mode 100644 index 0000000000..65de568d1a --- /dev/null +++ b/webapi/src/main/scala/org/knora/webapi/util/Debug.scala @@ -0,0 +1,35 @@ +package org.knora.webapi.util + +/** + * Contains methods useful for debugging + */ +object Debug { + + /** + * prints out the classpath + */ + def printClasspath(): Unit = { + // debug classpath + def urls(cl: ClassLoader): Array[java.net.URL] = Option(cl) match { + case None => Array() + case Some(u: java.net.URLClassLoader) => u.getURLs ++ urls(cl.getParent) + case Some(_) => urls(cl.getParent) + } + val res = urls(getClass.getClassLoader) + println(res.filterNot(_.toString.contains("ivy")).mkString("\n")) + } + + /** + * Prints out the file paths for the resources + * + * @param resources a sequence of resource. + */ + def printResources(resources: Seq[String]): Unit = { + println(s"printing resources: $resources") + resources.foreach { res => + val url = getClass.getClassLoader.getResource(res) + println(url) + } + } + +} diff --git a/webapi/src/main/scala/org/knora/webapi/util/JavaUtil.scala b/webapi/src/main/scala/org/knora/webapi/util/JavaUtil.scala index 00151cad85..2c8bc595ad 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/JavaUtil.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/JavaUtil.scala @@ -21,6 +21,8 @@ package org.knora.webapi.util import java.util.function.{BiFunction, Function} +import scala.language.implicitConversions + /** * Utility functions for working with Java libraries. */ @@ -47,16 +49,16 @@ object JavaUtil { /** * Recursively converts a Java collection into a Scala collection. * - * Usage: val scalaObj = deepScalaToJava(javaObj).asInstanceOf[Map[String, Any]] + * Usage: `val scalaObj = deepScalaToJava(javaObj).asInstanceOf[Map[String, Any]]` * * @param javaObj the Java collection to be converted. * @return an equivalent Scala collection. */ - def deepJavatoScala(javaObj: Any): Any = { + def deepJavaToScala(javaObj: Any): Any = { import collection.JavaConverters._ javaObj match { - case x: java.util.HashMap[_, _] => x.asScala.toMap.mapValues(deepJavatoScala) - case x: java.util.ArrayList[_] => x.asScala.toList.map(deepJavatoScala) + case x: java.util.HashMap[_, _] => x.asScala.toMap.mapValues(deepJavaToScala) + case x: java.util.ArrayList[_] => x.asScala.toList.map(deepJavaToScala) case _ => javaObj } } @@ -88,4 +90,13 @@ object JavaUtil { object Optional { def unapply[T](a: T): Some[Option[T]] = if (null == a) Some(None) else Some(Some(a)) } + + /** + * Wraps a Java `Optional` and converts it to a Scala [[Option]]. + */ + class JavaOptional[T](opt: java.util.Optional[T]) { + def toOption: Option[T] = if (opt.isPresent) Some(opt.get()) else None + } + + implicit def toJavaOptional[T](optional: java.util.Optional[T]): JavaOptional[T] = new JavaOptional[T](optional) } diff --git a/webapi/src/main/scala/org/knora/webapi/util/StatementCollectingHandler.scala b/webapi/src/main/scala/org/knora/webapi/util/StatementCollectingHandler.scala deleted file mode 100644 index c845e18e48..0000000000 --- a/webapi/src/main/scala/org/knora/webapi/util/StatementCollectingHandler.scala +++ /dev/null @@ -1,83 +0,0 @@ -package org.knora.webapi.util - -import org.eclipse.rdf4j.model.impl.SimpleValueFactory -import org.eclipse.rdf4j.model.{Resource, Statement} -import org.eclipse.rdf4j.rio.{RDFHandler, RDFWriter} -import org.knora.webapi.{IRI, OntologyConstants} - -import scala.collection.immutable.TreeMap - -/** - * An abstract [[RDFHandler]] that collects all statements so they can be processed when the end of the - * input file is reached. Subclasses need to implement only `endRDF`, which must call `turtleWriter.endRDF()` - * when finished. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ -abstract class StatementCollectingHandler(turtleWriter: RDFWriter) extends RDFHandler { - /** - * An instance of [[SimpleValueFactory]] for creating RDF statements. - */ - protected val valueFactory: SimpleValueFactory = SimpleValueFactory.getInstance() - - implicit object ResourceOrdering extends Ordering[Resource] { - def compare(o1: Resource, o2: Resource): Int = o1.stringValue.compare(o2.stringValue) - } - - /** - * A collection of all the statements in the input file, grouped and sorted by subject IRI. - */ - protected var statements: TreeMap[Resource, Vector[Statement]] = TreeMap.empty[Resource, Vector[Statement]] - - /** - * A convenience method that returns the first object of the specified predicate in a list of statements. - * - * @param subjectStatements the statements to search. - * @param predicateIri the predicate to search for. - * @return the first object found for the specified predicate. - */ - protected def getObject(subjectStatements: Vector[Statement], predicateIri: IRI): Option[String] = { - subjectStatements.find(_.getPredicate.stringValue == predicateIri).map(_.getObject.stringValue) - } - - /** - * Adds a statement to the collection `statements`. - * - * @param st the statement to be added. - */ - override def handleStatement(st: Statement): Unit = { - val subject = st.getSubject - val currentStatementsForSubject = statements.getOrElse(subject, Vector.empty[Statement]) - - if (st.getPredicate.stringValue == OntologyConstants.Rdf.Type) { - // Make rdf:type the first statement for the subject. - statements += (subject -> (st +: currentStatementsForSubject)) - } else { - statements += (subject -> (currentStatementsForSubject :+ st)) - } - } - - /** - * Does nothing (comments are ignored). - * - * @param comment a Turtle comment. - */ - override def handleComment(comment: String): Unit = {} - - /** - * Writes the specified namespace declaration to the output file. - * - * @param prefix the namespace prefix. - * @param uri the namespace URI. - */ - override def handleNamespace(prefix: String, uri: String): Unit = { - turtleWriter.handleNamespace(prefix, uri) - } - - /** - * Calls `turtleWriter.startRDF()`. - */ - override def startRDF(): Unit = { - turtleWriter.startRDF() - } -} diff --git a/webapi/src/main/scala/org/knora/webapi/util/TransformData.scala b/webapi/src/main/scala/org/knora/webapi/util/TransformData.scala deleted file mode 100644 index 5232d77a72..0000000000 --- a/webapi/src/main/scala/org/knora/webapi/util/TransformData.scala +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Copyright © 2015-2019 the contributors (see Contributors.md). - * - * This file is part of Knora. - * - * Knora is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Knora is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with Knora. If not, see . - */ - -package org.knora.webapi.util - -import java.io._ - -import com.typesafe.scalalogging.Logger -import org.eclipse.rdf4j.model.impl.SimpleValueFactory -import org.eclipse.rdf4j.model.{Resource, Statement} -import org.eclipse.rdf4j.rio.turtle._ -import org.eclipse.rdf4j.rio.{RDFHandler, RDFWriter} -import org.knora.webapi.OntologyConstants.KnoraBase.KnoraBasePrefixExpansion -import org.knora.webapi.messages.admin.responder.permissionsmessages.{PermissionADM, PermissionType} -import org.knora.webapi.messages.v1.responder.valuemessages._ -import org.knora.webapi.util.PermissionUtilADM.EntityPermission -import org.knora.webapi.{IRI, InconsistentTriplestoreDataException, OntologyConstants} -import org.rogach.scallop._ -import org.slf4j.LoggerFactory - -/** - * An enumeration of the possible names of a standoff tag submitted as a JSON `textattr`. Note: do not use the `withName` method to get instances - * of the values of this enumeration; use `lookup` instead, because it reports errors better. - */ -object LegacyTextattrV1 extends Enumeration { - - // internal name / standoff tag name in JSON representation / corresponding HTML tag (generated by the GUI) - val paragraph: LegacyTextattrV1.Value = Value("p") - //

...

- val italic: LegacyTextattrV1.Value = Value("italic") - // ... - val bold: LegacyTextattrV1.Value = Value("bold") - // ... - val underline: LegacyTextattrV1.Value = Value("underline") - // ... - val strikethrough: LegacyTextattrV1.Value = Value("strikethrough") - // ... - val link: LegacyTextattrV1.Value = Value("_link") - // ... - val header1: LegacyTextattrV1.Value = Value("h1") - //

...

- val header2: LegacyTextattrV1.Value = Value("h2") - //

...

- val header3: LegacyTextattrV1.Value = Value("h3") - //

...

- val header4: LegacyTextattrV1.Value = Value("h4") - //

...

- val header5: LegacyTextattrV1.Value = Value("h5") - //
...
- val header6: LegacyTextattrV1.Value = Value("h6") - //
...
- val superscript: LegacyTextattrV1.Value = Value("sup") - // ... - val subscript: LegacyTextattrV1.Value = Value("sub") - // ... - val orderedList: LegacyTextattrV1.Value = Value("ol") - //
    ...
- val unorderedList: LegacyTextattrV1.Value = Value("ul") - //
    ...
- val listElement: LegacyTextattrV1.Value = Value("li") - //
  • ...
  • - val styleElement: LegacyTextattrV1.Value = Value("style") // ... - - val valueMap: Map[String, Value] = values.map(v => (v.toString, v)).toMap - - /** - * Given the name of a value in this enumeration, returns the value. If the value is not found, the provided error function is called. - * - * @param name the name of the value. - * @param errorFun the function to be called in case of an error. - * @return the requested value. - */ - def lookup(name: String, errorFun: => Nothing): Value = { - valueMap.get(name) match { - case Some(value) => value - case None => errorFun - } - } - - /** - * Maps standoff tag IRIs to this enumeration's values. - */ - val iriToEnumValue: Map[IRI, LegacyTextattrV1.Value] = new ErrorHandlingMap(Map( - OntologyConstants.Standoff.StandoffParagraphTag -> paragraph, - OntologyConstants.Standoff.StandoffItalicTag -> italic, - OntologyConstants.Standoff.StandoffBoldTag -> bold, - OntologyConstants.Standoff.StandoffUnderlineTag -> underline, - OntologyConstants.Standoff.StandoffStrikethroughTag -> strikethrough, - OntologyConstants.KnoraBase.StandoffLinkTag -> link, - OntologyConstants.KnoraBase.StandoffUriTag -> link, - OntologyConstants.Standoff.StandoffHeader1Tag -> header1, - OntologyConstants.Standoff.StandoffHeader2Tag -> header2, - OntologyConstants.Standoff.StandoffHeader3Tag -> header3, - OntologyConstants.Standoff.StandoffHeader4Tag -> header4, - OntologyConstants.Standoff.StandoffHeader5Tag -> header5, - OntologyConstants.Standoff.StandoffHeader6Tag -> header6, - OntologyConstants.Standoff.StandoffSuperscriptTag -> superscript, - OntologyConstants.Standoff.StandoffSubscriptTag -> subscript, - OntologyConstants.Standoff.StandoffOrderedListTag -> orderedList, - OntologyConstants.Standoff.StandoffUnorderedListTag -> unorderedList, - OntologyConstants.Standoff.StandoffListElementTag -> listElement, - OntologyConstants.Standoff.StandoffStyleElementTag -> styleElement - ), { key => throw InconsistentTriplestoreDataException(s"Invalid standoff tag IRI: $key") }) - - - // Maps this enumeration's values to standoff tag IRIs. - - val enumValueToIri: Map[LegacyTextattrV1.Value, IRI] = new ErrorHandlingMap(iriToEnumValue.map(_.swap), { key => throw InconsistentTriplestoreDataException(s"Invalid standoff tag name: $key") }) -} - -/** - * Updates the structure of Knora repository data to accommodate changes in Knora. - */ -object TransformData extends App { - - private val log = Logger(LoggerFactory.getLogger(this.getClass)) - - private val IsDeletedTransformationOption = "deleted" - private val PermissionsTransformationOption = "permissions" - private val JulianDayTransformation = "jdn" - // jdn must be run before strings - private val MissingValueHasStringTransformationOption = "strings" - private val RegionLabelTransformation = "regionlabels" - private val ValueProjectTransformationOption = "valueproject" - private val PreviewTransformationOption = "preview" - private val AllTransformationsOption = "all" - - private val allTransformations = Vector( - JulianDayTransformation, - IsDeletedTransformationOption, - PermissionsTransformationOption, - MissingValueHasStringTransformationOption, - RegionLabelTransformation, - ValueProjectTransformationOption, - PreviewTransformationOption - ) - - private val TempFilePrefix = "TransformData" - private val TempFileSuffix = ".ttl" - - private val HasRestrictedViewPermission = "http://www.knora.org/ontology/knora-base#hasRestrictedViewPermission" - private val HasViewPermission = "http://www.knora.org/ontology/knora-base#hasViewPermission" - private val HasModifyPermission = "http://www.knora.org/ontology/knora-base#hasModifyPermission" - private val HasDeletePermission = "http://www.knora.org/ontology/knora-base#hasDeletePermission" - private val HasChangeRightsPermission = "http://www.knora.org/ontology/knora-base#hasChangeRightsPermission" - private val HasChangeRightsPermisson = "http://www.knora.org/ontology/knora-base#hasChangeRightsPermisson" // This misspelling occurs in some old test data - - private val allOldPermissions = Set( - HasRestrictedViewPermission, - HasViewPermission, - HasModifyPermission, - HasDeletePermission, - HasChangeRightsPermission, - HasChangeRightsPermisson - ) - - private val oldPermissionIri2EntityPermission: Map[IRI, EntityPermission] = Map( - HasRestrictedViewPermission -> PermissionUtilADM.RestrictedViewPermission, - HasViewPermission -> PermissionUtilADM.ViewPermission, - HasModifyPermission -> PermissionUtilADM.ModifyPermission, - HasDeletePermission -> PermissionUtilADM.DeletePermission, - HasChangeRightsPermission -> PermissionUtilADM.ChangeRightsPermission, - HasChangeRightsPermisson -> PermissionUtilADM.ChangeRightsPermission - ) - - private val StandardClassesWithoutIsDeleted = Set( - OntologyConstants.KnoraAdmin.User, - OntologyConstants.KnoraAdmin.UserGroup, - OntologyConstants.KnoraAdmin.KnoraProject, - OntologyConstants.KnoraAdmin.Institution, - OntologyConstants.KnoraBase.ListNode - ) - - private val ValueHasStartJDC = "http://www.knora.org/ontology/knora-base#valueHasStartJDC" - private val ValueHasEndJDC = "http://www.knora.org/ontology/knora-base#valueHasEndJDC" - - // A Map of old standoff class IRIs to new ones - private val standoffClassMap = Map( - "http://www.knora.org/ontology/knora-base#StandoffRootTag" -> OntologyConstants.Standoff.StandoffRootTag, - "http://www.knora.org/ontology/knora-base#StandoffParagraphTag" -> OntologyConstants.Standoff.StandoffParagraphTag, - "http://www.knora.org/ontology/knora-base#StandoffItalicTag" -> OntologyConstants.Standoff.StandoffItalicTag, - "http://www.knora.org/ontology/knora-base#StandoffBoldTag" -> OntologyConstants.Standoff.StandoffBoldTag, - "http://www.knora.org/ontology/knora-base#StandoffUnderlineTag" -> OntologyConstants.Standoff.StandoffUnderlineTag, - "http://www.knora.org/ontology/knora-base#StandoffStrikethroughTag" -> OntologyConstants.Standoff.StandoffStrikethroughTag, - "http://www.knora.org/ontology/knora-base#StandoffHeader1Tag" -> OntologyConstants.Standoff.StandoffHeader1Tag, - "http://www.knora.org/ontology/knora-base#StandoffHeader2Tag" -> OntologyConstants.Standoff.StandoffHeader2Tag, - "http://www.knora.org/ontology/knora-base#StandoffHeader3Tag" -> OntologyConstants.Standoff.StandoffHeader3Tag, - "http://www.knora.org/ontology/knora-base#StandoffHeader4Tag" -> OntologyConstants.Standoff.StandoffHeader4Tag, - "http://www.knora.org/ontology/knora-base#StandoffHeader5Tag" -> OntologyConstants.Standoff.StandoffHeader5Tag, - "http://www.knora.org/ontology/knora-base#StandoffHeader6Tag" -> OntologyConstants.Standoff.StandoffHeader6Tag, - "http://www.knora.org/ontology/knora-base#StandoffSuperscriptTag" -> OntologyConstants.Standoff.StandoffSuperscriptTag, - "http://www.knora.org/ontology/knora-base#StandoffSubscriptTag" -> OntologyConstants.Standoff.StandoffSubscriptTag, - "http://www.knora.org/ontology/knora-base#StandoffOrderedListTag" -> OntologyConstants.Standoff.StandoffOrderedListTag, - "http://www.knora.org/ontology/knora-base#StandoffUnorderedListTag" -> OntologyConstants.Standoff.StandoffUnorderedListTag, - "http://www.knora.org/ontology/knora-base#StandoffListElementTag" -> OntologyConstants.Standoff.StandoffListElementTag, - "http://www.knora.org/ontology/knora-base#StandoffStyleTag" -> OntologyConstants.Standoff.StandoffStyleElementTag - ) - - private val conf = new TransformDataConf(args) - private val transformationOption = conf.transform() - private val inputFile = new File(conf.input()) - private val outputFile = new File(conf.output()) - - if (transformationOption == AllTransformationsOption) { - runAllTransformations(inputFile, outputFile) - } else { - runTransformation(transformationOption, inputFile, outputFile) - } - - /** - * Runs all transformations, using temporary files as needed. - * - * @param inputFile the input file. - * @param outputFile the output file. - */ - private def runAllTransformations(inputFile: File, outputFile: File): Unit = { - /** - * Associates a transformation with an input file and and output file, either of which may be a temporary file. - * - * @param transformation the name of the transformation. - * @param inputFileForTrans the input file to be used for the transformation. - * @param outputFileForTrans the output file to be used for the transformation. - */ - case class TransformationWithFiles(transformation: String, inputFileForTrans: File, outputFileForTrans: File) - - // Make a list of transformations to be run, with an input file and an output file for each one, generating - // temporary file names as needed. - val transformationsWithFiles: Vector[TransformationWithFiles] = allTransformations.foldLeft(Vector.empty[TransformationWithFiles]) { - case (acc, trans) => - // Is this is the first transformation? - val inputFileForTrans = if (trans == allTransformations.head) { - // Yes. Use the user's input file as the input file for the transformation. - inputFile - } else { - // No. Use the previous transformation's output file as the input file for this transformation. - acc.last.outputFileForTrans - } - - // Is this the last transformation? - val outputFileForTrans = if (trans == allTransformations.last) { - // Yes. Use the user's output file as the output file for the transformation. - outputFile - } else { - // No. Use a temporary file. - File.createTempFile(TempFilePrefix, TempFileSuffix) - } - - acc :+ TransformationWithFiles( - transformation = trans, - inputFileForTrans = inputFileForTrans, - outputFileForTrans = outputFileForTrans - ) - } - - // Run all the transformations. - for (transformationWithFiles <- transformationsWithFiles) { - runTransformation( - transformation = transformationWithFiles.transformation, - inputFile = transformationWithFiles.inputFileForTrans, - outputFile = transformationWithFiles.outputFileForTrans - ) - } - } - - /** - * Runs the specified transformation. - * - * @param transformation the name of the transformation to be run. - * @param inputFile the input file. - * @param outputFile the output file. - */ - private def runTransformation(transformation: String, inputFile: File, outputFile: File): Unit = { - // println(s"Running transformation $transformation with inputFile $inputFile and outputFile $outputFile") - - val fileInputStream = new FileInputStream(inputFile) - val fileOutputStream = new FileOutputStream(outputFile) - val turtleParser = new TurtleParser() - val turtleWriter = new TurtleWriter(fileOutputStream) - - val handler = transformation match { - case IsDeletedTransformationOption => new IsDeletedHandler(turtleWriter) - case PermissionsTransformationOption => new PermissionsHandler(turtleWriter) - case MissingValueHasStringTransformationOption => new ValueHasStringHandler(turtleWriter) - case RegionLabelTransformation => new RegionLabelHandler(turtleWriter) - case JulianDayTransformation => new JDNHandler(turtleWriter) - case ValueProjectTransformationOption => new ValueProjectHandler(turtleWriter) - case PreviewTransformationOption => new PreviewHandler(turtleWriter) - case _ => throw new Exception(s"Unsupported transformation $transformation") - } - - turtleParser.setRDFHandler(handler) - turtleParser.parse(fileInputStream, inputFile.getAbsolutePath) - fileOutputStream.close() - fileInputStream.close() - } - - private class PreviewHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - private val IsPreview: IRI = KnoraBasePrefixExpansion + "isPreview" - private val QualityLevel: IRI = KnoraBasePrefixExpansion + "qualityLevel" - private val ValueHasQname: IRI = KnoraBasePrefixExpansion + "valueHasQname" - private val obsoletePredicates = Set(IsPreview, QualityLevel, ValueHasQname) - - override def endRDF(): Unit = { - val previewImageIris: Set[IRI] = statements.foldLeft(Set.empty[IRI]) { - case (acc, (subject, subjectStatements: Vector[Statement])) => - if (subjectStatements.exists(statement => statement.getPredicate.stringValue == IsPreview && statement.getObject.stringValue.toBoolean)) { - acc + subject.stringValue - } else { - acc - } - } - - statements.foreach { - case (subject, subjectStatements: Vector[Statement]) => - if (!previewImageIris.contains(subject.stringValue)) { - subjectStatements.foreach { - statement => - if (!(previewImageIris.contains(statement.getObject.stringValue) || - obsoletePredicates.contains(statement.getPredicate.stringValue))) { - turtleWriter.handleStatement(statement) - } - } - } - } - - turtleWriter.endRDF() - } - } - - /** - * Looks for regions that have the label "test" and changes their label to the value of their `knora-base:hasComment`. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class RegionLabelHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - override def endRDF(): Unit = { - statements.foreach { - case (_, subjectStatements: Vector[Statement]) => - val subjectType = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.Rdf.Type).get.getObject.stringValue - val label = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.Rdfs.Label).map(_.getObject.stringValue) - - val newLabel = if (subjectType == OntologyConstants.KnoraBase.Region && (label.isEmpty || label.contains("test"))) { - val commentIri = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.KnoraBase.HasComment).get.getObject.stringValue - Some(statements(valueFactory.createIRI(commentIri)).find(_.getPredicate.stringValue == OntologyConstants.KnoraBase.ValueHasString).get.getObject.stringValue) - } else { - label - } - - subjectStatements.foreach { - statement => - val newStatement = if (statement.getPredicate.stringValue == OntologyConstants.Rdfs.Label) { - valueFactory.createStatement( - statement.getSubject, - statement.getPredicate, - valueFactory.createLiteral(newLabel.get) - ) - } else { - statement - } - - turtleWriter.handleStatement(newStatement) - } - - } - - turtleWriter.endRDF() - } - } - - /** - * Adds `knora-base:isDeleted false` to resources and values that don't have a `knora-base:isDeleted` predicate. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class IsDeletedHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - override def endRDF(): Unit = { - statements.foreach { - case (_, subjectStatements: Vector[Statement]) => - // Check whether the subject already has a knora-base:isDeleted predicate. - val hasIsDeleted = subjectStatements.exists(_.getPredicate.stringValue == OntologyConstants.KnoraBase.IsDeleted) - val isStandoff = subjectStatements.exists(_.getPredicate.stringValue == OntologyConstants.KnoraBase.StandoffTagHasStart) - - subjectStatements.foreach { - statement => - turtleWriter.handleStatement(statement) - - // If this statement provides the rdf:type of the subject, and the subject doesn't have a - // knora-base:isDeleted predicate, check whether it needs one. - if (statement.getPredicate.stringValue == OntologyConstants.Rdf.Type && !hasIsDeleted) { - val rdfType = statement.getObject.stringValue - - // If the rdf:type isn't one of the standard classes that can't be marked as deleted, - // and the subject isn't a standoff tag, assume it must be a Resource or Value, - // and add knora-base:isDeleted false. - if (!(StandardClassesWithoutIsDeleted.contains(rdfType) || isStandoff)) { - val isDeletedStatement = valueFactory.createStatement( - statement.getSubject, - valueFactory.createIRI(OntologyConstants.KnoraBase.IsDeleted), - valueFactory.createLiteral(false) - ) - - turtleWriter.handleStatement(isDeletedStatement) - } - } - } - } - - turtleWriter.endRDF() - } - } - - /** - * Transforms old-style Knora permissions statements into new-style permissions statements. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class PermissionsHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - override def endRDF(): Unit = { - statements.foreach { - case (subject: Resource, subjectStatements: Vector[Statement]) => - // Write the statements about each resource. - val subjectPermissions = subjectStatements.foldLeft(Map.empty[EntityPermission, Set[IRI]]) { - case (acc, st) => - val predicateStr = st.getPredicate.stringValue - - // If a statement describes an old-style permission, save it. - if (allOldPermissions.contains(predicateStr)) { - val group = st.getObject.stringValue() - val accessPermission = oldPermissionIri2EntityPermission(predicateStr) - val currentGroupsForPermission = acc.getOrElse(accessPermission, Set.empty[IRI]) - acc + (accessPermission -> (currentGroupsForPermission + group)) - } else { - // Otherwise, write it. - turtleWriter.handleStatement(st) - acc - } - } - - // Write the resource's permissions as a single statement. - if (subjectPermissions.nonEmpty) { - val permissionADMs: Set[PermissionADM] = subjectPermissions.toVector.flatMap { - case (accessPermission, groups) => groups.map { - group => - PermissionADM( - name = accessPermission.toString, - additionalInformation = Some(group), - permissionCode = Some(accessPermission.toInt) - ) - } - }.toSet - - val permissionLiteral = PermissionUtilADM.formatPermissionADMs(permissionADMs, PermissionType.OAP) - - val permissionStatement = valueFactory.createStatement( - subject, - valueFactory.createIRI(OntologyConstants.KnoraBase.HasPermissions), - valueFactory.createLiteral(permissionLiteral) - ) - - turtleWriter.handleStatement(permissionStatement) - } - } - - turtleWriter.endRDF() - } - } - - /** - * Adds missing `knora-base:valueHasString` statements. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class ValueHasStringHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - - private def maybeWriteValueHasString(subject: Resource, subjectStatements: Vector[Statement]): Unit = { - val resourceClass = getObject(subjectStatements, OntologyConstants.Rdf.Type).get - - // Is this Knora value object? - if (resourceClass.startsWith(OntologyConstants.KnoraBase.KnoraBasePrefixExpansion) && resourceClass.endsWith("Value")) { - // Yes. Does it already have a valueHasString? - val maybeValueHasStringStatement: Option[Statement] = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.KnoraBase.ValueHasString) - - if (maybeValueHasStringStatement.isEmpty) { - // No. Generate one. - - val stringLiteral = resourceClass match { - case OntologyConstants.KnoraBase.IntValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasInteger).get - case OntologyConstants.KnoraBase.BooleanValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasBoolean).get - case OntologyConstants.KnoraBase.UriValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasUri).get - case OntologyConstants.KnoraBase.DecimalValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasDecimal).get - - case OntologyConstants.KnoraBase.DateValue => - val startJDN = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasStartJDN).get - val endJDN = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasEndJDN).get - val startPrecision = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasStartPrecision).get - val endPrecision = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasEndPrecision).get - val calendar = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasCalendar).get - - val jdnValue = JulianDayNumberValueV1( - dateval1 = startJDN.toInt, - dateval2 = endJDN.toInt, - calendar = KnoraCalendarV1.lookup(calendar), - dateprecision1 = KnoraPrecisionV1.lookup(startPrecision), - dateprecision2 = KnoraPrecisionV1.lookup(endPrecision) - ) - - jdnValue.toString - - case OntologyConstants.KnoraBase.ColorValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasColor).get - case OntologyConstants.KnoraBase.GeomValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasGeometry).get - case OntologyConstants.KnoraBase.StillImageFileValue => getObject(subjectStatements, OntologyConstants.KnoraBase.OriginalFilename).get - case OntologyConstants.KnoraBase.ListValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasListNode).get - - case OntologyConstants.KnoraBase.IntervalValue => - val intervalStart = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasIntervalStart).get - val intervalEnd = getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasIntervalEnd).get - - val intervalValue = IntervalValueV1( - timeval1 = BigDecimal(intervalStart), - timeval2 = BigDecimal(intervalEnd) - ) - - intervalValue.toString - - case OntologyConstants.KnoraBase.GeonameValue => getObject(subjectStatements, OntologyConstants.KnoraBase.ValueHasGeonameCode).get - case OntologyConstants.KnoraBase.LinkValue => getObject(subjectStatements, OntologyConstants.Rdf.Object).get - - case _ => throw InconsistentTriplestoreDataException(s"Unsupported value type $resourceClass") - } - - val valueHasStringStatement = valueFactory.createStatement( - subject, - valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasString), - valueFactory.createLiteral(stringLiteral) - ) - - turtleWriter.handleStatement(valueHasStringStatement) - } - } - } - - override def endRDF(): Unit = { - statements.foreach { - case (subject: Resource, subjectStatements: Vector[Statement]) => - subjectStatements.foreach(st => turtleWriter.handleStatement(st)) - maybeWriteValueHasString(subject, subjectStatements) - } - - turtleWriter.endRDF() - } - } - - /** - * Replaces `knora-base:valueHasStartJDC` with `knora-base:valueHasStartJDN` and `knora-base:valueHasEndJDC` - * with `knora-base:valueHasEndJDN`. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class JDNHandler(turtleWriter: RDFWriter) extends RDFHandler { - private val valueFactory = SimpleValueFactory.getInstance() - - override def handleComment(comment: IRI): Unit = { - turtleWriter.handleComment(comment) - } - - override def handleStatement(st: Statement): Unit = { - val newPredicate = st.getPredicate.stringValue match { - case ValueHasStartJDC => valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasStartJDN) - case ValueHasEndJDC => valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasEndJDN) - case _ => st.getPredicate - } - - turtleWriter.handleStatement(valueFactory.createStatement( - st.getSubject, - newPredicate, - st.getObject - )) - } - - override def endRDF(): Unit = { - turtleWriter.endRDF() - } - - override def handleNamespace(prefix: IRI, uri: IRI): Unit = { - turtleWriter.handleNamespace(prefix, uri) - } - - override def startRDF(): Unit = { - turtleWriter.startRDF() - } - } - - /** - * Removes `knora-base:attachedToProject` from Knora values. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class ValueProjectHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - override def endRDF(): Unit = { - statements.foreach { - case (subject: Resource, subjectStatements: Vector[Statement]) => - val rdfType = getObject(subjectStatements = subjectStatements, predicateIri = OntologyConstants.Rdf.Type).getOrElse(s"Subject $subject has no rdf:type") - - val statementsToWrite = if (OntologyConstants.KnoraBase.ValueClasses.contains(rdfType)) { - subjectStatements.filter(_.getPredicate.stringValue != OntologyConstants.KnoraBase.AttachedToProject) - } else { - subjectStatements - } - - statementsToWrite.foreach { - statement => turtleWriter.handleStatement(statement) - } - } - - turtleWriter.endRDF() - } - } - - - /** - * Parses command-line arguments. - */ - private class TransformDataConf(arguments: Seq[String]) extends ScallopConf(arguments) { - banner( - s""" - |Updates the structure of Knora repository data to accommodate changes in Knora. - | - |Usage: org.knora.webapi.util.TransformData -t [$IsDeletedTransformationOption|$PermissionsTransformationOption|$MissingValueHasStringTransformationOption|$RegionLabelTransformation|$JulianDayTransformation|$ValueProjectTransformationOption|$PreviewTransformationOption|$AllTransformationsOption] input output - """.stripMargin) - - val transform: ScallopOption[String] = opt[String]( - required = true, - validate = t => Set(IsDeletedTransformationOption, PermissionsTransformationOption, MissingValueHasStringTransformationOption, RegionLabelTransformation, JulianDayTransformation, ValueProjectTransformationOption, PreviewTransformationOption, AllTransformationsOption).contains(t), - descr = s"Selects a transformation. Available transformations: '$IsDeletedTransformationOption' (adds missing 'knora-base:isDeleted' statements), '$PermissionsTransformationOption' (combines old-style multiple permission statements into single permission statements), '$MissingValueHasStringTransformationOption' (adds missing valueHasString), '$RegionLabelTransformation' (fixes the labels of regions whose label is 'test'), '$JulianDayTransformation' (changes Julian Day Count to Julian Day Number), '$ValueProjectTransformationOption' (removes 'knora-base:attachedToProject' from values), '$PreviewTransformationOption' (removes preview images), '$AllTransformationsOption'" - ) - - val input: ScallopOption[String] = trailArg[String](required = true, descr = "Input Turtle file") - val output: ScallopOption[String] = trailArg[String](required = true, descr = "Output Turtle file") - verify() - } - -} diff --git a/webapi/src/main/scala/org/knora/webapi/util/TransformOntology.scala b/webapi/src/main/scala/org/knora/webapi/util/TransformOntology.scala deleted file mode 100644 index 28e350a899..0000000000 --- a/webapi/src/main/scala/org/knora/webapi/util/TransformOntology.scala +++ /dev/null @@ -1,215 +0,0 @@ -package org.knora.webapi.util - -import java.io._ - -import com.typesafe.scalalogging.Logger -import org.eclipse.rdf4j.model.{Resource, Statement} -import org.eclipse.rdf4j.rio.RDFWriter -import org.eclipse.rdf4j.rio.helpers.BasicWriterSettings -import org.eclipse.rdf4j.rio.turtle._ -import org.knora.webapi.OntologyConstants -import org.rogach.scallop._ -import org.slf4j.LoggerFactory - -import scala.collection.immutable.TreeMap - -/** - * Updates the structure of an ontology to accommodate changes in Knora. - */ -object TransformOntology extends App { - private val log = Logger(LoggerFactory.getLogger(this.getClass)) - - private val TempFilePrefix = "TransformOntology" - private val TempFileSuffix = ".ttl" - - private val GuiOrderTransformationOption = "guiorder" - private val AllTransformationsOption = "all" - - private val allTransformations = Vector( - GuiOrderTransformationOption - ) - - private val conf = new TransformOntologyConf(args) - private val transformationOption = conf.transform() - private val inputFile = new File(conf.input()) - private val outputFile = new File(conf.output()) - - if (transformationOption == AllTransformationsOption) { - runAllTransformations(inputFile, outputFile) - } else { - runTransformation(transformationOption, inputFile, outputFile) - } - - /** - * Runs all transformations, using temporary files as needed. - * - * @param inputFile the input file. - * @param outputFile the output file. - */ - private def runAllTransformations(inputFile: File, outputFile: File): Unit = { - /** - * Associates a transformation with an input file and and output file, either of which may be a temporary file. - * - * @param transformation the name of the transformation. - * @param inputFileForTrans the input file to be used for the transformation. - * @param outputFileForTrans the output file to be used for the transformation. - */ - case class TransformationWithFiles(transformation: String, inputFileForTrans: File, outputFileForTrans: File) - - // Make a list of transformations to be run, with an input file and an output file for each one, generating - // temporary file names as needed. - val transformationsWithFiles: Vector[TransformationWithFiles] = allTransformations.foldLeft(Vector.empty[TransformationWithFiles]) { - case (acc, trans) => - // Is this is the first transformation? - val inputFileForTrans = if (trans == allTransformations.head) { - // Yes. Use the user's input file as the input file for the transformation. - inputFile - } else { - // No. Use the previous transformation's output file as the input file for this transformation. - acc.last.outputFileForTrans - } - - // Is this the last transformation? - val outputFileForTrans = if (trans == allTransformations.last) { - // Yes. Use the user's output file as the output file for the transformation. - outputFile - } else { - // No. Use a temporary file. - File.createTempFile(TempFilePrefix, TempFileSuffix) - } - - acc :+ TransformationWithFiles( - transformation = trans, - inputFileForTrans = inputFileForTrans, - outputFileForTrans = outputFileForTrans - ) - } - - // Run all the transformations. - for (transformationWithFiles <- transformationsWithFiles) { - runTransformation( - transformation = transformationWithFiles.transformation, - inputFile = transformationWithFiles.inputFileForTrans, - outputFile = transformationWithFiles.outputFileForTrans - ) - } - } - - /** - * Runs the specified transformation. - * - * @param transformation the name of the transformation to be run. - * @param inputFile the input file. - * @param outputFile the output file. - */ - private def runTransformation(transformation: String, inputFile: File, outputFile: File): Unit = { - // println(s"Running transformation $transformation with inputFile $inputFile and outputFile $outputFile") - - val fileInputStream = new FileInputStream(inputFile) - val fileOutputStream = new FileOutputStream(outputFile) - val turtleParser = new TurtleParser() - val turtleWriter = new TurtleWriterFactory().getWriter(fileOutputStream) - turtleWriter.getWriterConfig.set[java.lang.Boolean](BasicWriterSettings.PRETTY_PRINT, true).set[java.lang.Boolean](BasicWriterSettings.INLINE_BLANK_NODES, true) - - val handler = transformation match { - case GuiOrderTransformationOption => new GuiOrderHandler(turtleWriter) - - case _ => throw new Exception(s"Unsupported transformation $transformation") - } - - turtleParser.setRDFHandler(handler) - turtleParser.parse(fileInputStream, inputFile.getAbsolutePath) - fileOutputStream.close() - fileInputStream.close() - } - - /** - * Moves `salsah-gui:guiOrder` from property definitions into cardinalities. - * - * @param turtleWriter an [[RDFWriter]] that writes to the output file. - */ - private class GuiOrderHandler(turtleWriter: RDFWriter) extends StatementCollectingHandler(turtleWriter: RDFWriter) { - override def endRDF(): Unit = { - var guiOrders: TreeMap[Resource, Int] = TreeMap.empty[Resource, Int] - var statementsWithoutGuiOrders: TreeMap[Resource, Vector[Statement]] = TreeMap.empty[Resource, Vector[Statement]] - - statements.foreach { - case (subject: Resource, subjectStatements: Vector[Statement]) => - val subjectType = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.Rdf.Type).get.getObject.stringValue - - if (subjectType == OntologyConstants.Owl.ObjectProperty) { - val maybeGuiOrderStatement = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.SalsahGui.GuiOrder) - - maybeGuiOrderStatement match { - case Some(guiOrderStatement: Statement) => - val guiOrder = guiOrderStatement.getObject.stringValue.toInt - guiOrders += (subject -> guiOrder) - val subjectStatementsWithoutGuiOrders = subjectStatements.filterNot(_.getPredicate.stringValue == OntologyConstants.SalsahGui.GuiOrder) - statementsWithoutGuiOrders += (subject -> subjectStatementsWithoutGuiOrders) - - case None => - statementsWithoutGuiOrders += (subject -> subjectStatements) - } - } else { - statementsWithoutGuiOrders += (subject -> subjectStatements) - } - } - - statementsWithoutGuiOrders.foreach { - case (subject: Resource, subjectStatements: Vector[Statement]) => - val subjectType = subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.Rdf.Type).get.getObject.stringValue - - val outputStatements = if (subjectType == OntologyConstants.Owl.Restriction) { - val onProperty = valueFactory.createIRI(subjectStatements.find(_.getPredicate.stringValue == OntologyConstants.Owl.OnProperty).get.getObject.stringValue) - - guiOrders.get(onProperty) match { - case Some(guiOrder) => - val guiOrderStatement = valueFactory.createStatement( - subject, - valueFactory.createIRI(OntologyConstants.SalsahGui.GuiOrder), - valueFactory.createLiteral(guiOrder) - ) - - subjectStatements :+ guiOrderStatement - - case None => - subjectStatements - } - } else { - subjectStatements - } - - for (statement <- outputStatements) { - turtleWriter.handleStatement(statement) - } - } - - turtleWriter.endRDF() - } - } - - /** - * Parses command-line arguments. - */ - private class TransformOntologyConf(arguments: Seq[String]) extends ScallopConf(arguments) { - banner( - s""" - |Updates the structure of a Knora ontology to accommodate changes in Knora. - | - |Usage: org.knora.webapi.util.TransformOntology -t [$GuiOrderTransformationOption|$AllTransformationsOption] input output - """.stripMargin) - - val transform: ScallopOption[String] = opt[String]( - required = true, - validate = { - t => Set(GuiOrderTransformationOption, AllTransformationsOption).contains(t) - }, - descr = s"Selects a transformation. Available transformations: '$GuiOrderTransformationOption' (moves 'salsah-gui:guiOrder' from properties to cardinalities), '$AllTransformationsOption' (all of the above)" - ) - - val input: ScallopOption[String] = trailArg[String](required = true, descr = "Input Turtle file") - val output: ScallopOption[String] = trailArg[String](required = true, descr = "Output Turtle file") - verify() - } - -} diff --git a/webapi/src/main/scala/org/knora/webapi/util/jsonld/JsonLDUtil.scala b/webapi/src/main/scala/org/knora/webapi/util/jsonld/JsonLDUtil.scala index e373ab3d79..982d4d96fc 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/jsonld/JsonLDUtil.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/jsonld/JsonLDUtil.scala @@ -810,7 +810,7 @@ object JsonLDUtil { val context: java.util.HashMap[String, Any] = new java.util.HashMap[String, Any]() val options: JsonLdOptions = new JsonLdOptions() val compact: java.util.Map[IRI, AnyRef] = JsonLdProcessor.compact(jsonObject, context, options) - val scalaColl: Any = JavaUtil.deepJavatoScala(compact) + val scalaColl: Any = JavaUtil.deepJavaToScala(compact) val scalaMap: Map[String, Any] = try { scalaColl.asInstanceOf[Map[String, Any]] diff --git a/webapi/src/test/resources/logback-test.xml b/webapi/src/test/resources/logback-test.xml index 5b3b8c8013..8fdc8a26d9 100644 --- a/webapi/src/test/resources/logback-test.xml +++ b/webapi/src/test/resources/logback-test.xml @@ -59,7 +59,7 @@ - + diff --git a/webapi/src/test/resources/test-data/update/pr1307.trig b/webapi/src/test/resources/test-data/update/pr1307.trig new file mode 100644 index 0000000000..a260d149ac --- /dev/null +++ b/webapi/src/test/resources/test-data/update/pr1307.trig @@ -0,0 +1,100 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix standoff: . +@prefix anything: . + + { + a anything:Thing; + rdfs:label "Something with a lot of markup"; + knora-base:isDeleted false; + knora-base:attachedToProject ; + knora-base:creationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; + knora-base:attachedToUser ; + anything:hasRichtext . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueHasStandoff , + , + , + , + , + , + , + ; + knora-base:valueHasMapping ; + knora-base:valueCreationDate "2018-05-30T13:44:11.749Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "Something with a lot of different markup. And more markup."; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; + knora-base:attachedToUser . + + + a standoff:StandoffBoldTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 9; + knora-base:standoffTagHasStartIndex 2; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "7f3af890-c77d-4bf8-a81c-6786632520dd" . + + + a standoff:StandoffSuperscriptTag; + knora-base:standoffTagHasStart 34; + knora-base:standoffTagHasEnd 40; + knora-base:standoffTagHasStartIndex 6; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "e2ab65d2-6c80-494e-88ba-66767ed885f9" . + + + a standoff:StandoffParagraphTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 58; + knora-base:standoffTagHasStartIndex 1; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "f3c0773a-2eb3-4d2e-9a6f-c8f2582a146e" . + + + a knora-base:StandoffUriTag; + knora-base:standoffTagHasStart 51; + knora-base:standoffTagHasEnd 57; + knora-base:standoffTagHasStartIndex 7; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "7b9f4609-3ba6-43e5-b945-d4329a155ca7"; + knora-base:valueHasUri "http://www.google.ch"^^xsd:anyURI . + + + a standoff:StandoffUnderlineTag; + knora-base:standoffTagHasStart 24; + knora-base:standoffTagHasEnd 33; + knora-base:standoffTagHasStartIndex 5; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "df348cfa-c362-45e6-9e13-601442214064" . + + + a standoff:StandoffRootTag; + knora-base:standoffTagHasStart 0; + knora-base:standoffTagHasEnd 59; + knora-base:standoffTagHasStartIndex 0; + knora-base:standoffTagHasUUID "c41e4e78-8b4f-47fc-9d17-8af0a279c80c" . + + + a standoff:StandoffItalicTag; + knora-base:standoffTagHasStart 10; + knora-base:standoffTagHasEnd 14; + knora-base:standoffTagHasStartIndex 3; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "13f66d42-2b1f-4fb4-91aa-6c55e350b0f4" . + + + a standoff:StandoffStrikethroughTag; + knora-base:standoffTagHasStart 17; + knora-base:standoffTagHasEnd 20; + knora-base:standoffTagHasStartIndex 4; + knora-base:standoffTagHasStartParent ; + knora-base:standoffTagHasUUID "0aaa6e47-0e9b-494f-9b6a-f42c66471d30" . +} diff --git a/webapi/src/test/resources/test-data/update/pr1322.trig b/webapi/src/test/resources/test-data/update/pr1322.trig new file mode 100644 index 0000000000..c3d8cc7662 --- /dev/null +++ b/webapi/src/test/resources/test-data/update/pr1322.trig @@ -0,0 +1,75 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with version history"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasInteger ; + anything:hasText . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 1; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 2; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 3; + knora-base:valueHasOrder 0; + knora-base:valueHasString "3"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "one"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "two"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "three"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . +} diff --git a/webapi/src/test/resources/test-data/update/pr1367.trig b/webapi/src/test/resources/test-data/update/pr1367.trig new file mode 100644 index 0000000000..fc02d1671a --- /dev/null +++ b/webapi/src/test/resources/test-data/update/pr1367.trig @@ -0,0 +1,28 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with a decimal value"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasDecimal . + + a knora-base:DecimalValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasDecimal "1.2"^^xsd:valueHasDecimal; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1.2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . +} diff --git a/webapi/src/test/resources/test-data/update/pr1372.trig b/webapi/src/test/resources/test-data/update/pr1372.trig new file mode 100644 index 0000000000..ff3ec1a66b --- /dev/null +++ b/webapi/src/test/resources/test-data/update/pr1372.trig @@ -0,0 +1,105 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix owl: . +@prefix knora-base: . +@prefix knora-admin: . +@prefix anything: . + + { + a anything:Thing; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:attachedToProject ; + rdfs:label "A thing with version history"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:creationDate "2019-02-08T15:05:10Z"^^xsd:dateTime; + knora-base:lastModificationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + anything:hasInteger ; + anything:hasText ; + anything:hasOtherThing ; + anything:hasOtherThingValue . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 1; + knora-base:valueHasOrder 0; + knora-base:valueHasString "1"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:IntValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 2; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:IntValue; + knora-base:valueHasUUID "pLlW4ODASumZfZFbJdpw1g"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-13T09:05:10Z"^^xsd:dateTime; + knora-base:valueHasInteger 3; + knora-base:valueHasOrder 0; + knora-base:valueHasString "3"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-10T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "one"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser . + + a knora-base:TextValue; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-11T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "two"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:TextValue; + knora-base:valueHasUUID "W5fm67e0QDWxRZumcXcs6g"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-02-12T10:05:10Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "three"; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:attachedToUser ; + knora-base:previousValue . + + a knora-base:LinkValue; + rdf:subject ; + rdf:predicate anything:hasOtherThing; + rdf:object ; + knora-base:isDeleted false; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueCreationDate "2019-02-10T10:30:10Z"^^xsd:dateTime; + knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; + knora-base:valueHasRefCount 1 . + + a knora-base:LinkValue; + knora-base:valueHasUUID "IZGOjVqxTfSNO4ieKyp0SA"^^xsd:string; + rdf:subject ; + rdf:predicate anything:hasOtherThing; + rdf:object ; + knora-base:isDeleted true; + knora-base:deleteDate "2019-02-13T09:00:10Z"^^xsd:dateTime; + knora-base:deletedBy ; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueCreationDate "2019-02-13T09:00:10Z"^^xsd:dateTime; + knora-base:valueHasString "http://rdfh.ch/0001/2qMtTWvVRXWMBcRNlduvCQ"; + knora-base:valueHasRefCount 0; + knora-base:previousValue . +} diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/JSONLDHandlingV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/JSONLDHandlingV2R2RSpec.scala index d7c604dc94..b813bbe064 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/JSONLDHandlingV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/JSONLDHandlingV2R2RSpec.scala @@ -83,9 +83,9 @@ class JSONLDHandlingV2R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - val receivedJSONLDAsScala: Map[IRI, Any] = JavaUtil.deepJavatoScala(JsonUtils.fromString(responseAs[String])).asInstanceOf[Map[IRI, Any]] + val receivedJSONLDAsScala: Map[IRI, Any] = JavaUtil.deepJavaToScala(JsonUtils.fromString(responseAs[String])).asInstanceOf[Map[IRI, Any]] - val expectedJSONLDAsScala: Map[IRI, Any] = JavaUtil.deepJavatoScala(JsonUtils.fromString(FileUtil.readTextFile(new File("src/test/resources/test-data/resourcesR2RV2/NarrenschiffFirstPage.jsonld")))).asInstanceOf[Map[String, Any]] + val expectedJSONLDAsScala: Map[IRI, Any] = JavaUtil.deepJavaToScala(JsonUtils.fromString(FileUtil.readTextFile(new File("src/test/resources/test-data/resourcesR2RV2/NarrenschiffFirstPage.jsonld")))).asInstanceOf[Map[String, Any]] assert(receivedJSONLDAsScala("@context") == expectedJSONLDAsScala("@context"), "@context incorrect") diff --git a/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307Spec.scala b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307Spec.scala new file mode 100644 index 0000000000..0a01a592b0 --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1307Spec.scala @@ -0,0 +1,160 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpdatePluginPR1307Spec extends UpdatePluginSpec { + "Update plugin PR1307" should { + "update text values with standoff" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/update/pr1307.trig") + + // Use the plugin to transform the input. + val plugin = new UpdatePluginPR1307 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that knora-base:valueHasMaxStandoffStartIndex was added. + + val query1: String = + """ + |PREFIX knora-base: + | + |SELECT ?s ?maxStartIndex WHERE { + | ?s knora-base:valueHasMaxStandoffStartIndex ?maxStartIndex . + |} + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query1, connection = connection) + + val expectedResult1: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "s" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ", + "maxStartIndex" -> "7" + ) + ) + ) + + assert(queryResult1.results == expectedResult1) + + // Check that the standoff tags' IRIs were changed correctly. + + val query2: String = + """ + |PREFIX knora-base: + | + |SELECT ?tag WHERE { + | knora-base:valueHasStandoff ?tag . + |} ORDER BY ?tag + |""".stripMargin + + val queryResult2: SparqlSelectResponse = doSelect(selectQuery = query2, connection = connection) + + val expectedResult2: SparqlSelectResponseBody = expectedResult( + Seq( + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6"), + Map("tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7") + ) + ) + + assert(queryResult2.results == expectedResult2) + + // Check that the objects of knora-base:standoffTagHasStartParent were changed correctly. + + val query3: String = + """ + |PREFIX knora-base: + | + |SELECT ?tag ?startIndex ?startParent WHERE { + | ?tag knora-base:standoffTagHasStartIndex ?startIndex . + | + | OPTIONAL { + | ?tag knora-base:standoffTagHasStartParent ?startParent . + | } + |} ORDER BY ?tag + |""".stripMargin + + val queryResult3: SparqlSelectResponse = doSelect(selectQuery = query3, connection = connection) + + val expectedResult3: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "startIndex" -> "0", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0" + ), + Map( + "startIndex" -> "1", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/0", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1" + ), + Map( + "startIndex" -> "2", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/2" + ), + Map( + "startIndex" -> "3", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/3" + ), + Map( + "startIndex" -> "4", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/4" + ), + Map( + "startIndex" -> "5", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/5" + ), + Map( + "startIndex" -> "6", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/6" + ), + Map( + "startIndex" -> "7", + "startParent" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/1", + "tag" -> "http://rdfh.ch/0001/qN1igiDRSAemBBktbRHn6g/values/xyUIf8QHS5aFrlt7Q4F1FQ/standoff/7" + ) + ) + ) + + assert(queryResult3.results == expectedResult3) + connection.close() + repository.shutDown() + } + } +} +*/ diff --git a/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322Spec.scala b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322Spec.scala new file mode 100644 index 0000000000..9b3188c43c --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1322Spec.scala @@ -0,0 +1,72 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpdatePluginPR1322Spec extends UpdatePluginSpec { + "Update plugin PR1322" should { + "add UUIDs to values" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/update/pr1322.trig") + + // Use the plugin to transform the input. + val plugin = new UpdatePluginPR1322 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that UUIDs were added. + + val query: String = + """ + |PREFIX knora-base: + | + |SELECT ?value WHERE { + | ?value knora-base:valueHasUUID ?valueHasUUID . + |} ORDER BY ?value + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query, connection = connection) + + val expectedResultBody: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/1c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/2c" + ) + ) + ) + + assert(queryResult1.results == expectedResultBody) + + connection.close() + repository.shutDown() + } + } +} +*/ diff --git a/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367Spec.scala b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367Spec.scala new file mode 100644 index 0000000000..9286f93da2 --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1367Spec.scala @@ -0,0 +1,52 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.impl.SimpleValueFactory +import org.eclipse.rdf4j.model.util.Models +import org.eclipse.rdf4j.model.{Literal, Model} +import org.knora.webapi.OntologyConstants +import org.knora.webapi.util.JavaUtil._ + +class UpdatePluginPR1367Spec extends UpdatePluginSpec { + private val valueFactory = SimpleValueFactory.getInstance + + "Update plugin PR1367" should { + "fix the datatypes of decimal literals" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/update/pr1367.trig") + + // Use the plugin to transform the input. + val plugin = new UpdatePluginPR1367 + plugin.transform(model) + + // Check that the decimal datatype was fixed. + val literal: Literal = Models.getPropertyLiteral( + model, + valueFactory.createIRI("http://rdfh.ch/0001/thing-with-history/values/1"), + valueFactory.createIRI(OntologyConstants.KnoraBase.ValueHasDecimal) + ).toOption.get + + assert(literal.getDatatype == valueFactory.createIRI(OntologyConstants.Xsd.Decimal)) + } + } +} +*/ diff --git a/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372Spec.scala b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372Spec.scala new file mode 100644 index 0000000000..f8c6cd1374 --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginPR1372Spec.scala @@ -0,0 +1,76 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.repository.sail.SailRepository +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody} + +class UpdatePluginPR1372Spec extends UpdatePluginSpec { + "Update plugin PR1372" should { + "remove permissions from past versions of values" in { + // Parse the input file. + val model: Model = trigFileToModel("src/test/resources/test-data/update/pr1372.trig") + + // Use the plugin to transform the input. + val plugin = new UpdatePluginPR1372 + plugin.transform(model) + + // Make an in-memory repository containing the transformed model. + val repository: SailRepository = makeRepository(model) + val connection = repository.getConnection + + // Check that permissions were removed. + + val query: String = + """ + |PREFIX knora-base: + | + |SELECT ?value WHERE { + | ?value knora-base:valueCreationDate ?creationDate ; + | knora-base:hasPermissions ?permissions . + |} ORDER BY ?value + |""".stripMargin + + val queryResult1: SparqlSelectResponse = doSelect(selectQuery = query, connection = connection) + + val expectedResultBody: SparqlSelectResponseBody = expectedResult( + Seq( + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/1c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/2c" + ), + Map( + "value" -> "http://rdfh.ch/0001/thing-with-history/values/3b" + ) + ) + ) + + assert(queryResult1.results == expectedResultBody) + + connection.close() + repository.shutDown() + } + } +} +*/ diff --git a/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginSpec.scala b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginSpec.scala new file mode 100644 index 0000000000..e985eeed2a --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/update/plugins/UpdatePluginSpec.scala @@ -0,0 +1,119 @@ +/* +/* + * Copyright © 2015-2019 the contributors (see Contributors.md). + * + * This file is part of Knora. + * + * Knora is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Knora is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with Knora. If not, see . + */ + +package org.knora.webapi.update.plugins + +import java.io.{BufferedReader, FileReader} + +import org.eclipse.rdf4j.model.Model +import org.eclipse.rdf4j.model.impl.LinkedHashModel +import org.eclipse.rdf4j.query.{Binding, TupleQuery, TupleQueryResult} +import org.eclipse.rdf4j.repository.sail.{SailRepository, SailRepositoryConnection} +import org.eclipse.rdf4j.rio.helpers.StatementCollector +import org.eclipse.rdf4j.rio.{RDFFormat, RDFParser, Rio} +import org.eclipse.rdf4j.sail.memory.MemoryStore +import org.knora.webapi.CoreSpec +import org.knora.webapi.messages.store.triplestoremessages.{SparqlSelectResponse, SparqlSelectResponseBody, SparqlSelectResponseHeader, VariableResultsRow} +import org.knora.webapi.util.ErrorHandlingMap + +import scala.collection.JavaConverters._ +import scala.collection.mutable.ArrayBuffer + +/** + * Provides helper methods for specs that test update plugins. + */ +abstract class UpdatePluginSpec extends CoreSpec { + /** + * Parses a TriG file and returns it as an RDF4J [[Model]]. + * + * @param path the file path of the TriG file. + * @return a [[Model]]. + */ + def trigFileToModel(path: String): Model = { + val trigParser: RDFParser = Rio.createParser(RDFFormat.TRIG) + val fileReader = new BufferedReader(new FileReader(path)) + val model = new LinkedHashModel() + trigParser.setRDFHandler(new StatementCollector(model)) + trigParser.parse(fileReader, "") + model + } + + /** + * Makes an in-memory RDF4J [[SailRepository]] containing a [[Model]]. + * + * @param model the model to be added to the repository. + * @return the repository. + */ + def makeRepository(model: Model): SailRepository = { + val repository = new SailRepository(new MemoryStore()) + repository.init() + val connection: SailRepositoryConnection = repository.getConnection + connection.add(model) + connection.close() + repository + } + + /** + * Wraps expected SPARQL SELECT results in a [[SparqlSelectResponseBody]]. + * + * @param rows the expected results. + * @return a [[SparqlSelectResponseBody]] containing the expected results. + */ + def expectedResult(rows: Seq[Map[String, String]]): SparqlSelectResponseBody = { + val rowMaps = rows.map { + mapToWrap => VariableResultsRow(new ErrorHandlingMap[String, String](mapToWrap, { key: String => s"No value found for SPARQL query variable '$key' in query result row" })) + } + + SparqlSelectResponseBody(bindings = rowMaps) + } + + /** + * Does a SPARQL SELECT query using a connection to an RDF4J [[SailRepository]]. + * + * @param selectQuery the query. + * @param connection a connection to the repository. + * @return a [[SparqlSelectResponse]] containing the query results. + */ + def doSelect(selectQuery: String, connection: SailRepositoryConnection): SparqlSelectResponse = { + val tupleQuery: TupleQuery = connection.prepareTupleQuery(selectQuery) + val tupleQueryResult: TupleQueryResult = tupleQuery.evaluate + + val header = SparqlSelectResponseHeader(tupleQueryResult.getBindingNames.asScala) + val rowBuffer = ArrayBuffer.empty[VariableResultsRow] + + while (tupleQueryResult.hasNext) { + val bindings: Iterable[Binding] = tupleQueryResult.next.asScala + + val rowMap: Map[String, String] = bindings.map { + binding => binding.getName -> binding.getValue.stringValue + }.toMap + + rowBuffer.append(VariableResultsRow(new ErrorHandlingMap[String, String](rowMap, { key: String => s"No value found for SPARQL query variable '$key' in query result row" }))) + } + + tupleQueryResult.close() + + SparqlSelectResponse( + head = header, + results = SparqlSelectResponseBody(bindings = rowBuffer) + ) + } +} +*/ diff --git a/webapi/src/test/scala/org/knora/webapi/util/AkkaHttpUtils.scala b/webapi/src/test/scala/org/knora/webapi/util/AkkaHttpUtils.scala index 31fb8fc740..e995de6a73 100644 --- a/webapi/src/test/scala/org/knora/webapi/util/AkkaHttpUtils.scala +++ b/webapi/src/test/scala/org/knora/webapi/util/AkkaHttpUtils.scala @@ -96,7 +96,7 @@ object AkkaHttpUtils extends LazyLogging { println("expanded json-ld: " + expanded) */ - JavaUtil.deepJavatoScala(normalized).asInstanceOf[Map[String, Any]] + JavaUtil.deepJavaToScala(normalized).asInstanceOf[Map[String, Any]] } } From bcf8efdeafecc93622c542de2041856e648d2748 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 15 Nov 2019 14:39:43 +0100 Subject: [PATCH 14/26] fix(build): Fix compile error. --- .../messages/v2/responder/valuemessages/ValueMessagesV2.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala index ae42fd5152..0f3ba31d5c 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala @@ -30,6 +30,7 @@ import akka.util.Timeout import org.knora.webapi._ import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectADM import org.knora.webapi.messages.admin.responder.usersmessages.UserADM +import org.knora.webapi.messages.store.sipimessages.{GetImageMetadataRequestV2, GetImageMetadataResponseV2} import org.knora.webapi.messages.v2.responder._ import org.knora.webapi.messages.v2.responder.resourcemessages.ReadResourceV2 import org.knora.webapi.messages.v2.responder.standoffmessages._ From ef51dd9647ad3e1982805613cf475711f5466f5a Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Tue, 19 Nov 2019 16:45:29 +0100 Subject: [PATCH 15/26] fix(build): Increase GraphDB query timeout for knora-test-unit. --- .../graphdb-se-knora-test-unit-repository-config.ttl.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapi/scripts/graphdb-se-knora-test-unit-repository-config.ttl.tmpl b/webapi/scripts/graphdb-se-knora-test-unit-repository-config.ttl.tmpl index 659a38ab56..eef97561f4 100644 --- a/webapi/scripts/graphdb-se-knora-test-unit-repository-config.ttl.tmpl +++ b/webapi/scripts/graphdb-se-knora-test-unit-repository-config.ttl.tmpl @@ -15,7 +15,7 @@ owlim:check-for-inconsistencies "true"; owlim:base-URL "http://rdfh.ch/" ; owlim:repository-type "file-repository" ; - owlim:query-timeout "5" ; + owlim:query-timeout "30" ; owlim:throw-QueryEvaluationException-on-timeout "true"; owlim:query-limit-results "50000"; ] From c207cf9acb4310c3d7b6c2a9f4008d983c51d103 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Mon, 16 Dec 2019 10:35:41 +0100 Subject: [PATCH 16/26] test: Add e2e tests and client API test data for time values. --- webapi/_test_data/all_data/anything-data.ttl | 11 +++ .../org/knora/webapi/SharedTestDataADM.scala | 43 ++++++++++ .../webapi/routing/v2/ValuesRouteV2.scala | 15 ++++ .../webapi/e2e/v2/ValuesRouteV2E2ESpec.scala | 78 +++++++++++++++++++ 4 files changed, 147 insertions(+) diff --git a/webapi/_test_data/all_data/anything-data.ttl b/webapi/_test_data/all_data/anything-data.ttl index 3dbdda95ed..3b82f11dda 100644 --- a/webapi/_test_data/all_data/anything-data.ttl +++ b/webapi/_test_data/all_data/anything-data.ttl @@ -268,6 +268,7 @@ anything:hasRichtext ; anything:hasDate ; anything:hasInteger ; + anything:hasTimeStamp ; anything:hasDecimal ; anything:hasBoolean ; anything:hasUri ; @@ -311,6 +312,16 @@ knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"; knora-base:attachedToUser . + a knora-base:TimeValue; + knora-base:valueHasUUID "l6DhS5SCT9WhXSoYEZRTRw"^^xsd:string; + knora-base:isDeleted false; + knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; + knora-base:valueCreationDate "2019-12-16T09:31:16.095523Z"^^xsd:dateTime; + knora-base:valueHasTimeStamp "2019-08-30T10:45:47.173572Z"^^xsd:dateTime; + knora-base:valueHasOrder 0; + knora-base:valueHasString "2019-08-30T10:45:47.173572Z"; + knora-base:attachedToUser . + a knora-base:TextValue; knora-base:valueHasUUID "SZyeLLmOTcCCuS3B0VksHQ"^^xsd:string; knora-base:isDeleted false; diff --git a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala index fe21e544d0..ff4d71e0ff 100644 --- a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala +++ b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala @@ -882,6 +882,26 @@ object SharedTestDataADM { |}""".stripMargin } + def createTimeValueRequest(resourceIri: IRI, + timeStamp: Instant): String = { + s"""{ + | "@id" : "$resourceIri", + | "@type" : "anything:Thing", + | "anything:hasTimeStamp" : { + | "@type" : "knora-api:TimeValue", + | "knora-api:timeValueAsTimeStamp" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "$timeStamp" + | } + | }, + | "@context" : { + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + } + def createListValueRequest(resourceIri: IRI, listNode: String): String = { s"""{ @@ -1276,6 +1296,28 @@ object SharedTestDataADM { |}""".stripMargin } + def updateTimeValueRequest(resourceIri: IRI, + valueIri: IRI, + timeStamp: Instant): String = { + s"""{ + | "@id" : "$resourceIri", + | "@type" : "anything:Thing", + | "anything:hasTimeStamp" : { + | "@id" : "$valueIri", + | "@type" : "knora-api:TimeValue", + | "knora-api:timeValueAsTimeStamp" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "$timeStamp" + | } + | }, + | "@context" : { + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + } + def updateListValueRequest(resourceIri: IRI, valueIri: IRI, listNode: String): String = { @@ -1746,6 +1788,7 @@ object SharedTestDataADM { val booleanValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/IN4R19yYR0ygi3K2VEHpUQ" val uriValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/uBAmWuRhR-eo1u1eP7qqNg" val intervalValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/RbDKPKHWTC-0lkRKae-E6A" + val timeValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/l6DhS5SCT9WhXSoYEZRTRw" val colorValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/TAziKNP8QxuyhC4Qf9-b6w" val geomValueIri: IRI = "http://rdfh.ch/0001/http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/we-ybmj-SRen-91n4RaDOQ" val geonameValueIri: IRI = "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/hty-ONF8SwKN2RKU7rLKDg" diff --git a/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala b/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala index 39fa51d4f0..c993cab101 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala @@ -311,6 +311,13 @@ class ValuesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit intervalEnd = BigDecimal("3.4") ) ), + SourceCodeFileContent( + filePath = SourceCodeFilePath.makeJsonPath("create-time-value-request"), + text = SharedTestDataADM.createTimeValueRequest( + resourceIri = SharedTestDataADM.AThing.iri, + timeStamp = Instant.parse("2019-08-28T15:59:12.725007Z") + ) + ), SourceCodeFileContent( filePath = SourceCodeFilePath.makeJsonPath("create-list-value-request"), text = SharedTestDataADM.createListValueRequest( @@ -515,6 +522,14 @@ class ValuesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit intervalEnd = BigDecimal("7.8") ) ), + SourceCodeFileContent( + filePath = SourceCodeFilePath.makeJsonPath("update-time-value-request"), + text = SharedTestDataADM.updateTimeValueRequest( + resourceIri = SharedTestDataADM.TestDing.iri, + valueIri = SharedTestDataADM.TestDing.timeValueIri, + timeStamp = Instant.parse("2019-12-16T09:33:22.082549Z") + ) + ), SourceCodeFileContent( filePath = SourceCodeFilePath.makeJsonPath("update-list-value-request"), text = SharedTestDataADM.updateListValueRequest( diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/ValuesRouteV2E2ESpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/ValuesRouteV2E2ESpec.scala index d50f73d8d9..fc3c682e2a 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/ValuesRouteV2E2ESpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/ValuesRouteV2E2ESpec.scala @@ -56,6 +56,7 @@ class ValuesRouteV2E2ESpec extends E2ESpec { private val booleanValueIri = new MutableTestIri private val geometryValueIri = new MutableTestIri private val intervalValueIri = new MutableTestIri + private val timeValueIri = new MutableTestIri private val listValueIri = new MutableTestIri private val colorValueIri = new MutableTestIri private val uriValueIri = new MutableTestIri @@ -1518,6 +1519,44 @@ class ValuesRouteV2E2ESpec extends E2ESpec { savedIntervalValueHasEnd should ===(intervalEnd) } + "create a time value" in { + val resourceIri: IRI = SharedTestDataADM.AThing.iri + val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri + val timeStamp = Instant.parse("2019-08-28T15:59:12.725007Z") + val maybeResourceLastModDate: Option[Instant] = getResourceLastModificationDate(resourceIri, anythingUserEmail) + + val jsonLdEntity = SharedTestDataADM.createTimeValueRequest( + resourceIri = resourceIri, + timeStamp = timeStamp + ) + + val request = Post(baseApiUrl + "/v2/values", HttpEntity(RdfMediaTypes.`application/ld+json`, jsonLdEntity)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) + val response: HttpResponse = singleAwaitingRequest(request) + assert(response.status == StatusCodes.OK, response.toString) + val responseJsonDoc: JsonLDDocument = responseToJsonLDDocument(response) + val valueIri: IRI = responseJsonDoc.body.requireStringWithValidation(JsonLDConstants.ID, stringFormatter.validateAndEscapeIri) + timeValueIri.set(valueIri) + val valueType: SmartIri = responseJsonDoc.body.requireStringWithValidation(JsonLDConstants.TYPE, stringFormatter.toSmartIriWithErr) + valueType should ===(OntologyConstants.KnoraApiV2Complex.TimeValue.toSmartIri) + + val savedValue: JsonLDObject = getValue( + resourceIri = resourceIri, + maybePreviousLastModDate = maybeResourceLastModDate, + propertyIriForGravsearch = propertyIri, + propertyIriInResult = propertyIri, + expectedValueIri = timeValueIri.get, + userEmail = anythingUserEmail + ) + + val savedTimeStamp: Instant = savedValue.requireDatatypeValueInObject( + key = OntologyConstants.KnoraApiV2Complex.TimeValueAsTimeStamp, + expectedDatatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri, + validationFun = stringFormatter.xsdDateTimeStampToInstant + ) + + savedTimeStamp should ===(timeStamp) + } + "create a list value" in { val resourceIri: IRI = SharedTestDataADM.AThing.iri val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem".toSmartIri @@ -2445,6 +2484,45 @@ class ValuesRouteV2E2ESpec extends E2ESpec { savedIntervalValueHasEnd should ===(intervalEnd) } + "update a time value" in { + val resourceIri: IRI = SharedTestDataADM.AThing.iri + val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasTimeStamp".toSmartIri + val timeStamp = Instant.parse("2019-12-16T09:14:56.409249Z") + val maybeResourceLastModDate: Option[Instant] = getResourceLastModificationDate(resourceIri, anythingUserEmail) + + val jsonLdEntity = SharedTestDataADM.updateTimeValueRequest( + resourceIri = resourceIri, + valueIri = timeValueIri.get, + timeStamp = timeStamp + ) + + val request = Put(baseApiUrl + "/v2/values", HttpEntity(RdfMediaTypes.`application/ld+json`, jsonLdEntity)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) + val response: HttpResponse = singleAwaitingRequest(request) + assert(response.status == StatusCodes.OK, response.toString) + val responseJsonDoc: JsonLDDocument = responseToJsonLDDocument(response) + val valueIri: IRI = responseJsonDoc.body.requireStringWithValidation(JsonLDConstants.ID, stringFormatter.validateAndEscapeIri) + timeValueIri.set(valueIri) + val valueType: SmartIri = responseJsonDoc.body.requireStringWithValidation(JsonLDConstants.TYPE, stringFormatter.toSmartIriWithErr) + valueType should ===(OntologyConstants.KnoraApiV2Complex.TimeValue.toSmartIri) + + val savedValue: JsonLDObject = getValue( + resourceIri = resourceIri, + maybePreviousLastModDate = maybeResourceLastModDate, + propertyIriForGravsearch = propertyIri, + propertyIriInResult = propertyIri, + expectedValueIri = timeValueIri.get, + userEmail = anythingUserEmail + ) + + val savedTimeStamp: Instant = savedValue.requireDatatypeValueInObject( + key = OntologyConstants.KnoraApiV2Complex.TimeValueAsTimeStamp, + expectedDatatype = OntologyConstants.Xsd.DateTimeStamp.toSmartIri, + validationFun = stringFormatter.xsdDateTimeStampToInstant + ) + + savedTimeStamp should ===(timeStamp) + } + "update a list value" in { val resourceIri: IRI = SharedTestDataADM.AThing.iri val propertyIri: SmartIri = "http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem".toSmartIri From 27e94e3dec8c421787575c02381d63f4c8165a57 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Thu, 2 Jan 2020 12:05:58 +0100 Subject: [PATCH 17/26] test(api-v1): Fix test. --- .../test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala index ec351dd6ee..f814cf650e 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala @@ -286,7 +286,7 @@ class SearchV1R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - checkNumberOfHits(responseAs[String], 1) + checkNumberOfHits(responseAs[String], 2) } From 4cadfbb6912744f729f8486423297dfe688f510b Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 17 Jan 2020 12:29:08 +0100 Subject: [PATCH 18/26] test: Fix tests. --- webapi/_test_data/all_data/anything-data.ttl | 30 +++++++- .../http/HttpTriplestoreConnector.scala | 2 + .../webapi/e2e/v2/SearchRouteV2R2RSpec.scala | 76 ++++++++----------- 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/webapi/_test_data/all_data/anything-data.ttl b/webapi/_test_data/all_data/anything-data.ttl index 3b82f11dda..7b1cdf479b 100644 --- a/webapi/_test_data/all_data/anything-data.ttl +++ b/webapi/_test_data/all_data/anything-data.ttl @@ -317,9 +317,9 @@ knora-base:isDeleted false; knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; knora-base:valueCreationDate "2019-12-16T09:31:16.095523Z"^^xsd:dateTime; - knora-base:valueHasTimeStamp "2019-08-30T10:45:47.173572Z"^^xsd:dateTime; + knora-base:valueHasTimeStamp "2019-08-30T10:45:20.173572Z"^^xsd:dateTime; knora-base:valueHasOrder 0; - knora-base:valueHasString "2019-08-30T10:45:47.173572Z"; + knora-base:valueHasString "2019-08-30T10:45:20.173572Z"; knora-base:attachedToUser . a knora-base:TextValue; @@ -662,7 +662,8 @@ rdfs:label "A thing with a timestamp"; knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; knora-base:creationDate "2019-08-30T10:45:40Z"^^xsd:dateTime ; - anything:hasTimeStamp . + anything:hasTimeStamp ; + anything:hasInteger . a knora-base:TimeValue; knora-base:valueHasUUID "OBsgI4gkQx67aLeaMjOYEg"^^xsd:string; @@ -674,6 +675,16 @@ knora-base:valueHasString "2019-08-30T10:45:26.365863Z"; knora-base:attachedToUser . + a knora-base:IntValue; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueHasUUID "lsJayQ5KSa6ck44NrojHDg"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-08-30T10:45:47.173572Z"^^xsd:dateTime; + knora-base:valueHasInteger 999999999; + knora-base:valueHasOrder 0; + knora-base:valueHasString "999999999" . + a anything:Thing; knora-base:isDeleted false; knora-base:attachedToUser ; @@ -681,7 +692,8 @@ rdfs:label "Another thing with a timestamp"; knora-base:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser"; knora-base:creationDate "2016-03-02T15:05:10Z"^^xsd:dateTime ; - anything:hasTimeStamp . + anything:hasTimeStamp ; + anything:hasInteger . a knora-base:TimeValue; knora-base:valueHasUUID "9br5Xy7TTWi6I0uMBOCIfw"^^xsd:string; @@ -693,6 +705,16 @@ knora-base:valueHasString "2019-08-30T10:47:20.684093Z"; knora-base:attachedToUser . + a knora-base:IntValue; + knora-base:attachedToUser ; + knora-base:hasPermissions "V knora-admin:UnknownUser|M knora-admin:ProjectMember"; + knora-base:valueHasUUID "0UfC9GpnSV6tPk7QTrf8qw"^^xsd:string; + knora-base:isDeleted false; + knora-base:valueCreationDate "2019-08-30T10:47:23.420867Z"^^xsd:dateTime; + knora-base:valueHasInteger 999999999; + knora-base:valueHasOrder 0; + knora-base:valueHasString "999999999" . + a anything:ThingPicture; knora-base:isDeleted false; knora-base:attachedToUser ; diff --git a/webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala b/webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala index 1070463c0c..50b6f54f6c 100644 --- a/webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala +++ b/webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala @@ -325,6 +325,8 @@ class HttpTriplestoreConnector extends Actor with ActorLogging with Instrumentat * @return a [[SparqlExtendedConstructResponse]] */ private def sparqlHttpExtendedConstruct(sparql: String): Try[SparqlExtendedConstructResponse] = { + // println(sparql) + val parseTry = for { turtleStr <- getSparqlHttpResponse(sparql, isUpdate = false, acceptMimeType = mimeTypeTextTurtle) response <- SparqlExtendedConstructResponse.parseTurtleResponse(turtleStr, log) diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala index 381fd88bee..0bc115de08 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala @@ -193,7 +193,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Queries without type inference - "perform a Gravsearch query for an anything:Thing with an optional date and sort by date" in { + "perform a Gravsearch query for an anything:Thing with an optional date and sort by date t1" in { val gravsearchQuery = """PREFIX knora-api: @@ -207,10 +207,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasDate ?date . | anything:hasDate knora-api:objectType knora-api:Date . @@ -221,7 +217,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | anything:hasInteger knora-api:objectType xsd:integer . | ?intVal a xsd:integer . - | FILTER(?intVal = 123454321) + | FILTER(?intVal = 123454321 || ?intVal = 999999999) | } |} |ORDER BY DESC(?date) @@ -229,10 +225,9 @@ class SearchRouteV2R2RSpec extends R2RSpec { Post("/v2/searchextended", HttpEntity(SparqlQueryConstants.`application/sparql-query`, gravsearchQuery)) ~> searchPath ~> check { - assert(status == StatusCodes.OK, response.toString) - - val expectedAnswerJSONLD = readOrWriteTextFile(responseAs[String], new File("src/test/resources/test-data/searchR2RV2/thingWithOptionalDateSortedDesc.jsonld"), writeTestDataFiles) - + val responseStr = responseAs[String] + assert(status == StatusCodes.OK, responseStr) + val expectedAnswerJSONLD = readOrWriteTextFile(responseStr, new File("src/test/resources/test-data/searchR2RV2/thingWithOptionalDateSortedDesc.jsonld"), writeTestDataFiles) compareJSONLDForResourcesResponse(expectedJSONLD = expectedAnswerJSONLD, receivedJSONLD = responseAs[String]) } @@ -252,10 +247,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasDate ?date . | anything:hasDate knora-api:objectType knora-api:Date . @@ -266,7 +257,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | anything:hasInteger knora-api:objectType xsd:integer . | ?intVal a xsd:integer . - | FILTER(?intVal = 123454321) + | FILTER(?intVal = 123454321 || ?intVal = 999999999) | } |} |ORDER BY DESC(?date) @@ -1726,10 +1717,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -1744,7 +1731,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | anything:hasInteger knora-api:objectType xsd:integer . | ?intVal a xsd:integer . - | FILTER(?intVal = 123454321) + | FILTER(?intVal = 123454321 || ?intVal = 999999999) | } |} OFFSET 0""".stripMargin @@ -1778,10 +1765,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | | ?thing anything:hasBoolean ?boolean . @@ -1796,7 +1779,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | anything:hasInteger knora-api:objectType xsd:integer . | ?intVal a xsd:integer . - | FILTER(?intVal = 123454321) + | FILTER(?intVal = 123454321 || ?intVal = 999999999) | } |} OFFSET 1 | @@ -4460,10 +4443,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasBoolean ?boolean . | FILTER(?boolean = true) @@ -4471,7 +4450,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { | | MINUS { | ?thing anything:hasInteger ?intVal . - | FILTER(?intVal = 123454321) + | FILTER(?intVal = 123454321 || ?intVal = 999999999) | } |} OFFSET 1""".stripMargin @@ -5356,10 +5335,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasDate ?date . | } @@ -5368,6 +5343,11 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | ?intVal knora-api:intValueAsInt 123454321 . | } + | + | MINUS { + | ?thing anything:hasInteger ?intVal . + | ?intVal knora-api:intValueAsInt 999999999 . + | } |} |ORDER BY DESC(?date) """.stripMargin @@ -5398,10 +5378,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a knora-api:Resource . | ?thing a anything:Thing . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasDate ?date . | } @@ -5410,6 +5386,11 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | ?intVal knora-api:intValueAsInt 123454321 . | } + | + | MINUS { + | ?thing anything:hasInteger ?intVal . + | ?intVal knora-api:intValueAsInt 999999999 . + | } |} |ORDER BY DESC(?date) """.stripMargin @@ -5440,10 +5421,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing a anything:Thing . | ?thing a knora-api:Resource . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasDecimal ?decimal . | ?decimal knora-api:decimalValueAsDecimal ?decimalVal . @@ -5454,6 +5431,11 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | ?intVal knora-api:intValueAsInt 123454321 . | } + | + | MINUS { + | ?thing anything:hasInteger ?intVal . + | ?intVal knora-api:intValueAsInt 999999999 . + | } |} ORDER BY DESC(?decimal) """.stripMargin @@ -6525,10 +6507,6 @@ class SearchRouteV2R2RSpec extends R2RSpec { | | ?thing a anything:Thing . | - | FILTER NOT EXISTS { - | ?thing anything:hasTimeStamp ?timeStamp . - | } - | | OPTIONAL { | ?thing anything:hasBoolean ?boolean . | ?boolean knora-api:booleanValueAsBoolean true . @@ -6538,6 +6516,12 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?thing anything:hasInteger ?intVal . | ?intVal knora-api:intValueAsInt 123454321 . | } + | + | MINUS { + | ?thing anything:hasInteger ?intVal . + | ?intVal knora-api:intValueAsInt 999999999 . + | } + | |} OFFSET 1""".stripMargin Post("/v2/searchextended", HttpEntity(SparqlQueryConstants.`application/sparql-query`, gravsearchQuery)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> searchPath ~> check { From 33fea14408a6f35048919c48af1c9a0c7d680c42 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 17 Jan 2020 15:12:47 +0100 Subject: [PATCH 19/26] test: Update test data. --- .../test-data/resourcesR2RV2/Testding.jsonld | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/webapi/src/test/resources/test-data/resourcesR2RV2/Testding.jsonld b/webapi/src/test/resources/test-data/resourcesR2RV2/Testding.jsonld index 37445475ed..f7ffa2a605 100644 --- a/webapi/src/test/resources/test-data/resourcesR2RV2/Testding.jsonld +++ b/webapi/src/test/resources/test-data/resourcesR2RV2/Testding.jsonld @@ -350,6 +350,32 @@ "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/H6gBWUuJSuuO=CilHV8kQwk/SZyeLLmOTcCCuS3B0VksHQO.20180528T155203897Z" } }, + "anything:hasTimeStamp" : { + "@id" : "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/l6DhS5SCT9WhXSoYEZRTRw", + "@type" : "knora-api:TimeValue", + "knora-api:arkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/H6gBWUuJSuuO=CilHV8kQwk/l6DhS5SCT9WhXSoYEZRTRwY" + }, + "knora-api:attachedToUser" : { + "@id" : "http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ" + }, + "knora-api:hasPermissions" : "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser", + "knora-api:timeValueAsTimeStamp" : { + "@type" : "xsd:dateTimeStamp", + "@value" : "2019-08-30T10:45:20.173572Z" + }, + "knora-api:userHasPermission" : "V", + "knora-api:valueCreationDate" : { + "@type" : "xsd:dateTimeStamp", + "@value" : "2019-12-16T09:31:16.095523Z" + }, + "knora-api:valueHasUUID" : "l6DhS5SCT9WhXSoYEZRTRw", + "knora-api:versionArkUrl" : { + "@type" : "xsd:anyURI", + "@value" : "http://0.0.0.0:3336/ark:/72163/1/0001/H6gBWUuJSuuO=CilHV8kQwk/l6DhS5SCT9WhXSoYEZRTRwY.20191216T093116095523Z" + } + }, "anything:hasUri" : { "@id" : "http://rdfh.ch/0001/H6gBWUuJSuuO-CilHV8kQw/values/uBAmWuRhR-eo1u1eP7qqNg", "@type" : "knora-api:UriValue", From a8232dff3b9a3c875e6b9c6e1dc6dc7afa34d065 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 17 Jan 2020 17:37:12 +0100 Subject: [PATCH 20/26] test: Fix test. --- .../test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala index f814cf650e..ec351dd6ee 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala @@ -286,7 +286,7 @@ class SearchV1R2RSpec extends R2RSpec { assert(status == StatusCodes.OK, response.toString) - checkNumberOfHits(responseAs[String], 2) + checkNumberOfHits(responseAs[String], 1) } From 22d6ac4f8ec531ff421893941c46c20587d90cf4 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Tue, 21 Jan 2020 18:08:10 +0100 Subject: [PATCH 21/26] build: Remove files added by mistake. --- sipi/images/0801/1TrpCMumQCC-CjCWcbgfYo9 | 160 ----------------------- sipi/images/0801/1VQBoA7ufnx-GKzn2pGoJlA | 132 ------------------- sipi/images/0801/8XjXior016g-FrbQgBgMXME | 150 --------------------- sipi/images/0801/CpbHQ0Emnpx-Ew45nlCVGWh | 124 ------------------ sipi/images/0801/G4F6mCw9gc0-B33US1V7SW2 | 33 ----- sipi/images/0801/GwsvMUkDFOa-GQRVTVeACJ2 | 127 ------------------ sipi/images/0801/H57DJQZjQrL-DDq3889NXxD | 62 --------- sipi/images/0801/KcSVPL0Hdou-BbO92DMlDp2 | 62 --------- 8 files changed, 850 deletions(-) delete mode 100644 sipi/images/0801/1TrpCMumQCC-CjCWcbgfYo9 delete mode 100644 sipi/images/0801/1VQBoA7ufnx-GKzn2pGoJlA delete mode 100644 sipi/images/0801/8XjXior016g-FrbQgBgMXME delete mode 100644 sipi/images/0801/CpbHQ0Emnpx-Ew45nlCVGWh delete mode 100644 sipi/images/0801/G4F6mCw9gc0-B33US1V7SW2 delete mode 100644 sipi/images/0801/GwsvMUkDFOa-GQRVTVeACJ2 delete mode 100644 sipi/images/0801/H57DJQZjQrL-DDq3889NXxD delete mode 100644 sipi/images/0801/KcSVPL0Hdou-BbO92DMlDp2 diff --git a/sipi/images/0801/1TrpCMumQCC-CjCWcbgfYo9 b/sipi/images/0801/1TrpCMumQCC-CjCWcbgfYo9 deleted file mode 100644 index 57e6090b09..0000000000 --- a/sipi/images/0801/1TrpCMumQCC-CjCWcbgfYo9 +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - -
    - -
    - -
    - -
    -
      - -
    -
    -
    - -
    - - - - - #ref - - - - - - - -
  • - - ref - - - - -
  • -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
  • -
    - - - - - - - \(\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - -

    -
    - - -
    -
    - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - -
    -
    - -
    -
    - -
    diff --git a/sipi/images/0801/1VQBoA7ufnx-GKzn2pGoJlA b/sipi/images/0801/1VQBoA7ufnx-GKzn2pGoJlA deleted file mode 100644 index 593b1ad7e5..0000000000 --- a/sipi/images/0801/1VQBoA7ufnx-GKzn2pGoJlA +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - -

    -
    - - - salsah-link - - - - [ - - - - - - - - - - ] - - - - - - - - - - - - - salsah-link - - - - - - - - - - - - \(\) - - - - - - - - [?] - - - - - - strike - - - - - - - - - - - - - - - ? - - [?] - - - - - - fraktur - - - - - - - - - - -
    - - - - - - - - - - -
    -
    - - - - - - - - - - - - - ; - - - - - -
    \ No newline at end of file diff --git a/sipi/images/0801/8XjXior016g-FrbQgBgMXME b/sipi/images/0801/8XjXior016g-FrbQgBgMXME deleted file mode 100644 index 7d8be381cb..0000000000 --- a/sipi/images/0801/8XjXior016g-FrbQgBgMXME +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - -

    -
    - - - salsah-link - - - - [ - - - - - - - - - - ] - - - - - - - - - - - - - - - \(\) - - - - - - - - [sic] - - - - - - center - - - - - - - underline - - - - - - - above - - - - - - - strike - - - - - - - strike - - - - - - - - - - {} - - - - - ? - - [?] - - - - - - fraktur - - - - - - - - - - -
    - - - - - - - - - - -
    -
    - - - - - - - - - - - - - ; - - - - - -
    \ No newline at end of file diff --git a/sipi/images/0801/CpbHQ0Emnpx-Ew45nlCVGWh b/sipi/images/0801/CpbHQ0Emnpx-Ew45nlCVGWh deleted file mode 100644 index d76a6793fb..0000000000 --- a/sipi/images/0801/CpbHQ0Emnpx-Ew45nlCVGWh +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - -
    - -
    - -
    - -
    -
      - -
    -
    -
    - -
    - - - - - #ref - - - - - - - -
  • - - ref - - - - - -
  • -
    - - - - - - - - - - - - - - - - - - - - - - - \(\) - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - -

    -
    - - -
    -
    - - - - - -
    -
    - - - - - - - - - - - - -
    diff --git a/sipi/images/0801/G4F6mCw9gc0-B33US1V7SW2 b/sipi/images/0801/G4F6mCw9gc0-B33US1V7SW2 deleted file mode 100644 index 8574616afb..0000000000 --- a/sipi/images/0801/G4F6mCw9gc0-B33US1V7SW2 +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - -

    -
    - - - - salsah-link - - - - - - - - - - - \(\) - - - - - - -
    \ No newline at end of file diff --git a/sipi/images/0801/GwsvMUkDFOa-GQRVTVeACJ2 b/sipi/images/0801/GwsvMUkDFOa-GQRVTVeACJ2 deleted file mode 100644 index 41c6145642..0000000000 --- a/sipi/images/0801/GwsvMUkDFOa-GQRVTVeACJ2 +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - -
    - - - - - - -
    -
    - - - - salsah-link - - - - - - - - - - - - - \(\) - - - - - center - - - - - - - underline - - - - - - - strike - - - - - - - above - - - - - - - strike - - - - - - - - - ‹ › - - [?] - - - - - - fraktur - - - - - - - - - - -
    - - - - - - - - - - -
    -
    - - - - - - - - - - - - - ; - - - - - -
    \ No newline at end of file diff --git a/sipi/images/0801/H57DJQZjQrL-DDq3889NXxD b/sipi/images/0801/H57DJQZjQrL-DDq3889NXxD deleted file mode 100644 index d4c1f8dc46..0000000000 --- a/sipi/images/0801/H57DJQZjQrL-DDq3889NXxD +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - -

    -
    - - - salsah-link - - - - [ - - - - - - - - - - ] - - - - - - - - - - - - - salsah-link - - - - - - - - - - - - \(\) - - -
    - - - - - -
    \ No newline at end of file diff --git a/sipi/images/0801/KcSVPL0Hdou-BbO92DMlDp2 b/sipi/images/0801/KcSVPL0Hdou-BbO92DMlDp2 deleted file mode 100644 index d4c1f8dc46..0000000000 --- a/sipi/images/0801/KcSVPL0Hdou-BbO92DMlDp2 +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - -

    -
    - - - salsah-link - - - - [ - - - - - - - - - - ] - - - - - - - - - - - - - salsah-link - - - - - - - - - - - - \(\) - - -
    - - - - - -
    \ No newline at end of file From ca06cef0c21cdb8f592c12d20f88af93ea249d0c Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Wed, 22 Jan 2020 12:26:36 +0100 Subject: [PATCH 22/26] test(api-v2): Add time value test responses. --- webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala | 1 + .../main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala | 1 + 2 files changed, 2 insertions(+) diff --git a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala index 0be45103e0..c60d8790a2 100644 --- a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala +++ b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala @@ -1832,6 +1832,7 @@ object SharedTestDataADM { val booleanValueUuid = "IN4R19yYR0ygi3K2VEHpUQ" val uriValueUuid = "uBAmWuRhR-eo1u1eP7qqNg" val intervalValueUuid = "RbDKPKHWTC-0lkRKae-E6A" + val timeValueUuid = "l6DhS5SCT9WhXSoYEZRTRw" val colorValueUuid = "TAziKNP8QxuyhC4Qf9-b6w" val geomValueUuid = "we-ybmj-SRen-91n4RaDOQ" val geonameValueUuid = "hty-ONF8SwKN2RKU7rLKDg" diff --git a/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala b/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala index c993cab101..b09aa74caa 100644 --- a/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala @@ -125,6 +125,7 @@ class ValuesRouteV2(routeData: KnoraRouteData) extends KnoraRoute(routeData) wit "boolean-value" -> SharedTestDataADM.TestDing.booleanValueUuid, "uri-value" -> SharedTestDataADM.TestDing.uriValueUuid, "interval-value" -> SharedTestDataADM.TestDing.intervalValueUuid, + "time-value" -> SharedTestDataADM.TestDing.timeValueUuid, "color-value" -> SharedTestDataADM.TestDing.colorValueUuid, "geom-value" -> SharedTestDataADM.TestDing.geomValueUuid, "geoname-value" -> SharedTestDataADM.TestDing.geonameValueUuid, From 27a6807380da869749b526ddba11a00244834c79 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Fri, 24 Jan 2020 09:56:45 +0100 Subject: [PATCH 23/26] test(clientapi): Add time value when testing resource creation. --- .../main/scala/org/knora/webapi/SharedTestDataADM.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala index c60d8790a2..3a8c1431a6 100644 --- a/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala +++ b/webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala @@ -1606,6 +1606,13 @@ object SharedTestDataADM { | "@value" : "1.2" | } | }, + | "anything:hasTimeStamp" : { + | "@type" : "knora-api:TimeValue", + | "knora-api:timeValueAsTimeStamp" : { + | "@type" : "xsd:dateTimeStamp", + | "@value" : "2020-01-24T08:47:10.307068Z" + | } + | }, | "anything:hasListItem" : { | "@type" : "knora-api:ListValue", | "knora-api:listValueAsListNode" : { From 1961a4d85e33b5ce938e7fe0b92b8773376ad24d Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Mon, 27 Jan 2020 10:25:55 +0100 Subject: [PATCH 24/26] test: Try unsuccessfully to add timestamp mapping. --- .../test_route/texts/mappingForHTML.xml | 18 +++++ .../webapi/e2e/v2/SearchRouteV2R2RSpec.scala | 74 ++++++++++++++++++- 2 files changed, 88 insertions(+), 4 deletions(-) diff --git a/webapi/_test_data/test_route/texts/mappingForHTML.xml b/webapi/_test_data/test_route/texts/mappingForHTML.xml index 590670db82..fe3ecc3c8a 100644 --- a/webapi/_test_data/test_route/texts/mappingForHTML.xml +++ b/webapi/_test_data/test_route/texts/mappingForHTML.xml @@ -152,6 +152,24 @@ + + + + + span + timestamp + noNamespace + false + + + http://www.knora.org/ontology/knora-base#StandoffTimeTag + + http://www.knora.org/ontology/knora-base#StandoffTimeTag + data-timestamp + + + + diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala index 0bc115de08..40dc672cba 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala @@ -35,9 +35,9 @@ import org.knora.webapi.routing.RouteUtilV2 import org.knora.webapi.routing.v1.ValuesRouteV1 import org.knora.webapi.routing.v2.{ResourcesRouteV2, SearchRouteV2, StandoffRouteV2} import org.knora.webapi.testing.tags.E2ETest -import org.knora.webapi.util.{FileUtil, MutableTestIri, StringFormatter} import org.knora.webapi.util.IriConversions._ import org.knora.webapi.util.jsonld.{JsonLDConstants, JsonLDDocument, JsonLDUtil} +import org.knora.webapi.util.{FileUtil, MutableTestIri, StringFormatter} import org.xmlunit.builder.{DiffBuilder, Input} import org.xmlunit.diff.Diff import spray.json.JsString @@ -80,7 +80,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { private val hamletResourceIri = new MutableTestIri // If true, writes all API responses to test data files. If false, compares the API responses to the existing test data files. - private val writeTestDataFiles = false + private val writeTestDataFiles = true override lazy val rdfDataObjects: List[RdfDataObject] = List( RdfDataObject(path = "_test_data/demo_data/images-demo-data.ttl", name = "http://www.knora.org/data/00FF/images"), @@ -7668,7 +7668,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { } - "search for a standoff date tag indicating a date in a particular range (submitting the complex schema)" in { + "search for a standoff date tag indicating a date in a particular range (submitting the complex schema) t1" in { // First, create a standoff-to-XML mapping that can handle standoff date tags. val mappingFileToSend = new File("_test_data/test_route/texts/mappingForHTML.xml") @@ -7703,7 +7703,7 @@ class SearchRouteV2R2RSpec extends R2RSpec { // send mapping xml to route Post("/v2/mapping", formDataMapping) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> standoffPath ~> check { - assert(status == StatusCodes.OK) + assert(status == StatusCodes.OK, responseAs[String]) } @@ -8059,5 +8059,71 @@ class SearchRouteV2R2RSpec extends R2RSpec { compareJSONLDForResourcesResponse(expectedJSONLD = expectedAnswerJSONLD, receivedJSONLD = searchResponseStr) } } + + "search for a resource containing a time value tag" in { + // Create a resource containing a time value. + + val xmlStr = + """ + | + |

    The timestamp for this test is 27 January 2020.

    + |
    + |""".stripMargin + + val jsonLDEntity = + s"""{ + | "@type" : "anything:Thing", + | "anything:hasText" : { + | "@type" : "knora-api:TextValue", + | "knora-api:textValueAsXml" : ${stringFormatter.toJsonEncodedString(xmlStr)}, + | "knora-api:textValueHasMapping" : { + | "@id" : "$anythingProjectIri/mappings/HTMLMapping" + | } + | }, + | "knora-api:attachedToProject" : { + | "@id" : "http://rdfh.ch/projects/0001" + | }, + | "rdfs:label" : "thing with timestamp in markup", + | "@context" : { + | "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + | "knora-api" : "http://api.knora.org/ontology/knora-api/v2#", + | "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", + | "xsd" : "http://www.w3.org/2001/XMLSchema#", + | "anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#" + | } + |}""".stripMargin + + Post(s"/v2/resources", HttpEntity(RdfMediaTypes.`application/ld+json`, jsonLDEntity)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> resourcePath ~> check { + val responseStr = responseAs[String] + assert(status == StatusCodes.OK, responseStr) + } + + // Search for the resource. + + val gravsearchQuery = + """ + |PREFIX knora-api: + |PREFIX anything: + | + |CONSTRUCT { + | ?thing knora-api:isMainResource true . + | ?thing anything:hasText ?text . + |} WHERE { + | ?thing a anything:Thing . + | ?thing anything:hasText ?text . + | ?text knora-api:textValueHasStandoff ?standoffTag . + | ?standoffTag a knora-api:StandoffTimeTag . + | ?standoffTag knora-api:timeValueAsTimeStamp ?timeStamp . + | FILTER(?timeStamp > "2020-01-27T08:31:51.503187Z"^^xsd:dateTimeStamp) + |} + """.stripMargin + + Post("/v2/searchextended", HttpEntity(SparqlQueryConstants.`application/sparql-query`, gravsearchQuery)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> searchPath ~> check { + assert(status == StatusCodes.OK, response.toString) + val expectedAnswerJSONLD = readOrWriteTextFile(responseAs[String], new File("src/test/resources/test-data/searchR2RV2/thingWithTimeTag.jsonld"), writeTestDataFiles) + compareJSONLDForResourcesResponse(expectedJSONLD = expectedAnswerJSONLD, receivedJSONLD = responseAs[String]) + } + + } } } From f70fe6c90ec2931dab7a0c63d1234fc62a3bc1d7 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Mon, 27 Jan 2020 12:31:08 +0100 Subject: [PATCH 25/26] test(standoff): Test a standoff mapping with a timestamp tag. --- .../paradox/02-knora-ontologies/knora-base.md | 2 ++ .../03-apis/api-v1/xml-to-standoff-mapping.md | 2 ++ knora-ontologies/knora-base.ttl | 2 +- .../org/knora/webapi/OntologyConstants.scala | 2 ++ .../standoffmessages/StandoffMessagesV2.scala | 5 ++-- .../responders/v2/search/SparqlQuery.scala | 13 +++++++++- .../prequery/AbstractPrequeryGenerator.scala | 9 +------ .../util/standoff/StandoffTagUtilV2.scala | 2 +- .../webapi/e2e/v2/SearchRouteV2R2RSpec.scala | 26 ++++++++++++++----- 9 files changed, 44 insertions(+), 19 deletions(-) diff --git a/docs/src/paradox/02-knora-ontologies/knora-base.md b/docs/src/paradox/02-knora-ontologies/knora-base.md index 407ffae9f5..f13bcb51f3 100644 --- a/docs/src/paradox/02-knora-ontologies/knora-base.md +++ b/docs/src/paradox/02-knora-ontologies/knora-base.md @@ -944,6 +944,8 @@ Standoff data type tags are subclasses of `ValueBase` classes. is stored in the same form that is used for `kb:IntervalValue`. See @ref:[IntervalValue](#intervalvalue). * `StandoffBooleanTag` Indicates that a substring represents a Boolean, which is stored in the same form that is used for `kb:BooleanValue`. See @ref:[BooleanValue](#booleanvalue). +* `StandoffTimeTag` Indicates that a substring represents a timestamp, which is stored + in the same form that is used for `kb:TimeValue`. See @ref:[TimeValue](#timevalue). ##### StandoffLinkTag diff --git a/docs/src/paradox/03-apis/api-v1/xml-to-standoff-mapping.md b/docs/src/paradox/03-apis/api-v1/xml-to-standoff-mapping.md index 0f4c904d85..264c69e071 100644 --- a/docs/src/paradox/03-apis/api-v1/xml-to-standoff-mapping.md +++ b/docs/src/paradox/03-apis/api-v1/xml-to-standoff-mapping.md @@ -280,6 +280,8 @@ Knora allows the use of all its value types as standoff data types type attribute, e.g. `1.1,2.2`). - `knora-base:StandoffBooleanTag`: Represents a Boolean value (`true` or `false` must be submitted in the data type attribute). +- `knora-base:StandoffTimeTag`: Represents a timestamp value (an `xsd:dateTimeStamp` + must be submitted in the data type attribute). The basic idea is that parts of a text can be marked up in a way that allows using Knora's built-in data types. In order to do so, the typed diff --git a/knora-ontologies/knora-base.ttl b/knora-ontologies/knora-base.ttl index d8464f04f4..d5f19ef41c 100644 --- a/knora-ontologies/knora-base.ttl +++ b/knora-ontologies/knora-base.ttl @@ -1535,7 +1535,7 @@ -### http://www.knora.org/ontology/knora-base#valueHasIntervalStart +### http://www.knora.org/ontology/knora-base#valueHasTimeStamp :valueHasTimeStamp rdf:type owl:DatatypeProperty ; diff --git a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala index 3b762592ec..4092cbc966 100644 --- a/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala +++ b/webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala @@ -853,6 +853,7 @@ object OntologyConstants { val IntervalBase: IRI = KnoraApiV2PrefixExpansion + "IntervalBase" val ColorBase: IRI = KnoraApiV2PrefixExpansion + "ColorBase" val DateBase: IRI = KnoraApiV2PrefixExpansion + "DateBase" + val TimeBase: IRI = KnoraApiV2PrefixExpansion + "TimeBase" val DecimalBase: IRI = KnoraApiV2PrefixExpansion + "DecimalBase" val ValueBaseClasses: Set[IRI] = Set( @@ -862,6 +863,7 @@ object OntologyConstants { IntervalBase, ColorBase, DateBase, + TimeBase, DecimalBase ) diff --git a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala index 0289b4ad8b..9bfa96b313 100644 --- a/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala @@ -394,7 +394,8 @@ object StandoffProperties { // represents the standoff properties defined on the internal reference standoff tag val internalReferenceProperties: Set[IRI] = Set(OntologyConstants.KnoraBase.StandoffTagHasInternalReference) - val dataTypeProperties: Set[IRI] = dateProperties ++ intervalProperties ++ booleanProperties ++ decimalProperties ++ integerProperties ++ uriProperties ++ colorProperties ++ linkProperties ++ internalReferenceProperties + val dataTypeProperties: Set[IRI] = dateProperties ++ intervalProperties ++ timeProperties ++ booleanProperties ++ decimalProperties ++ + integerProperties ++ uriProperties ++ colorProperties ++ linkProperties ++ internalReferenceProperties } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -580,7 +581,7 @@ case class StandoffTagTimeAttributeV2(standoffPropertyIri: SmartIri, value: Inst def stringValue: String = value.toString - def rdfValue: String = value.toString + def rdfValue: String = s""""${value.toString}"^^xsd:dateTime""" override def toOntologySchema(targetSchema: OntologySchema): StandoffTagAttributeV2 = { copy(standoffPropertyIri = standoffPropertyIri.toOntologySchema(targetSchema)) diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/SparqlQuery.scala b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/SparqlQuery.scala index a9d5ec3536..ef8060eade 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/SparqlQuery.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/SparqlQuery.scala @@ -138,7 +138,18 @@ case class IriRef(iri: SmartIri, propertyPathOperator: Option[Char] = None) exte * @param datatype the value's XSD type IRI. */ case class XsdLiteral(value: String, datatype: SmartIri) extends Entity { - override def toSparql: String = "\"" + value + "\"^^" + datatype.toSparql + implicit private val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance + + override def toSparql: String = { + // We use xsd:dateTimeStamp in Gravsearch, but xsd:dateTime in the triplestore. + val transformedDatatype = if (datatype.toString == OntologyConstants.Xsd.DateTimeStamp) { + OntologyConstants.Xsd.DateTime.toSmartIri + } else { + datatype + } + + "\"" + value + "\"^^" + transformedDatatype.toSparql + } } /** diff --git a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala index 8c06d3a61a..1a3dcccb30 100644 --- a/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala +++ b/webapi/src/main/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala @@ -702,15 +702,8 @@ abstract class AbstractPrequeryGenerator(typeInspectionResult: GravsearchTypeIns Seq.empty[StatementPattern] } - // We use xsd:dateTimeStamp in Gravsearch, but xsd:dateTime in the triplestore. - val transformedXsdLiteral = if (literal.datatype.toString == OntologyConstants.Xsd.DateTimeStamp) { - literal.copy(datatype = OntologyConstants.Xsd.DateTime.toSmartIri) - } else { - literal - } - TransformedFilterPattern( - Some(CompareExpression(valueObjectLiteralVar, comparisonOperator, transformedXsdLiteral)), // compares the provided literal to the value object's literal value + Some(CompareExpression(valueObjectLiteralVar, comparisonOperator, literal)), // compares the provided literal to the value object's literal value statementToAddForValueHas ) diff --git a/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala b/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala index 071fae37f8..1ba8087175 100644 --- a/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala +++ b/webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala @@ -842,7 +842,7 @@ object StandoffTagUtilV2 { case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.Boolean))) => StandoffTagBooleanAttributeV2(standoffPropertyIri = propSmartIri, value = value.toBoolean) - case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.DateTime))) => + case Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.DateTime))) | Some(SmartIriLiteralV2(SmartIri(OntologyConstants.Xsd.DateTimeStamp))) => val timeStamp = stringFormatter.xsdDateTimeStampToInstant(value, throw DataConversionException(s"Couldn't parse timestamp: $value")) StandoffTagTimeAttributeV2(standoffPropertyIri = propSmartIri, value = timeStamp) diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala index 40dc672cba..6daf8e9b96 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala @@ -78,9 +78,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { private val password = "test" private val hamletResourceIri = new MutableTestIri + private val timeTagResourceIri = new MutableTestIri // If true, writes all API responses to test data files. If false, compares the API responses to the existing test data files. - private val writeTestDataFiles = true + private val writeTestDataFiles = false override lazy val rdfDataObjects: List[RdfDataObject] = List( RdfDataObject(path = "_test_data/demo_data/images-demo-data.ttl", name = "http://www.knora.org/data/00FF/images"), @@ -8096,6 +8097,10 @@ class SearchRouteV2R2RSpec extends R2RSpec { Post(s"/v2/resources", HttpEntity(RdfMediaTypes.`application/ld+json`, jsonLDEntity)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> resourcePath ~> check { val responseStr = responseAs[String] assert(status == StatusCodes.OK, responseStr) + val resourceCreateResponseAsJsonLD: JsonLDDocument = JsonLDUtil.parseJsonLD(responseStr) + val resourceIri: IRI = resourceCreateResponseAsJsonLD.body.requireStringWithValidation(JsonLDConstants.ID, stringFormatter.validateAndEscapeIri) + assert(resourceIri.toSmartIri.isKnoraDataIri) + timeTagResourceIri.set(resourceIri) } // Search for the resource. @@ -8114,16 +8119,25 @@ class SearchRouteV2R2RSpec extends R2RSpec { | ?text knora-api:textValueHasStandoff ?standoffTag . | ?standoffTag a knora-api:StandoffTimeTag . | ?standoffTag knora-api:timeValueAsTimeStamp ?timeStamp . - | FILTER(?timeStamp > "2020-01-27T08:31:51.503187Z"^^xsd:dateTimeStamp) + | FILTER(?timeStamp > "2020-01-27T08:31:51Z"^^xsd:dateTimeStamp && ?timeStamp < "2020-01-27T08:31:52Z"^^xsd:dateTimeStamp) |} """.stripMargin Post("/v2/searchextended", HttpEntity(SparqlQueryConstants.`application/sparql-query`, gravsearchQuery)) ~> addCredentials(BasicHttpCredentials(anythingUserEmail, password)) ~> searchPath ~> check { - assert(status == StatusCodes.OK, response.toString) - val expectedAnswerJSONLD = readOrWriteTextFile(responseAs[String], new File("src/test/resources/test-data/searchR2RV2/thingWithTimeTag.jsonld"), writeTestDataFiles) - compareJSONLDForResourcesResponse(expectedJSONLD = expectedAnswerJSONLD, receivedJSONLD = responseAs[String]) - } + val responseStr = responseAs[String] + assert(status == StatusCodes.OK, responseStr) + val responseAsJsonLD: JsonLDDocument = JsonLDUtil.parseJsonLD(responseStr) + val resourceIri: IRI = responseAsJsonLD.body.requireStringWithValidation(JsonLDConstants.ID, stringFormatter.validateAndEscapeIri) + assert(resourceIri == timeTagResourceIri.get) + + val xmlFromResponse: String = responseAsJsonLD.body.requireObject("http://0.0.0.0:3333/ontology/0001/anything/v2#hasText"). + requireString(OntologyConstants.KnoraApiV2Complex.TextValueAsXml) + + // Compare it to the original XML. + val xmlDiff: Diff = DiffBuilder.compare(Input.fromString(xmlStr)).withTest(Input.fromString(xmlFromResponse)).build() + xmlDiff.hasDifferences should be(false) + } } } } From 68ab4d5ad7999a0469c169a8d512683acd796091 Mon Sep 17 00:00:00 2001 From: Benjamin Geer Date: Tue, 28 Jan 2020 12:06:59 +0100 Subject: [PATCH 26/26] feat(salsah1): Support time values in SALSAH 1. --- salsah1/src/public/js/00_init_javascript.js | 2 +- salsah1/src/public/js/03_showval.js | 11 +- salsah1/src/public/js/jquery.editvalue.js | 10 +- salsah1/src/public/js/jquery.extsearch.js | 22 +-- salsah1/src/public/js/jquery.propedit.js | 140 +++++++++--------- salsah1/src/public/js/jquery.resadd.js | 35 +++-- salsah1/src/public/js/jquery.searchext.js | 22 +-- .../valuemessages/ValueMessagesV1.scala | 4 +- 8 files changed, 122 insertions(+), 124 deletions(-) diff --git a/salsah1/src/public/js/00_init_javascript.js b/salsah1/src/public/js/00_init_javascript.js index d90d93f465..2980d51c60 100644 --- a/salsah1/src/public/js/00_init_javascript.js +++ b/salsah1/src/public/js/00_init_javascript.js @@ -70,7 +70,6 @@ var VALTYPE_FLOAT = "http://www.knora.org/ontology/knora-base#DecimalValue"; var VALTYPE_DATE = "http://www.knora.org/ontology/knora-base#DateValue"; var VALTYPE_PERIOD = 5; var VALTYPE_RESPTR = "http://www.knora.org/ontology/knora-base#LinkValue"; -var VALTYPE_TIME = "http://www.knora.org/ontology/knora-base#TimeValue"; var VALTYPE_INTERVAL = "http://www.knora.org/ontology/knora-base#IntervalValue"; var VALTYPE_GEOMETRY = "http://www.knora.org/ontology/knora-base#GeomValue"; var VALTYPE_COLOR = "http://www.knora.org/ontology/knora-base#ColorValue"; @@ -81,6 +80,7 @@ var VALTYPE_RICHTEXT = "http://www.knora.org/ontology/knora-base#TextValue"; var VALTYPE_GEONAME = 15; var VALTYPE_URI = "http://www.knora.org/ontology/knora-base#UriValue"; var VALTYPE_BOOLEAN = "http://www.knora.org/ontology/knora-base#BooleanValue"; +var VALTYPE_TIME = "http://www.knora.org/ontology/knora-base#TimeValue"; var RESOURCE_TYPE_REGION = "http://www.knora.org/ontology/knora-base#Region"; diff --git a/salsah1/src/public/js/03_showval.js b/salsah1/src/public/js/03_showval.js index cf40c6a386..b654ce383c 100644 --- a/salsah1/src/public/js/03_showval.js +++ b/salsah1/src/public/js/03_showval.js @@ -20,7 +20,7 @@ SALSAH.showval = function(value_container, prop, value_index, options) { - //console.log("in showval: valtype is " + prop.valuetype_id); + // console.log("in showval: valtype is " + prop.valuetype_id); switch (prop.valuetype_id) { // this value type is mot used anymore: every text is a richtext now /*case VALTYPE_TEXT: { @@ -41,6 +41,10 @@ SALSAH.showval = function(value_container, prop, value_index, options) value_container.append(prop.values[value_index]); break; } + case VALTYPE_TIME: { + value_container.append(prop.values[value_index]); + break; + } case VALTYPE_BOOLEAN: { var checkbox = $('', { type: "checkbox" @@ -166,11 +170,6 @@ SALSAH.showval = function(value_container, prop, value_index, options) } break; } - case VALTYPE_TIME: { - value_container.timeobj('init', prop.values[value_index]); - //value_container.append(prop.values[value_index]); - break; - } case VALTYPE_INTERVAL: { //value_container.append(prop.values[value_index]); value_container.timeobj('init', prop.values[value_index]); diff --git a/salsah1/src/public/js/jquery.editvalue.js b/salsah1/src/public/js/jquery.editvalue.js index 1cf29c3d2a..457273a3ab 100644 --- a/salsah1/src/public/js/jquery.editvalue.js +++ b/salsah1/src/public/js/jquery.editvalue.js @@ -101,6 +101,10 @@ ele.append(settings.property.values[value_index]); break; } + case VALTYPE_TIME: { + ele.append(settings.property.values[value_index]); + break; + } case VALTYPE_DATE: { ele.dateobj('init', settings.property.values[value_index]); break; @@ -189,11 +193,6 @@ } break; } - case VALTYPE_TIME: { - ele.timeobj('init', settings.property.values[value_index]); - //ele.append(settings.property.values[value_index]); - break; - } case VALTYPE_INTERVAL: { //ele.append(settings.property.values[value_index]); ele.append('VALTYPE_INTERVAL: NOT YET IMPLEMENTED!'); @@ -510,6 +509,7 @@ postdata[VALTYPE_INTEGER] = postdata[VALTYPE_TEXT]; postdata[VALTYPE_FLOAT] = postdata[VALTYPE_TEXT]; + postdata[VALTYPE_TIME] = postdata[VALTYPE_TEXT]; postdata[VALTYPE_RICHTEXT] = function(value, is_new_value) { var data = {}; diff --git a/salsah1/src/public/js/jquery.extsearch.js b/salsah1/src/public/js/jquery.extsearch.js index 709965db1e..6cb0edfab5 100644 --- a/salsah1/src/public/js/jquery.extsearch.js +++ b/salsah1/src/public/js/jquery.extsearch.js @@ -268,6 +268,17 @@ valfield.append($('', {'type': 'text', name: 'searchval', size: 16, maxlength: 32}).addClass('propval').data('gui_element', 'text')); break; } + case VALTYPE_TIME: { // we use gui_element = "text" + compop.append($('