info.bliki.wiki.model
Class WikiModel

java.lang.Object
  extended by info.bliki.wiki.model.AbstractWikiModel
      extended by info.bliki.wiki.model.WikiModel
All Implemented Interfaces:
IConfiguration, IContext, IWikiModel
Direct Known Subclasses:
BBCodeModel, PDFWikiModel

public class WikiModel
extends AbstractWikiModel

Standard model implementation


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> categories
          A map for categories and their associated sort keys
protected  java.lang.String fExternalImageBaseURL
           
protected  java.lang.String fExternalWikiBaseURL
           
protected  java.util.Set<java.lang.String> links
           
protected  java.util.List<SemanticAttribute> semanticAttributes
           
protected  java.util.List<SemanticRelation> semanticRelations
           
protected  java.util.Set<java.lang.String> templates
           
 
Fields inherited from class info.bliki.wiki.model.AbstractWikiModel
attributeRenderers, attributes, fNamespace, fPageTitle, fParserRecursionCount, fRecursionLevel, fRedirectLink, fReferenceNames, fReferences, fSectionCounter, fTableOfContent, fTableOfContentTag, fTagStack, fTemplateRecursionCount, fToCSet
 
Constructor Summary
WikiModel(Configuration configuration, java.util.Locale locale, java.lang.String imageBaseURL, java.lang.String linkBaseURL)
           
WikiModel(Configuration configuration, java.util.ResourceBundle resourceBundle, INamespace namespace, java.lang.String imageBaseURL, java.lang.String linkBaseURL)
           
WikiModel(Configuration configuration, java.lang.String imageBaseURL, java.lang.String linkBaseURL)
           
WikiModel(java.lang.String imageBaseURL, java.lang.String linkBaseURL)
           
 
Method Summary
 void addCategory(java.lang.String categoryName, java.lang.String sortKey)
          When an article contains a token indicating that the article belongs to a specific category this method should be called to add that category to the output metadata.
 void addLink(java.lang.String topicName)
          When a document contains a token indicating that the document links to another Wiki topic this method should be called to add that topic link to the output metadata.
 boolean addSemanticAttribute(java.lang.String attribute, java.lang.String attributeValue)
          See Semantic MediaWiki for more information.
 boolean addSemanticRelation(java.lang.String relation, java.lang.String relationValue)
          See Semantic MediaWiki for more information.
 void addTemplate(java.lang.String template)
          When a document contains a token indicating that the document includes a Wiki template this method should be called to add that template to the output metadata.
 void appendInternalLink(java.lang.String topic, java.lang.String hashSection, java.lang.String topicDescription, java.lang.String cssClass, boolean parseRecursive)
          Append an internal wikilink as described in Help Links
 java.util.Map<java.lang.String,java.lang.String> getCategories()
          Get the set of Wikipedia category names used in this text
 java.util.Set<java.lang.String> getLinks()
          Get the set of Wikipedia links used in this text
 INamespace getNamespace()
          Get the namespace of this model.
 java.util.List<SemanticAttribute> getSemanticAttributes()
          Get the list of SemanticAttributes
 java.util.List<SemanticRelation> getSemanticRelations()
          Get the list of SemanticRelations.
 java.util.Set<java.lang.String> getTemplates()
          
 void parseInternalImageLink(java.lang.String imageNamespace, java.lang.String rawImageLink)
          Append the internal wiki image link to this model.
 boolean replaceColon()
          Replace a colon ':' with a slash '/' in wiki names (i.e. links, categories, templates)
 void setUp()
          Prepare or initialize the wiki model before rendering the wikipedia text
 
Methods inherited from class info.bliki.wiki.model.AbstractWikiModel
addCodeFormatter, addInterwikiLink, addTemplateFunction, addTokenTag, addToReferences, addToTableOfContent, append, appendExternalImageLink, appendExternalLink, appendExternalLink, appendHead, appendHead, appendInternalImageLink, appendInterWikiLink, appendISBNLink, appendMailtoLink, appendRawNamespaceLinks, appendRawWikipediaLink, appendRedirectLink, appendSignature, appendStack, appendToCAnchor, buildEditLinkUrl, createNewInstance, createTableOfContent, decrementRecursionLevel, encodeTitleDotUrl, encodeTitleToUrl, get2ndCategoryNamespace, get2ndImageNamespace, get2ndTemplateNamespace, getAttribute, getAttributeRenderer, getCategoryNamespace, getCodeFormatterMap, getCurrentTimeStamp, getImageNamespace, getInterwikiMap, getLocale, getNextNumber, getNode, getPageName, getRawWikiContent, getRecursionLevel, getRedirectLink, getReferences, getResourceBundle, getTableOfContent, getTemplateCallsCache, getTemplateFunction, getTemplateMap, getTemplateNamespace, getTokenMap, getUriSchemeSet, getWikiListener, incrementParserRecursionCount, incrementRecursionLevel, incrementTemplateRecursionCount, initialize, isCamelCaseEnabled, isCategoryNamespace, isEditorMode, isImageNamespace, isInterWiki, isMathtranRenderer, isNamespace, isPreviewMode, isSemanticWebActive, isTemplateNamespace, isTemplateTopic, isValidUriScheme, isValidUriSchemeSpecificPart, parseBBCodes, parseEvents, parseTemplates, parseTemplates, peekNode, popNode, pushNode, rawSetAttribute, registerRenderer, render, render, renderPDF, setAttribute, setAttributeRenderers, setDefaultThumbWidth, setPageName, setSemanticWebActive, setTemplateCallsCache, showSyntax, stackSize, substituteTemplateCall, swapStack, tearDown, toNodeList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

categories

protected java.util.Map<java.lang.String,java.lang.String> categories
A map for categories and their associated sort keys


links

protected java.util.Set<java.lang.String> links

templates

protected java.util.Set<java.lang.String> templates

semanticRelations

protected java.util.List<SemanticRelation> semanticRelations

semanticAttributes

protected java.util.List<SemanticAttribute> semanticAttributes

fExternalImageBaseURL

protected java.lang.String fExternalImageBaseURL

fExternalWikiBaseURL

protected java.lang.String fExternalWikiBaseURL
Constructor Detail

WikiModel

public WikiModel(java.lang.String imageBaseURL,
                 java.lang.String linkBaseURL)
Parameters:
imageBaseURL - a url string which must contains a "${image}" variable which will be replaced by the image name, to create links to images.
linkBaseURL - a url string which must contains a "${title}" variable which will be replaced by the topic title, to create links to other wiki topics.

WikiModel

public WikiModel(Configuration configuration,
                 java.lang.String imageBaseURL,
                 java.lang.String linkBaseURL)

WikiModel

public WikiModel(Configuration configuration,
                 java.util.Locale locale,
                 java.lang.String imageBaseURL,
                 java.lang.String linkBaseURL)

WikiModel

public WikiModel(Configuration configuration,
                 java.util.ResourceBundle resourceBundle,
                 INamespace namespace,
                 java.lang.String imageBaseURL,
                 java.lang.String linkBaseURL)
Method Detail

addCategory

public void addCategory(java.lang.String categoryName,
                        java.lang.String sortKey)
When an article contains a token indicating that the article belongs to a specific category this method should be called to add that category to the output metadata. For the sortKey see also Wikipedia:Categorization#Category_sorting

Specified by:
addCategory in interface IWikiModel
Overrides:
addCategory in class AbstractWikiModel
Parameters:
categoryName - The name of the category that the document belongs to.
sortKey - The sort key for the category, or null if no sort key has been specified. The sort key determines what order categories are sorted on category index pages, so a category for "John Doe" might be given a sort key of "Doe, John".

addLink

public void addLink(java.lang.String topicName)
When a document contains a token indicating that the document links to another Wiki topic this method should be called to add that topic link to the output metadata.

Specified by:
addLink in interface IWikiModel
Overrides:
addLink in class AbstractWikiModel
Parameters:
topicName - The name of the topic that is linked to.

addSemanticAttribute

public boolean addSemanticAttribute(java.lang.String attribute,
                                    java.lang.String attributeValue)
See Semantic MediaWiki for more information.

Specified by:
addSemanticAttribute in interface IWikiModel
Overrides:
addSemanticAttribute in class AbstractWikiModel
Returns:

addSemanticRelation

public boolean addSemanticRelation(java.lang.String relation,
                                   java.lang.String relationValue)
See Semantic MediaWiki for more information.

Specified by:
addSemanticRelation in interface IWikiModel
Overrides:
addSemanticRelation in class AbstractWikiModel
Returns:

addTemplate

public void addTemplate(java.lang.String template)
When a document contains a token indicating that the document includes a Wiki template this method should be called to add that template to the output metadata.

Specified by:
addTemplate in interface IWikiModel
Overrides:
addTemplate in class AbstractWikiModel
Parameters:
template - The name of the template that is being included.

appendInternalLink

public void appendInternalLink(java.lang.String topic,
                               java.lang.String hashSection,
                               java.lang.String topicDescription,
                               java.lang.String cssClass,
                               boolean parseRecursive)
Append an internal wikilink as described in Help Links

Specified by:
appendInternalLink in interface IWikiModel
Overrides:
appendInternalLink in class AbstractWikiModel
cssClass - the links CSS class style
parseRecursive - TODO

getCategories

public java.util.Map<java.lang.String,java.lang.String> getCategories()
Get the set of Wikipedia category names used in this text

Returns:
the set of category strings

getLinks

public java.util.Set<java.lang.String> getLinks()
Get the set of Wikipedia links used in this text

Returns:
the set of category strings

getSemanticAttributes

public java.util.List<SemanticAttribute> getSemanticAttributes()
Get the list of SemanticAttributes

Specified by:
getSemanticAttributes in interface IWikiModel
Overrides:
getSemanticAttributes in class AbstractWikiModel
Returns:
the list of SemanticAttributes or null if no SemanticAttribute exists

getSemanticRelations

public java.util.List<SemanticRelation> getSemanticRelations()
Get the list of SemanticRelations. See Semantic MediaWiki for more information.

Specified by:
getSemanticRelations in interface IWikiModel
Overrides:
getSemanticRelations in class AbstractWikiModel
Returns:
the list of SemanticRelations or null if no SemanticRelation exists

getTemplates

public java.util.Set<java.lang.String> getTemplates()


parseInternalImageLink

public void parseInternalImageLink(java.lang.String imageNamespace,
                                   java.lang.String rawImageLink)
Append the internal wiki image link to this model.

Note: the pipe symbol (i.e. "|") splits the rawImageLink into different segments. The first segment is used as the <image-name> and typically ends with extensions like .png, .gif, .jpg or .jpeg.

Note: if the image link contains a "width" attribute, the filename is constructed as <size>px-<image-name>, otherwise it's only the <image-name>.

See Image markup and see Help:Images

Parameters:
imageNamespace - the image namespace
rawImageLink - the raw image link text without the surrounding [[...]]

replaceColon

public boolean replaceColon()
Replace a colon ':' with a slash '/' in wiki names (i.e. links, categories, templates)

Specified by:
replaceColon in interface IWikiModel
Overrides:
replaceColon in class AbstractWikiModel
Returns:

setUp

public void setUp()
Prepare or initialize the wiki model before rendering the wikipedia text

Specified by:
setUp in interface IWikiModel
Overrides:
setUp in class AbstractWikiModel

getNamespace

public INamespace getNamespace()
Get the namespace of this model.

Returns:
the namespace for this model


Copyright © 2012 Java Wikipedia API (Bliki engine). All Rights Reserved.