Skip to content
Szaby Grünwald edited this page Feb 26, 2013 · 4 revisions

The LDPlugin loads the Linked Data resource for the annotations.

Added Features

  • Asynchronous loading of the resources and referenced reources
  • Adding a Promise object on the annotation getting the linked entities. (See jQuery.Deferred Object). The promise delivers an array of VIE instances.
  • The fulfilled promise also means that some convenience methods are implemented on the annotation object like getLabel(), getDescription(), getDepiction(), etc.

Options

  • followRedirects: An array of property URIs, CURIEs or methods to dereference redirects. See Follow Redirects.

Follow Redirects

When dereferencing an annotation, the LDPlugin tries to find and preload the entities that have the properties that are needed by the plugins. For the simple use case these are label, description and depiction. It can happen, that a DBPedia entity gets restructured and changed to a wikipage redirect (the change happens directly on wikipedia) and the annotated entity doesn't have any "useful" properties any more, everything can be found at the redirect target entity. The only property that can still help us further is the dbpedia:wikiPageRedirects property. The LDPlugin follows such properties and loads these further entities. When a plugin requests for a property using for example getLabel(), the API looks for the property in the first (original) entity and if the property is set, it returns it. If the property is missing in that entity, if looks into the next (redirected) entity and so on.

The redirect property can also be defined as a method of the following form: (CoffeeScript notation)

(ent) ->
  engName = VIE.Util.getPreferredLangForPreferredProperty(ent, ['rdfs:label', 'geonames:alternateName'], ["en"])
  if engName
    return "http://dbpedia.org/resource/#{engName.replace(/\s/g, '_')}"

This method takes the entity as its only argument, figures out the english label of it and builds and returns a DBPedia resource URI using the english label.

Dependencies

  • VIE library
  • uses an Apache Stanbol endpoint (default: http://dev.iks-project.eu:8081)
  • The played video has to have annotations

Widgets

None

Added Properties

  • annotation.entities: the loaded annotation array. This is guaranteed from the time when the promise object is fulfilled.
  • annotation.getLabel(): Looks up the label of the resource in the preferred language defined in options.preferredLanguage
  • annotation.geDepiction(options): Looks up the (foaf:) depiction of the annotation resource. The options parameter is optional can take one of with: <string> or without: <string> parameter. E.g. annotation.geDepiction({without: 'thumb'}) would try to find a depiction that doesn't contain the string 'thumb'. If it's not possible to find such, it falls back to the one with the string. with works the same way.
  • annotation.getDescription(): Looks up the description of the resource in the preferred language defined in options.preferredLanguage (to be implemented)
  • annotation.getPage: Looks up the Homepage (foaf:page) of the annotation resource. If it's not present, it tries to build a wikipedia link based on the users preferred language.

Events

None