Help:Sbp.tag.mode

From Semantic Portal Wiki

Jump to: navigation, search

Contents

Description

Help:Sbp.tag.mode Template:Sbp.tag.mode Form:Sbp.tag.mode Category:tag.mode
  • description: Add a SMW annotation with (i)parse mode; (ii)length limit
  • module: Help:SMW API
  • version: 0.1
  • status: unstable
  • author: Li Ding

Usage

{{sbp.tag
 |PROPERTY   # must be the 1st parameter {{{1}}}
 |VALUE      # must be the 2nd parameter {{{2}}}
 |mode =     # the choice of parsing mode; 
               allowed values:  'text' - no SMW parsing, ignore NAMESPACE, print VALUE as String
	                        'one' - SMW parsing, treat VALUE as one value.
				'list' - SMW parsing, treat VALUE as a list of values; 
				         default delimiter is ',' 
					 alternative delimiter is ';'
               default value: 'one'.
 |namespace  # the namespace attached before each parsed item of VALUE 
               possible values: {'category', 'property'};
 |length =   # the max length limit of a value string;  
               allowed values: -1 for no length limit, 
                                0 for do not show, 
                                any positive number otherwise;
               default value: '-1'. 
}}

Examples

Example 1. Typical Use

parse in 'text' mode, expect no triple containing "not RDF" Template:Sbp.tag.mode
parse in 'one' mode, expect one triple containing "is RDF" Template:Sbp.tag.mode
parse in 'list' mode, expect three triples Template:Sbp.tag.mode

Example 2. Special case when VALUE is empty


Template:Sbp.tag.mode


Example 3. Special treatment on delimiter when mode=list

  • list items are delimited by either ';' or ','
  • ';' has higher priority than ',' when they co-exist in one VALUE
  • ',' is the default delimiter
delimiter is ',', expect two triples linking to 'P3.1.1' 'P3.1.2' Template:Sbp.tag.mode
delimiter is ';', expect two triples linking to 'P3.2.1' 'P3.2.2' Template:Sbp.tag.mode
delimiter is ';', expect two triples linking to 'Troy, New York' 'Stanford, California' Template:Sbp.tag.mode
Plan A to avoid mistakenly parse 'Troy, New York' Template:Sbp.tag.mode
Plan B to avoid mistakenly parse 'Troy, New York' Template:Sbp.tag.mode
User show either not use ';' in page name, or not use mode=list parsing mode Template:Sbp.tag.mode

Example 4. Regression Test

passing namesapce Template:Sbp.tag.mode Template:Sbp.tag.mode

Facts about Sbp.tag.modeRDF feed
AuthorLi Ding  +
DescriptionAdd a SMW annotation with (i)parse mode; (ii)length limit
ModuleHelp:SMW API  +
Statusunstable  +
Version0.1  +
Personal tools
Semantic Web Community
Tetherless World constellation
maintenance