owl.jjt 18.5 KB
Newer Older
1
/* -*-Java-*- */
2 3 4 5 6 7 8

/* 
 * Copyright (C) 2006  Anders Nilsson <anders.nilsson@cs.lth.se>
 *
 * This file is part of OntologyCompiler.
 */

9 10 11 12 13
options {
    MULTI                       = true;
    VISITOR                     = true;
    NODE_DEFAULT_VOID           = true;
    NODE_SCOPE_HOOK             = false;
14
    NODE_PREFIX                 = "";
15 16
    JAVA_UNICODE_ESCAPE         = true;
    STATIC                      = false;
17 18 19
//  	DEBUG_PARSER                = true;
// 	DEBUG_LOOKAHEAD             = true;
//  	DEBUG_TOKEN_MANAGER         = true;
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
} // options


PARSER_BEGIN(OwlParser)
package AST;
public class OwlParser {
}
PARSER_END(OwlParser)


//--------------------------------------------------------------------//
//                           LEXICAL TOKENS                           //
//--------------------------------------------------------------------//

<DEFAULT, BOUNDS> SKIP : /* WHITE SPACE */
{
    " "
    |
    "\t"
    |
    "\n"
    |
    "\r"
    |
    "\f"
}// WHITE SPACE


// <DEFAULT,BOUNDS> SPECIAL_TOKEN : /* COMMENTS */
// {
//     <SLASH_SLASH_COMMENT :  "//" (~["\n","\r"])* >
// }

SPECIAL_TOKEN : /* COMMENTS */
{
//     <SLASH_STAR_COMMENT  :  "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/"  >
56
< "<!--" ( ~["-"] | ( "-" ~["-"] ) )* "-->">
57
	| < "<rdfs:comment" ( ~["<"] | ( "<" ~["/"] ) )* "</rdfs:comment>" >
58
//     <XML_COMMENT  :  "<!--" (~["-","-",">"])* "-->"  >
59 60 61
}// COMMENTS


62 63 64 65
// <BOUNDS> TOKEN: {
//     < BEGINCOMMENT : "<!--"     >
//   | < ENDCOMMENT   : "-->"     >
// }
66 67 68

<DEFAULT, BOUNDS> TOKEN : /* RESERVED WORDS AND LITERALS */
{
69
    < OWL_ALLVALUESFROM     : "owl:allValuesFrom" >
70
  | < OWL_ALLDIFFERENT      : "owl:AllDifferent" >
71
  | < OWL_CARDINALITY        : "owl:cardinality" >
72 73 74 75
  | < OWL_CLASS             : "owl:Class" >
  | < OWL_DATARANGE         : "owl:DataRange" >
  | < OWL_DATATYPEPROPERTY  : "owl:DatatypeProperty" >
  | < OWL_DISJOINTWITH      : "owl:disjointWith" >
76
  | < OWL_DISTINCTMEMBERS      : "owl:distinctMembers" >
77 78
  | < OWL_EQUIVALENTCLASS   : "owl:equivalentClass" >
  | < OWL_FUNCTIONALPROPERTY : "owl:FunctionalProperty" >
79 80
  | < OWL_IMPORTS            : "owl:imports" >
  | < OWL_INTERSECTIONOF     : "owl:intersectionOf" >
81
  | < OWL_INVERSEOF         : "owl:inverseOf" >
82
  | < OWL_MAXCARDINALITY     : "owl:maxCardinality" >
83
  | < OWL_MINCARDINALITY     : "owl:minCardinality" >
84 85 86 87 88 89
  | < OWL_OBJECTPROPERTY    : "owl:ObjectProperty" >
  | < OWL_ONPROPERTY        : "owl:onProperty" >
  | < OWL_ONEOF             : "owl:oneOf" >
  | < OWL_ONTOLOGY          : "owl:Ontology" >
  | < OWL_RESTRICTION       : "owl:Restriction" >
  | < OWL_SOMEVALUESFROM    : "owl:someValuesFrom" >
90
  | < OWL_TRANSITIVEPROPERTY : "owl:TransitiveProperty" >
91
  | < OWL_UNIONOF           : "owl:unionOf" >
92 93 94
  | < RDF_RDF            : "rdf:RDF"      >
  | < RDF_ABOUT          : "rdf:about" >
  | < RDF_DATATYPE          : "rdf:datatype" >
95
  | < RDF_DESCRIPTION        : "rdf:Description" >
96 97
  | < RDF_ID                : "rdf:ID" >
  | < RDF_FIRST             : "rdf:first" >
Anders Nilsson's avatar
Anders Nilsson committed
98
  | < RDF_PROPERTY          : "rdf:Property" >
99 100 101 102
  | < RDF_REST              : "rdf:rest" >
  | < RDF_PARSETYPE         : "rdf:parseType" >
  | < RDF_RESOURCE          : "rdf:resource" >
  | < RDF_TYPE              : "rdf:type" >
103
  | < RDFS_COMMENT          : "rdfs:comment" >
104 105 106 107
  | < RDFS_DOMAIN           : "rdfs:domain" >
  | < RDFS_RANGE            : "rdfs:range" >
  | < RDFS_SUBCLASSOF       : "rdfs:subClassOf" >
  | < RDFS_SUBPROPERTYOF     : "rdfs:subPropertyOf" >
108
  | < VERSION               : "version" >
109 110 111 112 113
  | < XML                   : "xml"          >
  | < XML_BASE              : "xml:base" >
  | < XMLNS                 : "xmlns" >	 
  | < XMLNS_DAML            : "xmlns:daml" >	 
  | < XMLNS_DC              : "xmlns:dc" >	 
114
  | < XMLNS_P1              : "xmlns:p1" >	 
115
  | < XMLNS_OWL             : "xmlns:owl" >	 
116 117 118
  | < XMLNS_PROTEGE         : "xmlns:protege" >	 
  | < XMLNS_RDF             : "xmlns:rdf" >	 
  | < XMLNS_RDFS            : "xmlns:rdfs" >	 
119 120 121 122
  | < XMLNS_SWRL            : "xmlns:swrl" >	 
  | < XMLNS_SWRLB           : "xmlns:swrlb" >	 
  | < XMLNS_XSD             : "xmlns:xsd" >	 
  | < XMLNS_XSP             : "xmlns:xsp" >	 
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140

}// RESERVED WORDS AND LITERALS
<DEFAULT, BOUNDS> TOKEN : /* LITERALS */
{
    < INTEGER_LITERAL:
        <DECIMAL_LITERAL> (["l","L"])?
        |
        <HEX_LITERAL> (["l","L"])?
        |
        <OCTAL_LITERAL> (["l","L"])?
    >
    |
    < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
    |
    < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
    |
    < #OCTAL_LITERAL: "0" (["0"-"7"])* >
    |
141
    < FLOAT_LITERAL:
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
        (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
        |
        "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
        |
        (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
        |
        (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
    >
    |
    < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
    |
    < CHARACTER_LITERAL:
        "'"
        (   (~["'","\\","\n","\r"])
            |
            ("\\"
                (   ["n","t","b","r","f","\\","'","\""]
                    |
                    ["0"-"7"] ( ["0"-"7"] )?
                    |
                    ["0"-"3"] ["0"-"7"] ["0"-"7"]
                )
            )
        )
        "'"
    >
    |
    < STRING_LITERAL:
        "\""
        (   (~["\"","\\","\n","\r"])
            |
            ("\\"
                (    ["n","t","b","r","f","\\","'","\""]
                     |
                     ["0"-"7"] ( ["0"-"7"] )?
                     |
                     ["0"-"3"] ["0"-"7"] ["0"-"7"]
                )
            )
        )*
        "\""
    >
}// LITERALS

<DEFAULT, BOUNDS> TOKEN : /* IDENTIFIERS */
{
188
    < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>|"-")* >
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
    |
    < #LETTER:
        [
        "\u0024",
        "\u0041"-"\u005a",
        "\u005f",
        "\u0061"-"\u007a",
        "\u00c0"-"\u00d6",
        "\u00d8"-"\u00f6",
        "\u00f8"-"\u00ff",
        "\u0100"-"\u1fff",
        "\u3040"-"\u318f",
        "\u3300"-"\u337f",
        "\u3400"-"\u3d2d",
        "\u4e00"-"\u9fff",
204 205 206 207
        "\uf900"-"\ufaff",
		"+",
		"-",
		",",
Anders Nilsson's avatar
Anders Nilsson committed
208 209
		"[",
		"]",
210
		"."
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
        ]
    >
    |
    < #DIGIT:
        [
        "\u0030"-"\u0039",
        "\u0660"-"\u0669",
        "\u06f0"-"\u06f9",
        "\u0966"-"\u096f",
        "\u09e6"-"\u09ef",
        "\u0a66"-"\u0a6f",
        "\u0ae6"-"\u0aef",
        "\u0b66"-"\u0b6f",
        "\u0be7"-"\u0bef",
        "\u0c66"-"\u0c6f",
        "\u0ce6"-"\u0cef",
        "\u0d66"-"\u0d6f",
        "\u0e50"-"\u0e59",
        "\u0ed0"-"\u0ed9",
        "\u1040"-"\u1049"
        ]
    >
}// IDENTIFIERS

<DEFAULT,BOUNDS> TOKEN : /* SEPARATORS */
{
237 238 239
//       < LPAREN               : "("    >
//     | < RPAREN               : ")"    >
     < LBRACE               : "{"    >
240
    | < RBRACE               : "}"    >
Anders Nilsson's avatar
Anders Nilsson committed
241 242
//     | < LBRACKET             : "["    >
//     | < RBRACKET             : "]"    >
243
    | < SEMICOLON            : ";"    >
244 245 246
    | < QUOTE                : "\""    >
//     | < COMMA                : ","    >
//     | < DOT                  : "."    >
247 248 249
}// SEPARATORS


250 251
<DEFAULT,BOUNDS> TOKEN : /* OPERATORS */
{
252 253 254
       < ASSIGN               : "="    >
     | < START_ENDTAG        : "</"    >
     | < START_TAG           : "<"    >
255 256 257 258 259
//     | < GT                   : ">"    >
//     | < LT                   : "<"    >
//     | < BANG                 : "!"    >
//     | < TILDE                : "~"    >
//     | < HOOK                 : "?"    >
260
     | < COLON                : ":"    >
261 262 263 264 265 266 267 268
//     | < EQ                   : "=="   >
//     | < LE                   : "<="   >
//     | < GE                   : ">="   >
//     | < NE                   : "!="   >
//     | < SC_OR                : "||"   >
//     | < SC_AND               : "&&"   >
//     | < INCR                 : "++"   >
//     | < DECR                 : "--"   >
269 270
//      | < PLUS                 : "+"    >
//      | < MINUS                : "-"    >
271
//     | < STAR                 : "*"    >
272
     | < SLASH                : "/"    >
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
//     | < BIT_AND              : "&"    >
//     | < BIT_OR               : "|"    >
//     | < XOR                  : "^"    >
//     | < REM                  : "%"    >
//     | < LSHIFT               : "<<"   >
//     | < RSIGNEDSHIFT         : ">>"   >
//     | < RUNSIGNEDSHIFT       : ">>>"  >
//     | < PLUSASSIGN           : "+="   >
//     | < MINUSASSIGN          : "-="   >
//     | < STARASSIGN           : "*="   >
//     | < SLASHASSIGN          : "/="   >
//     | < ANDASSIGN            : "&="   >
//     | < ORASSIGN             : "|="   >
//     | < XORASSIGN            : "^="   >
//     | < REMASSIGN            : "%="   >
//     | < LSHIFTASSIGN         : "<<="  >
//     | < RSIGNEDSHIFTASSIGN   : ">>="  >
//     | < RUNSIGNEDSHIFTASSIGN : ">>>=" >
291
}// OPERATORS
292 293


294 295 296 297 298 299
// <DEFAULT,BOUNDS> TOKEN : /* TEXT */
// {
//     < TEXT : <LETTER> (~["<",">"])*    >
// }// TEXT


300 301 302 303
//--------------------------------------------------------------------//
//                      THE OWL LANGUAGE GRAMMAR                     //
//--------------------------------------------------------------------//

304
Start Start() #Start : {}
305
{
306
    Specification()
307 308 309
  { return jjtThis; }
}

310 311
void Specification() #Specification : {}
{
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
    XmlHeader()
	RdfDeclaration()
}

void XmlHeader() #XmlHeader : {}
{
    "<?" <XML> AttributeList() "?>"
}

void RdfDeclaration() #RdfDeclaration : {}
{
    "<"  <RDF_RDF> AttributeList() ">"
	ElementList()
    "</" <RDF_RDF> ">"
}

void ElementList() #List : {}
{
    (Element())*    
}

void Element() : {}
{
335 336
    ( "<" ( OwlElement()
	    | RdfElement()
337
		| DiscardedElement()
338 339 340 341
	    ))
	| SimpleElement()
}

342 343 344 345 346 347 348 349 350 351 352 353
void DiscardedElement() #DiscardedElement : {}
{
	Identifier() AttributeList() 
	(">" ElementList() "</" <IDENTIFIER> ">" | ElementList() "/>")
}

void Identifier() #Identifier : {Token t;}
{
	t = <IDENTIFIER>
	{jjtThis.setIDENTIFIER(t.image);}
}

354 355 356
void SimpleElement() : {}
{
    IntElement()
357
	| FloatElement()
358 359 360 361 362 363
	| StringElement()
}

void IntElement() #IntElement : { Token t; }
{
    t = <INTEGER_LITERAL>
364
	{jjtThis.setLITERAL(t.image);}
365 366
}

367 368 369
void FloatElement() #FloatElement : { Token t; }
{
    t = <FLOAT_LITERAL>
370
	{jjtThis.setLITERAL(t.image);}
371 372
}

373
void StringElement() #StringElement : { Token t;String s; }
374
{
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
	t = <IDENTIFIER>
	{
		s = t.image;
		if (getToken(1).kind != START_TAG ) {
		s += getData();
	}
	}
        {jjtThis.setLITERAL(s);}
}

JAVACODE
String getData() {
	StringBuffer s = new StringBuffer();
//     jjtThis.someData = true;
    while ((getToken(1)).kind != START_TAG && (getToken(1)).kind != START_ENDTAG) {
		Token t = getNextToken();
		if (t.specialToken != null) {
			Token tmp_t = t.specialToken;
			while (tmp_t.specialToken != null) {
				tmp_t = tmp_t.specialToken;
			}
			while (tmp_t != null) {
				s.append(tmp_t.image);
				tmp_t = tmp_t.next;
			}
		}
		s.append(t.image);
	}
403
	return s.toString().trim();
404 405
}

406 407 408 409 410 411 412
// void StringElement() #StringElement : { Token t; }
// {
//     t = <IDENTIFIER> | t = <COMMA> | t = <MINUS> | t = <DOT> | t = <PLUS> | t = <SLASH>
// 		| t = <COLON>
// 	{jjtThis.setIDENTIFIER(t.image);}
// }

413 414 415
void OwlElement() : {}
{
    OwlOntology()
416
	| OwlAllDifferent()
417
	| OwlAllValuesFrom()
418
	| OwlCardinality()
419
	| OwlClass()
420 421
	| OwlDataRange()
	| OwlDatatypeProperty()
422
	| OwlDisjointWith()
423
	| OwlDistinctMembers()
424
	| OwlEquivalentClass()
425
	| OwlFunctionalProperty()
426 427
	| OwlImports()
	| OwlIntersectionOf()
428
	| OwlInverseOf()
429
	| OwlMaxCardinality()
430
	| OwlMinCardinality()
431
	| OwlObjectProperty()
432
	| OwlOneOf()
433 434
	| OwlOnProperty()
	| OwlRestriction()
435 436
	| OwlSomeValuesFrom()
	| OwlTransitiveProperty()
437
	| OwlUnionOf()
438 439 440 441
}

void OwlOntology() #OwlOntology : {}
{
442 443
    <OWL_ONTOLOGY> AttributeList() 
	(">" ElementList() "</" <OWL_ONTOLOGY> ">" | ElementList() "/>")
444 445
}

446 447 448 449 450 451
void OwlAllDifferent() #OwlAllDifferent : {}
{
    <OWL_ALLDIFFERENT> AttributeList() 
	(">" ElementList() "</" <OWL_ALLDIFFERENT> ">" | ElementList() "/>")
}

452 453 454 455 456 457
void OwlAllValuesFrom() #OwlAllValuesFrom : {}
{
    <OWL_ALLVALUESFROM> AttributeList() 
	(">" ElementList() "</" <OWL_ALLVALUESFROM> ">" | ElementList() "/>")
}

458 459 460 461 462 463
void OwlCardinality() #OwlCardinality : {}
{
    <OWL_CARDINALITY> AttributeList() 
	(">" ElementList() "</" <OWL_CARDINALITY> ">" | ElementList() "/>")
}

464 465 466 467 468 469
void OwlClass() #OwlClass : {}
{
    <OWL_CLASS> AttributeList() 
	(">" ElementList() "</" <OWL_CLASS> ">" | ElementList() "/>")
}

470 471 472 473 474 475 476 477 478 479 480 481
void OwlDataRange() #OwlDataRange : {}
{
    <OWL_DATARANGE> AttributeList() 
	(">" ElementList() "</" <OWL_DATARANGE> ">" | ElementList() "/>")
}

void OwlDatatypeProperty() #OwlDatatypeProperty : {}
{
    <OWL_DATATYPEPROPERTY> AttributeList() 
	(">" ElementList() "</" <OWL_DATATYPEPROPERTY> ">" | ElementList() "/>")
}

482 483 484 485 486 487
void OwlDisjointWith() #OwlDisjointWith : {}
{
    <OWL_DISJOINTWITH> AttributeList() 
	(">" ElementList() "</" <OWL_DISJOINTWITH> ">" | ElementList() "/>")
}

488 489 490 491 492 493
void OwlDistinctMembers() #OwlDistinctMembers : {}
{
    <OWL_DISTINCTMEMBERS> AttributeList() 
	(">" ElementList() "</" <OWL_DISTINCTMEMBERS> ">" | ElementList() "/>")
}

494 495 496 497 498 499
void OwlEquivalentClass() #OwlEquivalentClass : {}
{
    <OWL_EQUIVALENTCLASS> AttributeList() 
	(">" ElementList() "</" <OWL_EQUIVALENTCLASS> ">" | ElementList() "/>")
}

500 501 502 503 504 505
void OwlFunctionalProperty() #OwlFunctionalProperty : {}
{
    <OWL_FUNCTIONALPROPERTY> AttributeList() 
	(">" ElementList() "</" <OWL_FUNCTIONALPROPERTY> ">" | ElementList() "/>")
}

506 507 508 509 510 511 512 513 514 515 516 517
void OwlImports () #OwlImports  : {}
{
    <OWL_IMPORTS> AttributeList() 
	(">" ElementList() "</" <OWL_IMPORTS> ">" | ElementList() "/>")
}

void OwlIntersectionOf () #OwlIntersectionOf  : {}
{
    <OWL_INTERSECTIONOF> AttributeList() 
	(">" ElementList() "</" <OWL_INTERSECTIONOF> ">" | ElementList() "/>")
}

518 519 520 521 522 523
void OwlInverseOf () #OwlInverseOf  : {}
{
    <OWL_INVERSEOF> AttributeList() 
	(">" ElementList() "</" <OWL_INVERSEOF> ">" | ElementList() "/>")
}

524 525 526 527 528 529
void OwlMaxCardinality () #OwlMaxCardinality  : {}
{
    <OWL_MAXCARDINALITY> AttributeList() 
	(">" ElementList() "</" <OWL_MAXCARDINALITY> ">" | ElementList() "/>")
}

530 531 532 533 534 535
void OwlMinCardinality () #OwlMinCardinality  : {}
{
    <OWL_MINCARDINALITY> AttributeList() 
	(">" ElementList() "</" <OWL_MINCARDINALITY> ">" | ElementList() "/>")
}

536 537 538 539 540 541
void OwlObjectProperty () #OwlObjectProperty  : {}
{
    <OWL_OBJECTPROPERTY> AttributeList() 
	(">" ElementList() "</" <OWL_OBJECTPROPERTY> ">" | ElementList() "/>")
}

542 543 544 545 546 547
void OwlOneOf () #OwlOneOf  : {}
{
    <OWL_ONEOF> AttributeList() 
	(">" ElementList() "</" <OWL_ONEOF> ">" | ElementList() "/>")
}

548 549 550 551 552 553
void OwlOnProperty () #OwlOnProperty  : {}
{
    <OWL_ONPROPERTY> AttributeList() 
	(">" ElementList() "</" <OWL_ONPROPERTY> ">" | ElementList() "/>")
}

554 555 556 557 558 559
void OwlRestriction () #OwlRestriction  : {}
{
    <OWL_RESTRICTION> AttributeList() 
	(">" ElementList() "</" <OWL_RESTRICTION> ">" | ElementList() "/>")
}

560 561 562 563 564 565
void OwlSomeValuesFrom () #OwlSomeValuesFrom  : {}
{
    <OWL_SOMEVALUESFROM> AttributeList() 
	(">" ElementList() "</" <OWL_SOMEVALUESFROM> ">" | ElementList() "/>")
}

566
void OwlTransitiveProperty () #OwlTransitiveProperty  : {}
567
{
568 569
    <OWL_TRANSITIVEPROPERTY> AttributeList() 
	(">" ElementList() "</" <OWL_TRANSITIVEPROPERTY> ">" | ElementList() "/>")
570 571
}

572 573 574 575 576 577
void OwlUnionOf () #OwlUnionOf  : {}
{
    <OWL_UNIONOF> AttributeList() 
	(">" ElementList() "</" <OWL_UNIONOF> ">" | ElementList() "/>")
}

578 579
void RdfElement() : {}
{
580
    RdfType()
581
	| RdfDescription()
582
	| RdfFirst()
Anders Nilsson's avatar
Anders Nilsson committed
583
	| RdfProperty()
584
	| RdfRest()
585
	| RdfsComment()
586
	| RdfsDomain()
587
	| RdfsRange()
588 589
	| RdfsSubClassOf()
	| RdfsSubPropertyOf()
590 591
}

592
void RdfType() #RdfType : {}
593
{
594 595 596 597
    <RDF_TYPE> AttributeList() 
	(">" ElementList() "</" <RDF_TYPE> ">" | ElementList() "/>")
}

598 599 600 601 602 603
void RdfDescription() #RdfDescription : {}
{
    <RDF_DESCRIPTION> AttributeList() 
	(">" ElementList() "</" <RDF_DESCRIPTION> ">" | ElementList() "/>")
}

604 605 606 607 608 609
void RdfFirst() #RdfFirst : {}
{
    <RDF_FIRST> AttributeList() 
	(">" ElementList() "</" <RDF_FIRST> ">" | ElementList() "/>")
}

Anders Nilsson's avatar
Anders Nilsson committed
610 611 612 613 614 615
void RdfProperty() #RdfProperty : {}
{
    <RDF_PROPERTY> AttributeList() 
	(">" ElementList() "</" <RDF_PROPERTY> ">" | ElementList() "/>")
}

616 617 618 619
void RdfRest() #RdfRest : {}
{
    <RDF_REST> AttributeList() 
	(">" ElementList() "</" <RDF_REST> ">" | ElementList() "/>")
620 621
}

622 623 624 625 626 627
void RdfsComment() #RdfsComment : {}
{
    <RDFS_COMMENT> AttributeList() 
	(">" ElementList() "</" <RDFS_COMMENT> ">" | ElementList() "/>")
}

628 629 630 631
void RdfsDomain() #RdfsDomain : {}
{
    <RDFS_DOMAIN> AttributeList() 
	(">" ElementList() "</" <RDFS_DOMAIN> ">" | ElementList() "/>")
632 633
}

634 635 636 637 638 639 640 641 642 643 644 645
void RdfsRange() #RdfsRange : {}
{
    <RDFS_RANGE> AttributeList() 
	(">" ElementList() "</" <RDFS_RANGE> ">" | ElementList() "/>")
}

void RdfsSubClassOf() #RdfsSubClassOf : {}
{
    <RDFS_SUBCLASSOF> AttributeList() 
	(">" ElementList() "</" <RDFS_SUBCLASSOF> ">" | ElementList() "/>")
}

646 647 648 649 650 651
void RdfsSubPropertyOf() #RdfsSubPropertyOf : {}
{
    <RDFS_SUBPROPERTYOF> AttributeList() 
	(">" ElementList() "</" <RDFS_SUBPROPERTYOF> ">" | ElementList() "/>")
}

652 653 654 655 656
void AttributeList() #List : {}
{
    (Attribute())*
}

657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
void Attribute() : {}
{
    Version()
	| RdfAttribute()
	| XmlAttribute()
	| XmlnsAttribute()
}

void Version() #Version : {}
{
    <VERSION> <ASSIGN> Value()
}

void RdfAttribute() : {}
{
    RdfAbout()
673
	| RdfDatatype()
674
	| RdfId()
675
	| RdfParseType()
676 677 678 679 680 681 682 683
	| RdfResource()
}

void RdfAbout() #RdfAbout : {}
{
    <RDF_ABOUT> <ASSIGN> Value()
}

684 685 686 687 688
void RdfDatatype() #RdfDatatype : {}
{
    <RDF_DATATYPE> <ASSIGN> Value()
}

689 690 691 692 693
void RdfId() #RdfId : {}
{
    <RDF_ID> <ASSIGN> Value()
}

694 695 696 697 698 699
void RdfParseType() #RdfParseType : {}
{
    <RDF_PARSETYPE> <ASSIGN> Value()
}

void RdfResource() #RdfResource : {}
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716
{
    <RDF_RESOURCE> <ASSIGN> Value()
}

void XmlAttribute() : {}
{
    XmlBase()
}

void XmlBase() #XmlBase : {}
{
    <XML_BASE> <ASSIGN> Value()
}

void XmlnsAttribute() : {}
{
    Xmlns()
717 718 719
	| XmlnsDaml()
	| XmlnsDc()
	| XmlnsOwl()
720
	| XmlnsP1()
721
	| XmlnsProtege()
722 723
	| XmlnsRdf()
	| XmlnsRdfs()
724 725
	| XmlnsSwrl()
	| XmlnsSwrlb()
726
	| XmlnsXsd()
727
	| XmlnsXsp()
728 729 730 731 732 733 734
}

void Xmlns() #Xmlns : {}
{
    <XMLNS> <ASSIGN> Value()
}

735 736 737 738 739 740 741 742 743 744
void XmlnsDaml() #XmlnsDaml : {}
{
    <XMLNS_DAML> <ASSIGN> Value()
}

void XmlnsDc() #XmlnsDc : {}
{
    <XMLNS_DC> <ASSIGN> Value()
}

745 746 747 748 749
void XmlnsP1() #XmlnsP1 : {}
{
    <XMLNS_P1> <ASSIGN> Value()
}

750 751 752 753 754
void XmlnsProtege() #XmlnsProtege : {}
{
    <XMLNS_PROTEGE> <ASSIGN> Value()
}

755 756 757 758 759
void XmlnsRdf() #XmlnsRdf : {}
{
    <XMLNS_RDF> <ASSIGN> Value()
}

760 761 762 763 764 765 766 767 768 769
void XmlnsSwrl() #XmlnsSwrl : {}
{
    <XMLNS_SWRL> <ASSIGN> Value()
}

void XmlnsSwrlb() #XmlnsSwrlb : {}
{
    <XMLNS_SWRLB> <ASSIGN> Value()
}

770 771 772 773 774
void XmlnsXsd() #XmlnsXsd : {}
{
    <XMLNS_XSD> <ASSIGN> Value()
}

775 776 777 778 779
void XmlnsXsp() #XmlnsXsp : {}
{
    <XMLNS_XSP> <ASSIGN> Value()
}

780
void XmlnsRdfs() #XmlnsRdfs : {}
781
{
782
    <XMLNS_RDFS> <ASSIGN> Value()
783 784
}

785
void XmlnsOwl() #XmlnsOwl : {}
786
{
787
    <XMLNS_OWL> <ASSIGN> Value()
788 789 790 791 792 793
}

void Value() #Value : { Token t; }
{
    t = <STRING_LITERAL>
	{jjtThis.setSTRING_LITERAL(t.image);}
794
}