Skip to content
architolk edited this page Nov 3, 2016 · 3 revisions

A ContentAppearance is one of the two default appearances of the LDT. A content appearance will be used any time the dataset is the result of a CONSTRUCT or DESCRIBE query and no appearance is explicitely defined with the representation.

Content appearance

By default, for every unique predicate in the result set, a row will be presented with two columns. The first column will contain the value of the predicate, the second column will contain the value of the object. If an object is a resource, a hyperlink will be created. This hyperlink will contain a reference to the original URL, but only if the domain of the URL is the same as the URL of the Linked Data Theatre. Otherwise (and in the case of an URN, a dereference will be made to /resource?subject={uuencoded original URI).

A caption will be present, containing the object of a rdfs:label triple, with a hyperlink to the originale URL of the subject.

Tweaking the appearance

The appearance of each row can be changed with the elmo:fragment statement:

  • (mandatory): elmo:applies-to states the predicate to which the fragment applies.
  • rdfs:label defines the label of the predicate (first column of any row).
  • elmo:appearance defines an appearance for the label. Usable appearances are:
    • HiddenAppearance: hide the particular row;
    • HtmlAppearance: the row contains html;
    • MarkdownAppearance: the row contains markdown;
    • GlobalLink: the hyperlink will reference the original URL, and will not dereference to the Linked Data Theatre in case of a domain difference between the original URL and the Linked Data Theatre (URN will still be dereferenced).
  • xhtml:glossary refers to a representation containing glossary terms. The values of this column will be parsed: any term from the glossary will get a hyperlink.

Example

This example shows a content appearance that is used whenever a resource of type skos:Concept is requested.

@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:ContentAppearance a elmo:Representation;
	elmo:applies-to [rdf:type skos:Concept];
	elmo:appearance elmo:ContentAppearance;
	elmo:fragment [
		elmo:applies-to skos:definition;
		rdfs:label "Definition"@en;
		rdfs:label "Definitie"@nl;
	];
	elmo:fragment [
		elmo:applies-to rdfs:label;
		elmo:appearance elmo:HiddenAppearance;
	];
	elmo:fragment [
		elmo:applies-to dcterms:source;
		elmo:appearance elmo:GlobalLink;
	];
	elmo:query '''
		CONSTRUCT {
			<@SUBJECT@> ?predicate ?object
		}
		WHERE {
			<@SUBJECT@> ?predicate ?object
			FILTER (?predicate = skos:definition || ?predicate = rdfs:label || ?predicate = skos:broader || ?predicate = dcterms:source)
		}
	''';
.
Clone this wiki locally