Skip to content
Permalink
Browse files

feat: Add time value type (#1403)

  • Loading branch information
benjamingeer committed Feb 5, 2020
1 parent c2a2559 commit d925c851f0dfb0337ae427ef5a408161083c0ce4
Showing with 10,020 additions and 3,398 deletions.
  1. +13 −0 docs/src/paradox/02-knora-ontologies/knora-base.md
  2. +2 −0 docs/src/paradox/03-apis/api-v1/xml-to-standoff-mapping.md
  3. +3 −0 docs/src/paradox/05-internals/development/updating-repositories.md
  4. +41 −2 knora-ontologies/knora-base.ttl
  5. +7 −0 knora-ontologies/salsah-gui.ttl
  6. +1 −1 salsah1/src/public/js/00_init_javascript.js
  7. +5 −6 salsah1/src/public/js/03_showval.js
  8. +5 −5 salsah1/src/public/js/jquery.editvalue.js
  9. +11 −11 salsah1/src/public/js/jquery.extsearch.js
  10. +66 −74 salsah1/src/public/js/jquery.propedit.js
  11. +22 −13 salsah1/src/public/js/jquery.resadd.js
  12. +11 −11 salsah1/src/public/js/jquery.searchext.js
  13. +23 −3 salsah1/src/typescript_interfaces/basicMessageComponents.ts
  14. +9 −0 salsah1/src/typescript_interfaces/changeValueFormats.ts
  15. +1 −1 salsah1/src/typescript_interfaces/createResourceFormats.ts
  16. +781 −0 upgrade/plugins/pr1403/knora-ontologies/knora-admin.ttl
  17. +2,760 −0 upgrade/plugins/pr1403/knora-ontologies/knora-base.ttl
  18. +244 −0 upgrade/plugins/pr1403/knora-ontologies/salsah-gui.ttl
  19. +631 −0 upgrade/plugins/pr1403/knora-ontologies/standoff-data.ttl
  20. +356 −0 upgrade/plugins/pr1403/knora-ontologies/standoff-onto.ttl
  21. +27 −0 upgrade/plugins/pr1403/update.py
  22. +2 −1 upgrade/src/main/scala/org.knora.upgrade/Main.scala
  23. +71 −0 webapi/_test_data/all_data/anything-data.ttl
  24. +24 −1 webapi/_test_data/ontologies/anything-onto.ttl
  25. +18 −0 webapi/_test_data/test_route/texts/mappingForHTML.xml
  26. +14 −0 webapi/src/main/resources/knoraXmlImport.xsd
  27. +15 −0 webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala
  28. +51 −0 webapi/src/main/scala/org/knora/webapi/SharedTestDataADM.scala
  29. +5 −1 ...i/src/main/scala/org/knora/webapi/messages/v1/responder/resourcemessages/ResourceMessagesV1.scala
  30. +48 −4 webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala
  31. +3 −0 ...ora/webapi/messages/v2/responder/ontologymessages/KnoraBaseToApiV2SimpleTransformationRules.scala
  32. +34 −1 ...i/src/main/scala/org/knora/webapi/messages/v2/responder/standoffmessages/StandoffMessagesV2.scala
  33. +126 −19 webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala
  34. +1 −1 webapi/src/main/scala/org/knora/webapi/package.scala
  35. +14 −0 webapi/src/main/scala/org/knora/webapi/responders/v1/SearchResponderV1.scala
  36. +29 −11 webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala
  37. +12 −1 webapi/src/main/scala/org/knora/webapi/responders/v2/search/SparqlQuery.scala
  38. +11 −1 ...n/scala/org/knora/webapi/responders/v2/search/gravsearch/prequery/AbstractPrequeryGenerator.scala
  39. +2 −0 ...n/scala/org/knora/webapi/responders/v2/search/gravsearch/types/GravsearchTypeInspectionUtil.scala
  40. +9 −0 webapi/src/main/scala/org/knora/webapi/routing/v1/ResourcesRouteV1.scala
  41. +12 −3 webapi/src/main/scala/org/knora/webapi/routing/v1/ValuesRouteV1.scala
  42. +16 −0 webapi/src/main/scala/org/knora/webapi/routing/v2/ValuesRouteV2.scala
  43. +2 −0 webapi/src/main/scala/org/knora/webapi/store/triplestore/http/HttpTriplestoreConnector.scala
  44. +7 −0 webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala
  45. +0 −24 webapi/src/main/scala/org/knora/webapi/util/StringFormatter.scala
  46. +41 −0 webapi/src/main/scala/org/knora/webapi/util/standoff/StandoffTagUtilV2.scala
  47. +6 −0 webapi/src/main/twirl/queries/sparql/v1/addValueVersion.scala.txt
  48. +6 −0 webapi/src/main/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt
  49. +56 −8 webapi/src/main/twirl/queries/sparql/v1/searchExtendedGraphDB.scala.txt
  50. +56 −8 webapi/src/main/twirl/queries/sparql/v1/searchExtendedStandard.scala.txt
  51. +6 −0 webapi/src/main/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt
  52. +6 −0 webapi/src/main/twirl/xsd/v1/xmlImport.scala.xml
  53. +41 −0 webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.jsonld
  54. +486 −456 webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.rdf
  55. +31 −8 webapi/src/test/resources/test-data/ontologyR2RV2/anythingOntologyWithValueObjects.ttl
  56. +36 −36 webapi/src/test/resources/test-data/ontologyR2RV2/boxOntologyWithValueObjects.rdf
  57. +100 −100 webapi/src/test/resources/test-data/ontologyR2RV2/incunabulaOntologySimple.rdf
  58. +204 −204 webapi/src/test/resources/test-data/ontologyR2RV2/incunabulaOntologyWithValueObjects.rdf
  59. +120 −120 webapi/src/test/resources/test-data/ontologyR2RV2/incunabulaPageAndBookWithValueObjects.rdf
  60. +2 −2 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiDate.rdf
  61. +44 −44 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiDateValue.rdf
  62. +174 −174 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologySimple.rdf
  63. +219 −0 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.jsonld
  64. +1,577 −1,401 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.rdf
  65. +121 −0 webapi/src/test/resources/test-data/ontologyR2RV2/knoraApiOntologyWithValueObjects.ttl
  66. +7 −0 webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.jsonld
  67. +3 −0 webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.rdf
  68. +2 −0 webapi/src/test/resources/test-data/ontologyR2RV2/salsahGuiOntology.ttl
  69. +606 −606 webapi/src/test/resources/test-data/ontologyR2RV2/standoffOntologyWithValueObjects.rdf
  70. +26 −0 webapi/src/test/resources/test-data/resourcesR2RV2/Testding.jsonld
  71. +58 −0 webapi/src/test/resources/test-data/searchR2RV2/ThingWithTimeStamp.jsonld
  72. +8 −0 webapi/src/test/scala/org/knora/webapi/e2e/v1/ResourcesV1R2RSpec.scala
  73. +15 −3 webapi/src/test/scala/org/knora/webapi/e2e/v1/SearchV1R2RSpec.scala
  74. +36 −0 webapi/src/test/scala/org/knora/webapi/e2e/v1/ValuesV1R2RSpec.scala
  75. +137 −13 webapi/src/test/scala/org/knora/webapi/e2e/v2/SearchRouteV2R2RSpec.scala
  76. +78 −0 webapi/src/test/scala/org/knora/webapi/e2e/v2/ValuesRouteV2E2ESpec.scala
  77. +38 −3 webapi/src/test/scala/org/knora/webapi/responders/v1/ValuesResponderV1Spec.scala
  78. +18 −17 webapi/src/test/scala/org/knora/webapi/responders/v2/OntologyResponderV2Spec.scala
  79. +111 −0 webapi/src/test/scala/org/knora/webapi/responders/v2/ValuesResponderV2Spec.scala
@@ -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:
@@ -933,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

@@ -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
@@ -37,6 +37,9 @@ with existing data, the following must happen:
existing repositories so that they are compatible with the code changes
introduced in the pull request.

The order of version numbers must correspond to the order in which the pull requests
are merged.

## Adding an Upgrade Plugin

An upgrade plugin is a Scala class that extends `UpgradePlugin`. The name of the plugin
@@ -33,7 +33,7 @@

:attachedToProject knora-admin:SystemProject ;

:ontologyVersion "knora-base v6" .
:ontologyVersion "knora-base v7" .



@@ -1535,6 +1535,18 @@



### http://www.knora.org/ontology/knora-base#valueHasTimeStamp

: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 ;
@@ -1546,7 +1558,6 @@
:objectClassConstraint :ListNode .



### http://www.knora.org/ontology/knora-base#valueHasOrder

:valueHasOrder rdf:type owl:DatatypeProperty ;
@@ -2008,6 +2019,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 :Value ,
:TimeBase ;

rdfs:comment "Represents a timestamp"@en .


### http://www.knora.org/ontology/knora-base#LinkObj

@@ -2431,6 +2460,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 ;
@@ -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 ,
@@ -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";

@@ -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 = $('<input>', {
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]);
@@ -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 = {};
@@ -268,6 +268,17 @@
valfield.append($('<input>', {'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($('<option>', {'value': 'EQ', 'title': 'equal'}).append('='));
compop.append($('<option>', {'value': 'GT', 'title': 'greater than'}).append('&gt;'));
compop.append($('<option>', {'value': 'GT_EQ', 'title': 'greater equal than'}).append('&ge;'));
compop.append($('<option>', {'value': 'LT', 'title': 'less than'}).append('&lt;'));
compop.append($('<option>', {'value': 'LT_EQ', 'title': 'less equal than'}).append('&le;'));
compop.append($('<option>', {'value': '!EQ', 'title': 'not equal'}).append('&ne;'));
compop.append($('<option>', {'value': 'EXISTS', 'title': 'exists'}).append('&exist;'));
valfield.append($('<input>', {'type': 'text', name: 'searchval', size: 16, maxlength: 32}).addClass('propval').data('gui_element', 'text'));
break;
}
case VALTYPE_DATE: { // we use gui_element = "date"
compop.append($('<option>', {'value': 'EQ', 'title': 'equal'}).append('='));
compop.append($('<option>', {'value': 'GT', 'title': 'greater than'}).append('&gt;'));
@@ -370,17 +381,6 @@
.appendTo(valfield);
break;
}*/
case VALTYPE_TIME: { // we use gui_element = "text"
compop.append($('<option>', {'value': 'EQ'}).append('='));
compop.append($('<option>', {'value': 'GT', 'title': 'greater than'}).append('&gt;'));
compop.append($('<option>', {'value': 'GT_EQ', 'title': 'greater equal than'}).append('&ge;'));
compop.append($('<option>', {'value': 'LT', 'title': 'less than'}).append('&lt;'));
compop.append($('<option>', {'value': 'LT_EQ', 'title': 'less equal than'}).append('&le;'));
compop.append($('<option>', {'value': 'IN'}).append('in'));
compop.append($('<option>', {'value': 'EXISTS', 'title': 'Exists'}).append('&exist;'));
valfield.append($('<input>', {'type': 'text', name: 'searchval'}).addClass('propval').data('gui_element', 'text'));
break;
}
case VALTYPE_INTERVAL: {
compop.append($('<option>', {'value': 'EXISTS', 'title': 'exists'}).append('&exist;'));
compop.append('NOT YET IMPLEMENTED!');

0 comments on commit d925c85

Please sign in to comment.