From d1ac614c495bc96fb7f0d6607ecd407316c11c70 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <anders.nilsson@cs.lth.se> Date: Fri, 26 Jan 2007 16:29:04 +0100 Subject: [PATCH] Synching --- CompilerGeneration.jrag | 22 +++++++++++----------- siaras/OntologyGeneration.jrag | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index d728edc..cc11611 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -315,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)+"}"); } } diff --git a/siaras/OntologyGeneration.jrag b/siaras/OntologyGeneration.jrag index c5a7c8a..9d27c04 100644 --- a/siaras/OntologyGeneration.jrag +++ b/siaras/OntologyGeneration.jrag @@ -48,6 +48,23 @@ aspect OntologyGeneration { // } + public void ClassUse.genOntology(String ind, PrintStream pStream) { + pStream.print(ind+"< (CU) "+name()); + for (int i=0; i<getNumAttribute(); i++) { + pStream.print(" "); + getAttribute(i).genOntology(pStream); + } + if (getNumElement() > 0) { + pStream.println(">"); + for (int i=0; i<getNumElement(); i++) { + getElement(i).genOntology(ind+" ", pStream); + } + pStream.println(ind+"</"+name()+">"); + } else { + pStream.println("/>"); + } + } + public void Start.genOntology(String ind, PrintStream pStream) { pStream.println("<?xml version=\"1.0\"?>"); for (int i=0; i<getNumElement(); i++) { -- GitLab