001    // This file is part of AceWiki.
002    // Copyright 2008-2012, AceWiki developers.
003    // 
004    // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU
005    // Lesser General Public License as published by the Free Software Foundation, either version 3 of
006    // the License, or (at your option) any later version.
007    // 
008    // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009    // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010    // Lesser General Public License for more details.
011    // 
012    // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If
013    // not, see http://www.gnu.org/licenses/.
014    
015    package ch.uzh.ifi.attempto.acewiki.aceowl;
016    
017    import java.util.ArrayList;
018    import java.util.Collection;
019    import java.util.List;
020    
021    import ch.uzh.ifi.attempto.acewiki.owl.OWLRelation;
022    import ch.uzh.ifi.attempto.ape.LexiconEntry;
023    import ch.uzh.ifi.attempto.chartparser.LexicalRule;
024    
025    /**
026     * This class stands for relations that are represented by transitive adjectives in ACE and object
027     * properties in OWL. Transitive adjectives consist of an adjective plus a preposition that is
028     * connected to the adjective by a hyphen "-" or an underscore "_". Underscores are replaced by
029     * blanks in the case of pretty-printing. Transitive adjectives have just one word form.
030     *<p>
031     * 0: word form consisting of an adjective plus a preposition.
032     *<p>
033     * Examples: "located-in"; "used_for".
034     * 
035     * @author Tobias Kuhn
036     */
037    public class TrAdjRelation extends OWLRelation implements ACEOWLOntoElement {
038            
039            private String word;
040            
041            /**
042             * Creates a new relation that is represented by a transitive adjective.
043             */
044            public TrAdjRelation() {
045                    word = "";
046            }
047            
048            public String[] getWords() {
049                    return new String[] {word};
050            }
051    
052            public void setWords(String serializedWords) {
053                    String[] words = serializedWords.split(";");
054                    word = words[0];
055            }
056            
057            public String serializeWords() {
058                    return word + ";";
059            }
060            
061            public String getIRISuffix() {
062                    return getWord(0);
063            }
064            
065            public List<LexiconEntry> getLexiconEntries() {
066                    List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
067                    entries.add(LexiconEntry.createTrAdjEntry(word, word, ""));
068                    return entries;
069            }
070            
071            public String getType() {
072                    return "Transitive Adjective";
073            }
074            
075            public String getInternalType() {
076                    return "tradj";
077            }
078            
079            public void collectLexicalRules(String catName, Collection<LexicalRule> lexRules) {
080                    if (catName == null || catName.equals("tradj")) {
081                            lexRules.add(new LexicalRule("tradj", getWord(0)));
082                    }
083            }
084    
085    }