Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include guiElement and guiAttribute in API v2 #755

Merged
merged 28 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a5c1214
refactor (webapi): Refactor OntologyResponderV2 to split loadOntologi…
Feb 27, 2018
298e1ef
feature (webapi): Add some infrastructure for serving OWL named indiv…
Feb 27, 2018
1e95c95
test (triplestore): Fix GraphDB consistency checking test.
Feb 27, 2018
9b1ec62
feature (webapi): Rewrite ontology loading to support serving built-i…
Feb 28, 2018
ab94ca2
fix (webapi): Fix bugs and test data so existing tests pass.
Mar 1, 2018
1df99e8
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 1, 2018
4927afe
test (webapi): Add test for serving the salsah-gui ontology.
Mar 1, 2018
1e88555
Merge branch 'wip/update-salsah-gui-attributes' of github.com:dhlab-b…
Mar 1, 2018
6a5ea34
refactor (webapi): Don't get project ontologies if not needed.
Mar 1, 2018
d54ce47
test (webapi): Add tests for serving the standoff ontology.
Mar 1, 2018
5eef30b
refactor (webapi): Cache ReadOntologyV2 objects so it will be easier …
Mar 2, 2018
9a05b93
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 2, 2018
5f9f8e4
feature (webapi): Show salsah-gui:guiElement and salsah-gui:guiAttrib…
Mar 2, 2018
14780db
docs (webapi): Update docs.
Mar 2, 2018
98cb8c8
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 2, 2018
e145a63
test (webapi): Fix test data after merge from develop.
Mar 2, 2018
8ce8e94
docs (webapi): Mention salsah-gui:guiElement and salsah-gui:guiAttrib…
Mar 2, 2018
e93df1f
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 5, 2018
2b35bd8
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 6, 2018
e08ddce
feature (webapi): Allow properties to be created with salsah-gui:guiE…
Mar 6, 2018
67d7ae0
docs (release): Update release notes.
Mar 6, 2018
a603b3a
style (webapi): Add comments.
Mar 6, 2018
cbedbcd
style (webapi): Fix comment from merge.
Mar 6, 2018
7a83e84
Merge branch 'develop' into wip/update-salsah-gui-attributes
Mar 6, 2018
c3d9d23
refactor (webapi): Remove SPARQL queries that are no longer used.
Mar 6, 2018
888c54e
Merge branch 'wip/update-salsah-gui-attributes' of github.com:dhlab-b…
Mar 6, 2018
5ea6fe0
fix (webapi): Add missing isResourceClass to knora-api default schema.
Mar 7, 2018
4b22aea
fix (webapi): Fixes for SALSAH 1 e2e tests.
Mar 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/rst/00-release-notes/v1.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ of the transformed Turtle file, and restart the Knora API server. Be sure to tes
installation using a copy of your data and ontologies, before updating the ontology used by a
live server.

Also, you have to replace the `salsah-gui` ontology that you have in the triplestore with the one
in `salsah-gui.ttl`.
Also, you have to replace the ``salsah-gui`` ontology that you have in the triplestore with the one
in ``salsah-gui.ttl``.


New features:
Expand All @@ -144,4 +144,4 @@ Bugfixes:
---------

.. _release: https://github.com/dhlab-basel/Knora/releases/tag/v1.2.0
.. _v1.2.0 milestone: https://github.com/dhlab-basel/Knora/milestone/6
.. _v1.2.0 milestone: https://github.com/dhlab-basel/Knora/milestone/6
14 changes: 13 additions & 1 deletion docs/rst/00-release-notes/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,25 @@ See the `release`_ and closed tickets on the `v1.3.0 milestone`_ on Github.
Required changes to existing data:
----------------------------------

1. Replace salsah-gui ontology
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You must replace the ``salsah-gui`` ontology that you have in the triplestore with the one
in ``salsah-gui.ttl``.

New features:
-------------

1. More support for salsah-gui elements and attributes in ontologies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Serve the ``salsah-gui`` ontology in API v2 in the default schema.
- Show ``salsah-gui:guiElement`` and ``salsah-gui:guiAttribute`` when serving ontologies in API v2 in the default schema.
- Allow ``salsah-gui:guiElement`` and ``salsah-gui:guiAttribute`` to be included in new property definitions created via API v2.
- Change ``salsah-gui`` so that GraphDB's consistency checker can check the use of ``guiElement`` and ``guiAttribute``.

Bugfixes:
---------

.. _release: https://github.com/dhlab-basel/Knora/releases/tag/v1.3.0
.. _v1.3.0 milestone: https://github.com/dhlab-basel/Knora/milestone/7
.. _v1.3.0 milestone: https://github.com/dhlab-basel/Knora/milestone/7
14 changes: 10 additions & 4 deletions docs/rst/02-knora-ontologies/salsah-gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ Properties

percent = integer, "%" ;

iri = "<", string, ">" ;

The attributes used with each GUI element are described below under :ref:`salsah-gui-individuals`.

``guiAttributeDefinition``
Used only in the ``salsah-gui`` ontology itself, as a predicate attached to instances of ``Guielement``,
to specify the attributes that can be given as objects of ``guiAttribute`` when a given ``Guielement``.
is used. The objects of this predicate are written in a DSL with the following syntax:
Used only in the ``salsah-gui`` ontology itself, as a predicate attached to instances of ``Guielement``
(see :ref:`salsah-gui-individuals`), to specify the attributes that can be given as objects of
``guiAttribute`` when a given ``Guielement``. is used. The objects of this predicate are written in a DSL
with the following syntax:

.. code-block:: ebnf

Expand All @@ -94,6 +99,8 @@ Classes
``Guielement``
The instances of this class are individuals representing SALSAH GUI elements for data entry.

.. _salsah-gui-individuals:

Individuals
===========

Expand Down Expand Up @@ -181,4 +188,3 @@ Individuals

.. _Geonames: http://www.geonames.org/
.. _wrap: https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-textarea-wrap

693 changes: 364 additions & 329 deletions docs/rst/03-knora-api-server/api_v2/ontology-information.rst

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions knora-ontologies/salsah-gui.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,38 @@

### http://www.knora.org/ontology/salsah-gui#guiOrder

:guiOrder rdf:type owl:AnnotationProperty ;
: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:AnnotationProperty .
:guiElement rdf:type owl:ObjectProperty ;

knora-base:subjectClassConstraint owl:ObjectProperty .



### http://www.knora.org/ontology/salsah-gui#guiAttribute

:guiAttribute rdf:type owl:AnnotationProperty .
:guiAttribute rdf:type owl:DatatypeProperty ;

knora-base:subjectClassConstraint owl:ObjectProperty ;

knora-base:objectDatatypeConstraint xsd:string .



### http://www.knora.org/ontology/salsah-gui#guiAttributeDefinition

:guiAttributeDefinition rdf:type owl:AnnotationProperty ;
:guiAttributeDefinition rdf:type owl:DatatypeProperty ;

knora-base:subjectClassConstraint :Guielement ;

knora-base:objectDatatypeConstraint xsd:string .


Expand Down Expand Up @@ -92,7 +101,7 @@

:Colorpicker rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "ncolors:integer" .


Expand Down Expand Up @@ -136,7 +145,7 @@

:List rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "hlist(required):iri" .


Expand All @@ -145,7 +154,7 @@

:Pulldown rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "hlist(required):iri" .


Expand All @@ -154,7 +163,7 @@

:Radio rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "hlist(required):iri" .


Expand All @@ -170,7 +179,7 @@

:Searchbox rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "numprops:integer" .


Expand All @@ -179,7 +188,7 @@

:SimpleText rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "size:integer" ,
"maxlength:integer" .

Expand All @@ -189,7 +198,7 @@

:Slider rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "max(required):decimal" ,
"min(required):decimal" .

Expand All @@ -199,7 +208,7 @@

:Spinbox rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "max:decimal" ,
"min:decimal" .

Expand All @@ -209,7 +218,7 @@

:Textarea rdf:type :Guielement ,
owl:NamedIndividual ;

:guiAttributeDefinition "cols:integer" ,
"rows:integer" ,
"width:percent" ,
Expand Down
Binary file modified salsah/lib/chromedriver/chromedriver_mac64.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ class ResourceCreationSpec extends SalsahSpec {

val resource1Label: WebElement = page.getFormFieldByName("__LABEL__")

resource1Label.sendKeys("Testding")
try {
resource1Label.sendKeys("Testding")
} catch {
case _: org.openqa.selenium.StaleElementReferenceException =>
val resource1Label: WebElement = page.getFormFieldByName("__LABEL__")
resource1Label.sendKeys("Testding")
}

val resource1FloatVal = page.getFormFieldByName("http://www.knora.org/ontology/anything#hasDecimal")

Expand Down
2 changes: 1 addition & 1 deletion webapi/_test_data/ontologies/dokubib-onto.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

:phone rdf:type owl:ObjectProperty ;

rdfs:subPropertyOf knora-base:hasValue ;
rdfs:subPropertyOf knora-base:hasValue, foaf:phone ;

rdfs:label """Telefon"""@de ;

Expand Down
2 changes: 1 addition & 1 deletion webapi/_test_data/ontologies/images-onto.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

:phone rdf:type owl:ObjectProperty ;

rdfs:subPropertyOf foaf:phone ;
rdfs:subPropertyOf knora-base:hasValue, foaf:phone ;

rdfs:label "Telefon"@de ;

Expand Down
2 changes: 0 additions & 2 deletions webapi/_test_data/ontologies/incunabula-onto.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,6 @@

knora-base:subjectClassConstraint :page ;

salsah-gui:guiOrder "10"^^xsd:integer ;

salsah-gui:guiElement salsah-gui:Searchbox .


Expand Down
34 changes: 27 additions & 7 deletions webapi/src/main/scala/org/knora/webapi/OntologyConstants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ object OntologyConstants {
MinCardinality,
MaxCardinality
)

val NamedIndividual: IRI = OwlPrefixExpansion + "NamedIndividual"
}

object Xsd {
val XsdPrefixExpansion: IRI = "http://www.w3.org/2001/XMLSchema#"

val String: IRI = XsdPrefixExpansion + "string"
val Boolean: IRI = XsdPrefixExpansion + "boolean"
val Int: IRI = XsdPrefixExpansion + "int"
val Integer: IRI = XsdPrefixExpansion + "integer"
val NonNegativeInteger: IRI = XsdPrefixExpansion + "nonNegativeInteger"
val Decimal: IRI = XsdPrefixExpansion + "decimal"
Expand Down Expand Up @@ -397,6 +400,7 @@ object OntologyConstants {

/* Standoff */

val StandoffTag: IRI = KnoraBasePrefixExpansion + "StandoffTag"
val StandoffTagHasStart: IRI = KnoraBasePrefixExpansion + "standoffTagHasStart"
val StandoffTagHasEnd: IRI = KnoraBasePrefixExpansion + "standoffTagHasEnd"
val StandoffTagHasStartIndex: IRI = KnoraBasePrefixExpansion + "standoffTagHasStartIndex"
Expand Down Expand Up @@ -486,8 +490,10 @@ object OntologyConstants {
val SalsahGuiPrefixExpansion: IRI = SalsahGuiOntologyIri + "#"

val GuiAttribute: IRI = SalsahGuiPrefixExpansion + "guiAttribute"
val GuiAttributeDefinition: IRI = SalsahGuiPrefixExpansion + "guiAttributeDefinition"
val GuiOrder: IRI = SalsahGuiPrefixExpansion + "guiOrder"
val GuiElement: IRI = SalsahGuiPrefixExpansion + "guiElement"
val GuiElementProp: IRI = SalsahGuiPrefixExpansion + "guiElement"
val GuiElementClass: IRI = SalsahGuiPrefixExpansion + "Guielement"
val SimpleText: IRI = SalsahGuiPrefixExpansion + "SimpleText"
val Textarea: IRI = SalsahGuiPrefixExpansion + "Textarea"
val Pulldown: IRI = SalsahGuiPrefixExpansion + "Pulldown"
Expand Down Expand Up @@ -577,6 +583,9 @@ object OntologyConstants {
val IsEditable: IRI = KnoraApiV2PrefixExpansion + "isEditable"
val IsLinkProperty: IRI = KnoraApiV2PrefixExpansion + "isLinkProperty"
val IsLinkValueProperty: IRI = KnoraApiV2PrefixExpansion + "isLinkValueProperty"
val IsResourceClass: IRI = KnoraApiV2PrefixExpansion + "isResourceClass"
val IsResourceProperty: IRI = KnoraApiV2PrefixExpansion + "isResourceProperty"
val IsStandoffClass: IRI = KnoraApiV2PrefixExpansion + "isStandoffClass"
val CanBeInstantiated: IRI = KnoraApiV2PrefixExpansion + "canBeInstantiated"
val IsValueClass: IRI = KnoraApiV2PrefixExpansion + "isValueClass"
val IsInherited: IRI = KnoraApiV2PrefixExpansion + "isInherited"
Expand All @@ -585,8 +594,7 @@ object OntologyConstants {

val HasClasses: IRI = KnoraApiV2PrefixExpansion + "hasClasses"
val HasProperties: IRI = KnoraApiV2PrefixExpansion + "hasProperties"
val HasStandoffClasses: IRI = KnoraApiV2PrefixExpansion + "hasStandoffClasses"
val HasStandoffProperties: IRI = KnoraApiV2PrefixExpansion + "hasStandoffProperties"
val HasIndividuals: IRI = KnoraApiV2PrefixExpansion + "hasIndividuals"

val ValueAsString: IRI = KnoraApiV2PrefixExpansion + "valueAsString"
val ValueCreationDate: IRI = KnoraApiV2PrefixExpansion + "valueCreationDate"
Expand Down Expand Up @@ -716,6 +724,17 @@ object OntologyConstants {

}

object SalsahGuiApiV2WithValueObjects {
val SalsahGuiOntologyIri: IRI = KnoraApi.ApiOntologyStart + SalsahGui.SalsahGuiOntologyLabel + KnoraApiV2WithValueObjects.VersionSegment
val SalsahGuiPrefixExpansion: IRI = SalsahGuiOntologyIri + "#"

val GuiAttribute: IRI = SalsahGuiPrefixExpansion + "guiAttribute"
val GuiOrder: IRI = SalsahGuiPrefixExpansion + "guiOrder"
val GuiElementProp: IRI = SalsahGuiPrefixExpansion + "guiElement"
val GuiAttributeDefinition: IRI = SalsahGuiPrefixExpansion + "guiAttributeDefinition"
val GuiElementClass: IRI = SalsahGuiPrefixExpansion + "Guielement"
}

object KnoraApiV2Simple {

val VersionSegment = "/simple/v2"
Expand Down Expand Up @@ -764,8 +783,7 @@ object OntologyConstants {

val HasClasses: IRI = KnoraApiV2PrefixExpansion + "hasClasses"
val HasProperties: IRI = KnoraApiV2PrefixExpansion + "hasProperties"
val HasStandoffClasses: IRI = KnoraApiV2PrefixExpansion + "hasStandoffClasses"
val HasStandoffProperties: IRI = KnoraApiV2PrefixExpansion + "hasStandoffProperties"
val HasIndividuals: IRI = KnoraApiV2PrefixExpansion + "hasIndividuals"

val HasValue: IRI = KnoraApiV2PrefixExpansion + "hasValue"

Expand Down Expand Up @@ -837,11 +855,13 @@ object OntologyConstants {
val CorrespondingPredicates: Map[(OntologySchema, OntologySchema), Map[IRI, IRI]] = Map(
(InternalSchema, ApiV2Simple) -> Map(
OntologyConstants.KnoraBase.SubjectClassConstraint -> OntologyConstants.KnoraApiV2Simple.SubjectType,
OntologyConstants.KnoraBase.ObjectClassConstraint -> OntologyConstants.KnoraApiV2Simple.ObjectType
OntologyConstants.KnoraBase.ObjectClassConstraint -> OntologyConstants.KnoraApiV2Simple.ObjectType,
OntologyConstants.KnoraBase.ObjectDatatypeConstraint -> OntologyConstants.KnoraApiV2Simple.ObjectType
),
(InternalSchema, ApiV2WithValueObjects) -> Map(
OntologyConstants.KnoraBase.SubjectClassConstraint -> OntologyConstants.KnoraApiV2WithValueObjects.SubjectType,
OntologyConstants.KnoraBase.ObjectClassConstraint -> OntologyConstants.KnoraApiV2WithValueObjects.ObjectType
OntologyConstants.KnoraBase.ObjectClassConstraint -> OntologyConstants.KnoraApiV2WithValueObjects.ObjectType,
OntologyConstants.KnoraBase.ObjectDatatypeConstraint -> OntologyConstants.KnoraApiV2WithValueObjects.ObjectType
),
(ApiV2Simple, InternalSchema) -> Map(
OntologyConstants.KnoraApiV2Simple.SubjectType -> OntologyConstants.KnoraBase.SubjectClassConstraint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package org.knora.webapi.messages.store.triplestoremessages

import java.time.Instant

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import org.knora.webapi.util.ErrorHandlingMap
import org.knora.webapi.{IRI, InconsistentTriplestoreDataException, TriplestoreResponseException}
Expand Down Expand Up @@ -121,7 +122,7 @@ case class SparqlConstructResponse(statements: Map[IRI, Seq[(IRI, String)]])
* Represents a SPARQL CONSTRUCT query to be sent to the triplestore. A successful response will be a
* [[SparqlExtendedConstructResponse]].
*
* @param sparql the SPARQL string.
* @param sparql the SPARQL string.
*/
case class SparqlExtendedConstructRequest(sparql: String) extends TriplestoreRequest

Expand Down Expand Up @@ -236,10 +237,16 @@ case class RdfDataObject(path: String, name: String)
*/
sealed trait SubjectV2

/**
* Represents an IRI used as the subject of a statement.
*/
case class IriSubjectV2(value: IRI) extends SubjectV2 {
override def toString: IRI = value
}

/**
* Represents a blank node identifier used as the subject of a statement.
*/
case class BlankNodeSubjectV2(value: String) extends SubjectV2 {
override def toString: String = value
}
Expand Down Expand Up @@ -276,6 +283,7 @@ case class BlankNodeLiteralV2(value: String) extends LiteralV2 {
*/
case class StringLiteralV2(value: String, language: Option[String] = None) extends LiteralV2 with Ordered[StringLiteralV2] {
override def toString: String = value

def compare(that: StringLiteralV2): Int = this.value.compareTo(that.value)
}

Expand All @@ -298,7 +306,7 @@ case class IntLiteralV2(value: Int) extends LiteralV2 {
}

/**
* Represents an Decimal value.
* Represents a decimal value.
*
* @param value the decimal value.
*/
Expand Down
Loading