From dce01c7f8dbdf7587e76d1cab99372d0dee1d1f4 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <anders.nilsson@cs.lth.se> Date: Thu, 25 Jan 2007 16:27:05 +0100 Subject: [PATCH] Synching --- CompilerGeneration.jrag | 31 +++++++++++++++++++------------ siaras/owl.ast | 2 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index b6f61ec..d728edc 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -23,6 +23,7 @@ aspect AbsGrammarGeneration { pStream.println("abstract Element;"); pStream.println("ComplexElement : Element ::= OwlIdentifier Attribute* Element*;"); pStream.println("ValueElement : ComplexElement;"); + pStream.println("RdfDeclaration : ComplexElement;"); pStream.println("abstract SimpleElement : Element;"); pStream.println("StringElement : SimpleElement ::= <LITERAL>;"); pStream.println("IntElement : SimpleElement ::= <LITERAL>;"); @@ -246,6 +247,12 @@ aspect GenRewrites { pStream.println(ind(3)+"use.setElementList(new List());"); pStream.println(ind(3)+"return use;"); pStream.println(ind(2)+"}"); + pStream.println(ind(2)+"when (name().equals(\"rdf:RDF\") && !(this instanceof RdfDeclaration))"); + pStream.println(ind(2)+"to RdfDeclaration {"); + pStream.println(ind(3)+"return new RdfDeclaration(getOwlIdentifier(),getAttributeList(),getElementList());"); + pStream.println(ind(2)+"}"); + + // pStream.println(ind(2)+"when ((name().equals(\"isSkillOf\")"); // pStream.println(ind(2)+"|| name().equals(\"isPropertyOf\"))"); // pStream.println("&& getNumAttribute() > 0 && getAttribute(0) instanceof RdfResource)"); @@ -308,17 +315,17 @@ aspect GenRewrites { pStream.println(); // Rearrange device nodes on the AST to get away from the // current diagonal style from Protege - pStream.println(ind(1)+"rewrite "+name()+" {"); - pStream.println(ind(2)+"when (!isTopElement())"); - pStream.println(ind(2)+"to ClassUse {"); - pStream.println(ind(3)+"ClassUse use = new ClassUse();"); - pStream.println(ind(3)+"use.setOwlIdentifier(new OwlIdentifier(\""+name()+"\"));"); - pStream.println(ind(3)+"use.setAttributeList(new List().add(new RdfResource(getAttribute(0).getValue())));"); - pStream.println(ind(3)+"use.setElementList(new List());"); - pStream.println(ind(3)+"getRdfDecl().addElement(this);"); - pStream.println(ind(3)+"return use;"); - pStream.println(ind(2)+"}"); - pStream.println(ind(1)+"}"); +// pStream.println(ind(1)+"rewrite "+name()+" {"); +// pStream.println(ind(2)+"when (!isTopElement())"); +// pStream.println(ind(2)+"to ClassUse {"); +// pStream.println(ind(3)+"ClassUse use = new ClassUse();"); +// pStream.println(ind(3)+"use.setOwlIdentifier(new OwlIdentifier(\""+name()+"\"));"); +// pStream.println(ind(3)+"use.setAttributeList(new List().add(new RdfResource(getAttribute(0).getValue())));"); +// pStream.println(ind(3)+"use.setElementList(new List());"); +// pStream.println(ind(3)+"getRdfDecl().addElement(this);"); +// pStream.println(ind(3)+"return use;"); +// pStream.println(ind(2)+"}"); +// pStream.println(ind(1)+"}"); } } @@ -365,7 +372,7 @@ aspect GenMisc { pStream.println(ind(1)+"}"); // ASTNode.getRdfDecl() - pStream.println(ind(1)+"Start ASTNode.getRdfDecl() {"); + pStream.println(ind(1)+"RdfDeclaration ASTNode.getRdfDecl() {"); pStream.println(ind(2)+"return getParent().getRdfDecl();"); pStream.println(ind(1)+"}"); pStream.println(ind(1)+"RdfDeclaration RdfDeclaration.getRdfDecl() {"); diff --git a/siaras/owl.ast b/siaras/owl.ast index 04be99b..0cc30a1 100644 --- a/siaras/owl.ast +++ b/siaras/owl.ast @@ -6,7 +6,7 @@ // This file is part of OntologyCompiler. -RdfDeclaration : ComplexElement; + RdfDescription : ComplexElement; RdfFirst : ComplexElement; RdfRest : ComplexElement; -- GitLab