Skip to content
This repository has been archived by the owner. It is now read-only.

5. Interface adaption

LaraHack edited this page Mar 18, 2016 · 6 revisions

The interface of Accurator can be adapted in various ways. This page describes how to add domain specific texts and how to create a domain specific annotation template. The next wiki page describes how the interface of Accurator can be translated.

Creating an annotation template

Different domains require different information to be gathered. The fields to be shown in the annotation interface (e.g. bird species/biblical theme) are customizable, including the source for the autocompletion. This specification is done in RDF in the folder cpack/accurator/rdf/domain/[domain_name]/ui/fields.ttl.

Thus, for the bible domain, the specification for the fields is in cpack/accurator/rdf/domain/bible/ui/fields.ttl. As an example, we consider the biblical theme field to illustrate the definition of a new field:

abibui:ICBibleTheme a auis:DropdownField ;
	rdfs:label "Theme"@en ;
	rdfs:label "Thema"@nl ;
	dcterms:comment "add the Biblical theme"@en ;
	dcterms:comment "voeg het bijbelse thema toe"@nl ;
	auis:source "/api/autocomplete?q={query}&filter={\"scheme\":\"\"}" .

The rdfs:label is used for the title of the field, the dc:comment for the description. The auis:source allows the specification of the autocompletion source, which is done by indicating the concept scheme (see taxonomies for how to make concepts part of a concept scheme).

If the field has a fixed number of values this can also be added to the RDF directly, as illustrated with the intensity field, a field used for rating the intensity of an emotion that can be identified in a biblical theme, for example.

abibui:Intensity a auis:RadioButtonField ;
	rdfs:label "Intensiteit emotie"@nl ;
	rdfs:label "Emotion intensity"@en ;
	dcterms:comment "wat is de intensiteit van de emotie?"@nl ;
	dcterms:comment "what is the intensity of the emotion?"@en ;
	auis:source ( "very weak"@en "weak"@en "average"@en "strong"@en "very strong"@en ) ;
	auis:source ( "zeer zwak"@nl "zwak"@nl "gemiddeld"@nl "sterk"@nl "zeer sterk"@nl ) .

After you define a new field this has to be linked to the actual annotation interface, by adding it to an ordered list linked to the interface by the auis:wholeFields or auis:fragmentFields predicate:

abibui:smallBibleUI a auis:AnnotationUI ;
    dcterms:title "Bible annotation UI"@en;
    auis:wholeFields (
	) .

 abibui:emotionUI a auis:AnnotationUI ;
    dcterms:title "Emotion annotation UI"@en;
 	auis:fragmentFields (
 	 ) .

After creating a new annotation interface, the file with the interface elements has to be loaded. For this, first, the field elements need to be added to a data subset and domain, then they need to be loaded.

The field elements are added by including the fields.ttl file in the subset for a particular domain in the void.ttl file:

	a void:Dataset ;
	dcterms:title "Accurator UI instance for bible" ;
	void:dataDump <domain/bible/ui/labels.ttl> ,
				  <domain/bible/ui/labels_nl.ttl> ,
				  <domain/bible/ui/fields.ttl> .

So, for a specific domain, here bible, a subset of the specific labels and also the fields used for the annotation interface can be loaded together:

	a void:Dataset ;
	dcterms:title "Accurator configuration for bible domain" ;
	void:dataDump <domain/bible/bible_domain.ttl> ,
				  <domain/bible/concept_scheme_bible_figure.ttl> ,
				  <domain/bible/concept_scheme_bible_theme.ttl> ;
	void:subset <accurator-ui-bible> .

In order to actually load the actual domain, here bible, this line needs to be added to the config-available/ file, see also domains.

:- rdf_load_library('accurator-bible-domain').

Domain specific text

The text in the Accurator interface can be tailored towards the domain that is used. There is a generic interface that is used by the system as a whole and an interface that can be domain specific, adding to the generic domain things that are specific to a certain domain.

Text labels are stored in RDF files and creating more specific labels can be done by adding a domain specific file. The standard text labels can be found in the cpack/accurator/rdf/ui folder. As multiple languages can be used, this folder can contain several files with labels in various languages. The default language is English and the convention for naming the language files is specified in locale. The RDF used to define the labels of for the Intro page is:

###### Intro Screen #####
aui:intro a auis:UI ;
	dcterms:title "Accurator intro UI"@en ;
	aui:introHdrSlogan "Accurate Art Annotations"@en ;
	aui:introHdrSubSlogan "Help us add information to artworks"@en ;
	aui:introBtnRegister "Register"@en ;
	aui:introBtnLogin "or Log in"@en ;
	aui:introLnkAbout "About Accurator"@en .

aui:introHdrSlogan rdfs:subPropertyOf auis:uiLabel .
aui:introHdrSubSlogan rdfs:subPropertyOf auis:uiLabel .
aui:introBtnRegister rdfs:subPropertyOf auis:uiLabel .
aui:introBtnLogin rdfs:subPropertyOf auis:uiLabel .
aui:introLnkAbout rdfs:subPropertyOf auis:uiLabel .

To make the sub slogan domain specific, add a file to cpack/accurator/rdf/domain/[domain name]/ui/labels.ttl containing the domain specific predicate. For example, to add a sub slogan specific for the bible domain, we need to add the following to cpack/accurator/rdf/domain/bible/ui/labels.ttl:

###### Bible Intro Screen #####
abibui:intro a auis:UI ;
	rdfs:subClassOf aui:intro;
	aui:introHdrSubSlogan "Help us add information to artworks with biblical scenes"@en .

This way, when the user views the bible domain, the sub slogan message of the generic interface will be replaced by the one specific for the bible domain.

Make sure to include the RDF file containing more specific labels in the domain dataset definition in the void.ttl file (as described in domains). When the specific domain is selected by a user, Accurator will render the labels that belong to that domain. You may have noticed the language tags at the end of the lines, in the next page you learn how to use those to allow Accurator to include other languages.