-
Notifications
You must be signed in to change notification settings - Fork 21
FormAppearance
architolk edited this page Jun 16, 2017
·
9 revisions
With a FormAppearance
you define the dialog between the user and the LDT. You will use a Form appearance whenever you want to use a parameterized query (for example: a search form).
The appearance of each row can be changed with the elmo:fragment
statement:
- (mandatory):
elmo:applies-to
states the name of the parameter to which the fragment applies. - (optional):
elmo:constraint
states some constraint with regard to the parameter. You will useelmo constraint elmo:MandatoryConstraint
to specifiy that the parameter is mandatory (should be present). - (optional):
rdfs:label
states the label that is used for the input field. - (optional):
rdf:value
gives a default value for a field. Only works for hidden fields and picklists with at most three values. - (optional):
elmo:valuesFrom
creates a drop-down list. This predicate should refer to some representation (probably a hidden representation). Please note that you must include this representation within the main representation (as depicted in the example below). - (optional):
elmo:valueDatatype
states the datatype of the parameter. The kind of input is derived from the datatype:-
dcmitype:Dataset
will create a file upload field; -
xsd:String
will create a text area input; -
xsd:Date
will create a datepicker.
-
- (optional):
elmo:valuePattern
states the RegEx pattern for the input field. This property can be used with theelmo:valueHint
that is depicted whenever the input doesn't match the pattern. - (optional):
elmo:index
states the order of the fields. - (optional):
elmo:appearance
states a particular appearance. You would only use this with a elmo:HiddenAppearance or elmo:SubmitAppereance. THe first creates a hidden field, the latter creates a button. You don't have to specify aelmo:applies-to
for buttons.
To use a Form appearance, you create a relationship between a representation and the form. Whenever the main representation is used, the LDT checks if the mandatory parameters are present. If not, the form will be shown: elmo:queryForm stage:some_form
.
@prefix elmo: <http://bp4mc2.org/elmo/def#>.
@prefix xhtml: <http://www.w3.org/1999/xhtml/vocab#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix stage: <http://localhost:8080/stage#>.
stage:search a elmo:Representation;
elmo:url-pattern "/query/search$";
elmo:queryForm stage:search_form;
elmo:contains stage:search_classes;
elmo:query '''
select *
where {
?item rdf:type <@TYPE@>.
?item rdfs:label ?item_label.
FILTER (regex(?item,"@TERM@","i"))
}
'''
.
stage:search_form a elmo:Form;
elmo:fragment [
elmo:applies-to "term";
rdfs:label "Zoekterm"@nl;
rdfs:label "Search term"@en;
elmo:constraint elmo:MandatoryConstraint;
elmo:index "1";
];
elmo:fragment [
elmo:applies-to "type";
rdfs:label "Klasse"@nl;
rdfs:label "Class"@en;
elmo:valuesFrom stage:search_classes;
elmo:constraint elmo:MandatoryConstraint;
elmo:index "2";
];
elmo:fragment [
elmo:appearance elmo:SubmitAppearance;
rdfs:label "Search"@en;
rdfs:label "Zoeken"@nl;
elmo:index "3";
]
.
stage:search_classes a elmo:Part;
elmo:appearance elmo:HiddenAppearance;
elmo:query '''
construct {?class rdfs:label ?label}
where {
select *
where {
?class a ?type.
?class rdfs:label ?label.
FILTER(?type=owl:Class || ?type=rdfs:Class)
}
limit 100
}
''';
.
- Home
- Theatre installation
- Tutorial
- Using the theatre
- Configuring the theatre
-
Appearances
- CarouselAppearance
- ChartAppearance
- ContentAppearance
- GeoAppearance
- GeoSelectAppearance
- GraphAppearance
- FormAppearance
- FrameAppearance
- HeaderAppearance
- HiddenAppearance
- HtmlAppearance
- IndexAppearance
- ImageAppearance
- LoginAppearance
- ModelAppearance
- NavbarAppearance
- NavbarSearchAppearance
- ShortTableAppearance
- TableAppearance
- TreeAppearance
- TextAppearance
- VocabularyAppearance
- LDT Vocabulary