wiki:Autocompletion

Autocompletion

User Documentation

  • as soon as RDFS ontologies have been imported (see RdfsImporter), you may use ontology-driven autocompletion.
  • ontology-driven autocompletion
    When you are typing and open the suggestion box, kaukolu tries to find an uncompleted statement in the last line before the current cursor position. First of all, if you already wrote some characters of a word, only those semantic keywords that start with this sequence will be suggested. Additionally, if the word you are typing is at the position of a predicate, the predicates that have the type of the subject in their domain will appear first in the list. If you are at the position of a object, the subjects that have a type that is in the range of the predicate will be first.
  • standard wiki page name autocompletion. The editor pad is also able to provide page name autocompletion. If you start typing a term with a squared bracked, you can try to press CTRL-space in order to see if there is already a page starting with that name, and complete the name you typed to it. If there are more than 10 pages starting with the prefix you typed it is considered ambigous and no hints are shown at all. In this case, you might want to keep typing and try again after some characters.
  • for an examplanation of the wiki RDF syntax, see SemanticWikiSyntax

Developer Documentation

Main class: de.opendfki.kaukoluwiki.storage.BasicStatementStore

Autocompletion interfaces with a AJAX-class (provided to HTML/JavaScript by DWR) called de.opendfki.kaukoluwiki.ajax/Query.java. This class provides a method similar(text, currentPos, pageName). In general, it produces the text in the editor area 'text', where the current text cursor is a position 'currentPos' a list of information. The result generated is NOT a direct list of proposals or something, but rather an encoded list with proposals embedded, along with information about where to place the text-cursor next and others.

Currently, this method first determines if the request is a page request (which can be recognized by searching for a open squared bracket), or a smarter, ontology based autocompletion request. In this case, the sting gets passed to a higher logic which is described below.

The main method used on the HTML side is getSuggestions(String pageName, String str). The parameter str is the last typed line, which is passed to a special version of the triple parser. This returns the last recognized subject and/or predicate URI, which is used for finding suggestions. The SeRQL queries used look like this:

SELECT DISTINCT
    subjWord
FROM
    {pred} rdfs:range {type},
    {subj} rdf:type {type};
           <kaukolu:isSubjectURIOf> {subjWord}
WHERE
    pred = <insert predicate URI here>;

All semantic keywords will be returned, but those matching will be first in the list. If there are already some characters type, only those starting with the same sequence are returned.

See the javadoc for further explanation of the methodes.

Developer Thoughts

New suggestion popup layout:

Semantic/ontology-based suggestions

  • User typed "PaulMiller has(CTRL+SPACE)"
  • Suggestion box displays...
    • hasType (rdfs)
    • hasName (foaf)
    • rdfs schema
      • hasType Class
      • hasComment Literal
      • ...
    • foaf schema
      • ...
  • the first entries display most frequently used predicates
  • then, (expandable) lists of predicates follow; hasType is listed under "rdfs schema" because it is defined on the rdfs_rdfs page (pages containing ontologies use the rdfs_ prefix in their names); Class is localname of the range of the hasType predicate.

Non-semantic suggestions

  • User typed "[Druc(CTRL+SPACE)"
  • Suggestion box displays...
    • DruckerInstallieren
    • DruckerStandorte
    • Part of name
      • LoeschenEinesDruckers
      • PapiereDruckenLassen
  • Part of name does a substring search, not a startswith search
  • Use alphabetical hierarchies if too many matches occur
  • Since the storage interfaces have undergone some heavy structural refactoring, this functionality should be outsourced to a separate class
Last modified 10 years ago Last modified on 08/18/07 12:05:57