001    /*
002     * The contents of this file are subject to the Mozilla Public License
003     * Version 1.1 (the "License");  you may not use this file except in 
004     * compliance with the License.  You may obtain a copy of the License at
005     * http://www.mozilla.org/MPL/
006     *
007     * Software distributed under the License is distributed on an "AS IS" basis,
008     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009     * the specific language governing rights and limitations under the License.
010     *
011     * The Original Code is Protege-2000.
012     *
013     * The Initial Developer of the Original Code is Stanford University. Portions
014     * created by Stanford University are Copyright (C) 2007.  All Rights Reserved.
015     *
016     * Protege was developed by Stanford Medical Informatics
017     * (http://www.smi.stanford.edu) at the Stanford University School of Medicine
018     * with support from the National Library of Medicine, the National Science
019     * Foundation, and the Defense Advanced Research Projects Agency.  Current
020     * information about Protege can be obtained at http://protege.stanford.edu.
021     *
022     */
023    
024    package edu.stanford.smi.protegex.owl.model;
025    
026    /**
027     * An RDF resource representing an XML Schema datatype.
028     *
029     * @author Holger Knublauch  <holger@knublauch.com>
030     */
031    public interface RDFSDatatype extends RDFResource {
032    
033        /**
034         * If this is a user-defined datatype, then this method gets the restricted base type.
035         * <B>Note: This experimental method should not be used yet.</B>
036         *
037         * @return the base type or null
038         */
039        RDFSDatatype getBaseDatatype();
040    
041    
042        /**
043         * Creates a default value for this datatype (e.g. Integer(0) for xsd:int).
044         *
045         * @return a default value
046         */
047        Object getDefaultValue();
048    
049    
050        /**
051         * Gets the value of the xsd:length facet of this (user-defined) datatype.
052         * <B>Note: This experimental method should not be used yet.</B>
053         *
054         * @return the length of this (string) datatype or -1 if none is defined
055         */
056        int getLength();
057    
058    
059        /**
060         * Gets the value of the xsd:maxExclusive facet of this (user-defined) datatype.
061         * <B>Note: This experimental method should not be used yet.</B>
062         *
063         * @return the exclusive maximum value of this datatype or null
064         */
065        RDFSLiteral getMaxExclusive();
066    
067    
068        /**
069         * Gets the value of the xsd:maxInclusive facet of this (user-defined) datatype.
070         * <B>Note: This experimental method should not be used yet.</B>
071         *
072         * @return the inclusive maximum value of this datatype or null
073         */
074        RDFSLiteral getMaxInclusive();
075    
076    
077        /**
078         * Gets the value of the xsd:maxLength facet of this (user-defined) datatype.
079         * <B>Note: This experimental method should not be used yet.</B>
080         *
081         * @return the maximum length of this (string) datatype or -1 if none is defined
082         */
083        int getMaxLength();
084    
085    
086        /**
087         * Gets the value of the xsd:minExclusive facet of this (user-defined) datatype.
088         * <B>Note: This experimental method should not be used yet.</B>
089         *
090         * @return the exclusive minimum value of this datatype or null
091         */
092        RDFSLiteral getMinExclusive();
093    
094    
095        /**
096         * Gets the value of the xsd:minInclusive facet of this (user-defined) datatype.
097         * <B>Note: This experimental method should not be used yet.</B>
098         *
099         * @return the inclusive minimum value of this datatype or null
100         */
101        RDFSLiteral getMinInclusive();
102    
103    
104        /**
105         * Gets the value of the xsd:minLength facet of this (user-defined) datatype.
106         * <B>Note: This experimental method should not be used yet.</B>
107         *
108         * @return the minimum length of this (string) datatype or -1 if none is defined
109         */
110        int getMinLength();
111    
112    
113        /**
114         * Gets the value of the xsd:pattern facet of this (user-defined) datatype.
115         * Patterns must be regular expressions.
116         * <B>Note: This experimental method should not be used yet.</B>
117         *
118         * @return the pattern or null if none is defined
119         */
120        String getPattern();
121    
122    
123        /**
124         * Checks if this is a numeric type.  This is for example needed to decide
125         * whether values shall be edited with left or right alignment.
126         *
127         * @return true  if this is a numeric datatype (such as xsd:int)
128         */
129        boolean isNumericDatatype();
130    
131    
132        /**
133         * Checks if a given would be a valid value for this property.
134         * This should check for XML Schema datatype facet violations.
135         *
136         * @param object the potential value
137         * @return true if the object would be valid
138         */
139        boolean isValidValue(RDFSLiteral object);
140    }
141