Semantic Metadata - Fluid Topics - 3.7 - Technical Notes

Develop Connectors with the Fluid Topics API

Product
Fluid Topics
Fluid Topics Version
3.7
Category
Technical Notes
Language
English
Target Audience
public

Semantic metadata associates a string value with a key. Semantic metadata begin with "ft:", such as ft:title. It is possible to create the following semantic metadata with the Fluid Topics API:

  • ft:title: defines the title of a document or topic.
  • ft:description: defines the description of a document or topic
  • ft:locale: defines the content locale (language designator + region designator).
  • ft:baseId: its value is used when building links and for clustering several publications in the Search page.
  • ft:prettyUrl: defines meaningful and non-ambiguous URLs (to be concatenated with the portal domain name and go prefix, e.g. https://my.ft.net/go/my-pretty-url) providing access to documents, with a redirect to the canonical Fluid Topics URL.
  • ft:editorialType: defines the editorial type of a document.
  • ft:lastEdition: defines the most recent modification date of a document

The following lines show how to create semantic metadata:

from fluidtopics.connector import EditorialType, StructuredDocument, Metadata

# Create semantic metadata
title = Metadata.title("Document Title")
locale = Metadata.locale("en-US")
base_id = Metadata.base_id("my-base-id)
pretty_url = Metadata.pretty_url("my-pretty-url")
editorial_type = Metadata.editorial_type(EditorialType.BOOK)
last_edition_date = Metadata.last_edition('2020-06-18')

# Attach semantic metadata to a publication
book_B = StructuredDocument.create(
document_id="my-structured-document"
toc=[topicA, topicB],
metadata=[title, locale, base_id, pretty_url, editorial_type, last_edition_date],
)

# or use dedicated method attributes to attach a semantic metadata
article = StructuredDocument.create(
document_id="my-structured-document-article",
title="Article title",
locale="en-US",
base_id="my-article-base-id"
pretty_url="my-pretty-article",
toc=[topic_B],
editorial_type=EditorialType.ARTICLE,
last_edition="2020-05-15"
)

In the example above, title = Metadata.title('Document Title') corresponds to the semantic metadata ft:title.