edu.stanford.smi.protegex.owl.swrl.parser
Class SWRLParser

java.lang.Object
  extended byedu.stanford.smi.protegex.owl.swrl.parser.SWRLParser

public class SWRLParser
extends Object

Author:
Martin O'Connor , Holger Knublauch

Field Summary
static char AND_CHAR
           
private  String delimiters
           
static char IMP_CHAR
           
private  boolean inHead
           
private  OWLModel owlModel
           
private  boolean parseOnly
           
private  SWRLFactory swrlFactory
           
private  StringTokenizer tokenizer
           
private  HashSet variables
           
private  Collection xmlSchemaSymbols
           
 
Constructor Summary
SWRLParser(OWLModel owlModel)
           
 
Method Summary
private  void checkAndSkipToken(String skipToken, String unexpectedTokenMessage)
           
private  RDFResource getIndividual(String name)
           
private  String getNextNonSpaceToken(String noTokenMessage)
           
private  String getNextStringToken(String noTokenMessage)
           
private  SWRLVariable getSWRLVariable(String name)
           
private  boolean hasMoreNonSpaceTokens()
           
private  boolean isBuiltinName(String identifier)
           
private  boolean isDifferentFrom(String identifier)
           
private  boolean isOWLClassName(String identifier)
           
private  boolean isOWLDatatypePropertyName(String identifier)
           
private  boolean isOWLObjectPropertyName(String identifier)
           
private  boolean isSameAs(String identifier)
           
private  boolean isValidIdentifier(String s)
           
private  boolean isValidIndividualName(String name)
           
private  boolean isXSDDatatype(String identifier)
           
 SWRLImp parse(String rule)
           
 SWRLImp parse(String rule, SWRLImp imp)
           
private  SWRLAtom parseAtom(String identifier)
           
private  SWRLAtom parseBuiltinParameters(String identifier)
           
private  SWRLAtom parseClassAtomParameters(String identifier)
           
private  SWRLAtom parseDatavaluedPropertyAtomParameters(String identifier)
           
private  SWRLAtom parseDifferentFromAtomParameters()
           
private  RDFObject parseDObject()
           
private  List parseDObjectList()
           
private  SWRLAtom parseEnumeratedListParameters(List enumeratedList)
           
private  SWRLAtom parseIndividualPropertyAtomParameters(String identifier)
           
private  RDFResource parseIObject()
           
private  SWRLAtom parseSameAsAtomParameters()
           
private  SWRLAtom parseXSDDatatypeParameters(String identifier)
           
 void setParseOnly(boolean parseOnly)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AND_CHAR

public static final char AND_CHAR
See Also:
Constant Field Values

IMP_CHAR

public static final char IMP_CHAR
See Also:
Constant Field Values

owlModel

private OWLModel owlModel

swrlFactory

private SWRLFactory swrlFactory

parseOnly

private boolean parseOnly

tokenizer

private StringTokenizer tokenizer

delimiters

private String delimiters

xmlSchemaSymbols

private Collection xmlSchemaSymbols

variables

private HashSet variables

inHead

private boolean inHead
Constructor Detail

SWRLParser

public SWRLParser(OWLModel owlModel)
Method Detail

setParseOnly

public void setParseOnly(boolean parseOnly)

parse

public SWRLImp parse(String rule)
              throws SWRLParseException
Throws:
SWRLParseException

parse

public SWRLImp parse(String rule,
                     SWRLImp imp)
              throws SWRLParseException
Throws:
SWRLParseException

parseAtom

private SWRLAtom parseAtom(String identifier)
                    throws SWRLParseException
Throws:
SWRLParseException

checkAndSkipToken

private void checkAndSkipToken(String skipToken,
                               String unexpectedTokenMessage)
                        throws SWRLParseException
Throws:
SWRLParseException

getNextStringToken

private String getNextStringToken(String noTokenMessage)
                           throws SWRLParseException
Throws:
SWRLParseException

getNextNonSpaceToken

private String getNextNonSpaceToken(String noTokenMessage)
                             throws SWRLParseException
Throws:
SWRLParseException

hasMoreNonSpaceTokens

private boolean hasMoreNonSpaceTokens()

parseSameAsAtomParameters

private SWRLAtom parseSameAsAtomParameters()
                                    throws SWRLParseException
Throws:
SWRLParseException

parseDifferentFromAtomParameters

private SWRLAtom parseDifferentFromAtomParameters()
                                           throws SWRLParseException
Throws:
SWRLParseException

parseClassAtomParameters

private SWRLAtom parseClassAtomParameters(String identifier)
                                   throws SWRLParseException
Throws:
SWRLParseException

parseIndividualPropertyAtomParameters

private SWRLAtom parseIndividualPropertyAtomParameters(String identifier)
                                                throws SWRLParseException
Throws:
SWRLParseException

parseDatavaluedPropertyAtomParameters

private SWRLAtom parseDatavaluedPropertyAtomParameters(String identifier)
                                                throws SWRLParseException
Throws:
SWRLParseException

parseBuiltinParameters

private SWRLAtom parseBuiltinParameters(String identifier)
                                 throws SWRLParseException
Throws:
SWRLParseException

parseXSDDatatypeParameters

private SWRLAtom parseXSDDatatypeParameters(String identifier)
                                     throws SWRLParseException
Throws:
SWRLParseException

parseEnumeratedListParameters

private SWRLAtom parseEnumeratedListParameters(List enumeratedList)
                                        throws SWRLParseException
Throws:
SWRLParseException

parseDObjectList

private List parseDObjectList()
                       throws SWRLParseException
Throws:
SWRLParseException

parseIObject

private RDFResource parseIObject()
                          throws SWRLParseException
Throws:
SWRLParseException

parseDObject

private RDFObject parseDObject()
                        throws SWRLParseException
Throws:
SWRLParseException

isSameAs

private boolean isSameAs(String identifier)
                  throws SWRLParseException
Throws:
SWRLParseException

isDifferentFrom

private boolean isDifferentFrom(String identifier)
                         throws SWRLParseException
Throws:
SWRLParseException

isOWLClassName

private boolean isOWLClassName(String identifier)
                        throws SWRLParseException
Throws:
SWRLParseException

isOWLObjectPropertyName

private boolean isOWLObjectPropertyName(String identifier)
                                 throws SWRLParseException
Throws:
SWRLParseException

isOWLDatatypePropertyName

private boolean isOWLDatatypePropertyName(String identifier)
                                   throws SWRLParseException
Throws:
SWRLParseException

isBuiltinName

private boolean isBuiltinName(String identifier)
                       throws SWRLParseException
Throws:
SWRLParseException

isXSDDatatype

private boolean isXSDDatatype(String identifier)
                       throws SWRLParseException
Throws:
SWRLParseException

isValidIdentifier

private boolean isValidIdentifier(String s)

isValidIndividualName

private boolean isValidIndividualName(String name)
                               throws SWRLParseException
Throws:
SWRLParseException

getIndividual

private RDFResource getIndividual(String name)
                           throws SWRLParseException
Throws:
SWRLParseException

getSWRLVariable

private SWRLVariable getSWRLVariable(String name)
                              throws SWRLParseException
Throws:
SWRLParseException