Naviga Writer
6.3.3
6.3.3
  • Naviga Writer
  • Release notes
    • 6.3.3
    • 6.3.2
    • 6.3.1
    • 6.2.1
    • 6.2.0
    • 6.1.2
    • 6.1.1
    • 6.1.0
    • 6.0.0
    • 5.3.0
  • Introduction
    • Authoring
    • Developing
    • Publishing
    • User stories and reference cases
  • User Guide
    • Writer User Guide
      • The Content Area and Tabs
        • Help menu
        • Language menu
        • Article name
        • Writing teasers
        • Content area
        • Information
        • Search and replace words
        • History Button
        • Save and publish flow
        • Tabs
          • Meta Tab
            • Author
            • Channels
          • Integrations Tab
          • Image and Article search Tab
        • Locked article
      • Text management
      • Writer Keyboard Shortcuts
      • Personal Writer template
      • Channels to control access
      • Images User Guide
      • Common questions when starting using Writer
  • Admin Guide
    • Configuration files
    • Configurations Guide
    • Configuration of Writer templates
    • Publish Flow
      • Default configuration definitions
      • Starting part of the configuration
      • Publish flow config details
      • Configuration of calendarLocale
      • Preconditions for roles in the publish flow
    • Generic properties for Objects
      • Generic properties configuration
    • Image Services
      • Photo uploader
      • Binary Service Light
      • ImEngine
      • Imgix
    • Available Plugins
      • Naviga developed plugins
        • Plugins in earlier versions of Writer
      • Third-party plugins
  • Developer guide
    • Writer plugin development
      • Quickstart
      • Plugin overview
      • Creating an content object plugin
      • Validation and hooks
      • Interacting with external resources
    • Writer Plugin Building Blocks
      • Package
      • Component
      • Node
      • Converter
      • Events
    • Writer plugin style guide
      • CSS Guidelines
      • CSS variables, colors and fonts
      • UI Components
    • Tutorials
      • Popover & text analysis
      • Search & replace
      • Concept interaction
    • Infomaker NewsML
      • Overview
      • Document relations and types
      • Extensions XSD
      • NewsItem
      • ConceptItem
      • PlanningItem
      • Examples
        • NewsItem - Text
        • NewsItem - Picture
        • NewsItem - PDF
        • ConceptItem - Author
        • ConceptItem - Category
        • ConceptItem - Channel
        • ConceptItem - Content Profile
        • ConceptItem - Event
        • ConceptItem - Organisation
        • ConceptItem - Person
        • ConceptItem - Place (point)](point)](point)](point)](point)](point)](point)](point)](point)](point)]
        • ConceptItem - Place (polygon)](polygon)](polygon)](polygon)](polygon)](polygon)](polygon)](polygon)]
        • ConceptItem - Section
        • ConceptItem - Story
        • ConceptItem - Topic
        • PlanningItem
    • Media Enrichment
      • Images
  • API Reference
    • Writer Api
      • Api
      • Article
      • Browser
      • Concept
      • ConceptService
      • Document
      • Events
      • NewsItem
      • Router
      • Ui
      • Upload
      • User
      • settings
    • UI Components
      • UIAvatar
      • UIButton
      • UIByline
      • UICheckbox
      • UIChip
      • UIDatePicker
      • UIDatetimeFieldEditor
      • UIDropdown
      • UIFieldEditor
      • UIIconButton
      • UIInlineImage
      • UIPagination
      • UISelect
      • UITimePicker
      • UIToggle
      • UITooltip
      • UIInputText
      • UITextarea
Powered by GitBook
On this page
  • Overview
  • Interacting with concepts
  • Operations
  • Events

Was this helpful?

  1. Developer guide
  2. Tutorials

Concept interaction

PreviousSearch & replaceNextInfomaker NewsML

Last updated 5 years ago

Was this helpful?

Overview

Concept is a term describing different kind of "tags" that can be linked to an article. Concepts can be of different types which ads a way to separate tags (or metadata) for different needs.

An article can be linked to zero, one or many concepts, with different types. And each link points to a specific concept item in the backend repository.

Each linked concept is represented as a link tag in the article document.

<link rel="subject" title="Elitserien" type="x-im/category" uuid="b3c8f46f-00db-4e23-a98f-69494582aacc" />

Full documentation on Concepts

Interacting with concepts

All communication with the article document object dealing with concepts should go through the ConceptService class imported directly from the writer.

// Import the ConceptService
import { ConceptService } from 'writer'

// Get all current concepts from the article, of a specific type
const articleConcepts = ConceptService.getArticleConceptsByType('x-im/author')

// Get all concepts of a specific type from repository
const repositoryConcepts = ConceptService.getRemoteConceptsByType('x-im/category')

// Get all additional properties like broader, assiciated-with, long and short description etc for a concept
const enhancedConcept = await ConceptService.fetchConceptItemProperties({ uuid: 'xyz' })

// text-search for conceptSuggestions
const conceptSuggestions = await ConceptService.searchForConceptSuggestions('x-im/category', 'searchterm', subtypesArray = [])
const conceptSuggestions = await ConceptService.searchForConceptSuggestions(
    'x-im/place',
    'Kalmar', /* <-- this is where the search term goes */
    subtypesArray = ['x-im/position', 'x-im/polygon']
)

/**
 * Create a new concept and add it to the document
 *
 * You will need to use the propertyMap to e sure that you object
 * gets the configured properties for the current backend
 **/
const propertyMap = ConceptService.getPropertyMap()
const newConceptItem = {}
newConceptItem[propertyMap.uuid] = 'uuid'
newConceptItem[propertyMap.ConceptImTypeFull] = 'x-im/channel'
newConceptItem[propertyMap.ConceptName] = 'My new channel'

// Add the new concept
ConceptService.addArticleConcept(newConceptItem)

// Or update an existing one
ConceptService.updateArticleConcept(updatedConceptItem)

// Or remove it
ConceptService.removeArticleConceptItem(conceptItem)

Operations

The ConceptService exposes an API to perform Concept related operation, like searching for concepts in the backend repository, or adding, updating or removing concepts in the article document.

Events

To hook into the different life cycle events of concepts, ConceptsService exposes a way to register callback functions on a specific type and event (here called operations).

Example of how to bind a callback function that will be fired after a new Category concept has been added to the article can be seen below. The callback will receive the new concept object as argument.

ConceptService.on(
    'x-im/category',
    ConceptService.operations.ADDED,
    this.handleNewCategory
)

The available operations are:

{
    ADD: 1,
    ADDED: 2,
    UPDATE: 3,
    UPDATED: 4,
    REMOVE: 5,
    REMOVED: 6
}
can be found here