Topics (query directive)

From WandoraWiki
Jump to: navigation, search

Description

Gets the topic with subject identifier equal to the string value of the active column value of input.

Constructor

new Topics()

Examples

You can get a single topic as follows.

importPackage(org.wandora.query2);
new Topics().from("http://www.wandora.org/core/contenttype")

Note that in many cases it is not necessary to do this explicitly. For example if you want to get instances of content type you can simply do following.

importPackage(org.wandora.query2);
new Instances().from("http://www.wandora.org/core/contenttype")

Instances as well as all other topic maps directives can take the input topic as a subject identifier so it is not necessary to convert it into a topic. However you may want to do it if you are going to need the topic for something else as well. For example.

importPackage(org.wandora.query2);
new Instances().from(
  new Topics().as("#contenttype").from("http://www.wandora.org/core/contenttype")
)

This preserves the content type topic in the results. It is also an actual topic and not a subject identifier string. If this query was part of some bigger query, you could use the topic for some other purpose some place else.

Personal tools