Topics (query directive)
| Line 6: | Line 6: | ||
new Topics() | 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. | ||
[[Category:Query directives]] | [[Category:Query directives]] | ||
Latest revision as of 11:57, 21 August 2009
[edit] Description
Gets the topic with subject identifier equal to the string value of the active column value of input.
[edit] Constructor
new Topics()
[edit] 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.