Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
c57982da
Commit
c57982da
authored
Apr 17, 2007
by
Anders Nilsson
Browse files
Moved siaras code to skillserver instead
parent
5ed09735
Changes
1
Hide whitespace changes
Inline
Side-by-side
siaras/SkillserverInterface.jrag
View file @
c57982da
...
@@ -7,12 +7,17 @@
...
@@ -7,12 +7,17 @@
*/
*/
aspect SkillserverInterface {
aspect SkillserverInterface {
public Thing Start.getIndividual(String id) {
// System.out.println("getIndividual: "+id);
return super.getIndividual(id);
}
public Thing ASTNode.getIndividual(String id) {
public Thing ASTNode.getIndividual(String id) {
// System.out.println("foo: "+this);
// System.out.println("foo: "+this);
for (int i=0; i<getNumChild(); i++) {
for (int i=0; i<getNumChild(); i++) {
Thing t = getChild(i).getIndividual(id);
Thing t = getChild(i).getIndividual(id);
if (t!=null) {
if (t!=null) {
System.out.println("Found: "+t);
//
System.out.println("Found: "+t);
return t;
return t;
}
}
}
}
...
@@ -20,8 +25,9 @@ aspect SkillserverInterface {
...
@@ -20,8 +25,9 @@ aspect SkillserverInterface {
}
}
public Thing Thing.getIndividual(String id) {
public Thing Thing.getIndividual(String id) {
System.out.println("Looking for: "+id+" in: "+id());
// System.out.println("Looking for: "+id+" in: "+id());
if (id.equals(id())) {
// System.out.println("Looking in: "+id());
if (id().contains(id)) {
return this;
return this;
} else {
} else {
return super.getIndividual(id);
return super.getIndividual(id);
...
@@ -31,21 +37,45 @@ aspect SkillserverInterface {
...
@@ -31,21 +37,45 @@ aspect SkillserverInterface {
aspect Misc {
aspect Misc {
public String Thing.id() {
public String Thing.id() {
for (int i=0; i<getNumElement(); i++) {
if (getNumAttribute() > 0) {
// System.out.println(" Checking "+getElement(i));
return getAttribute(0).name();
if (getElement(i).isIdentifier()) {
} else {
System.out.println(" Found identifier");
return "unknown_id";
Identifier ident = (Identifier) ((ClassUse) getElement(i)).decl();
return ((StringElement) ident.getElement(0)).getLITERAL();
}
}
}
return null;
// for (int i=0; i<getNumElement(); i++) {
// // System.out.println(" Checking "+getElement(i));
// if (getElement(i).isIdentifier()) {
// // System.out.println(" Found identifier: "+((ComplexElement) getElement(i)).name());
// Identifier ident = (Identifier) ((ClassUse) getElement(i)).decl();
// System.out.println(" "+((ComplexElement) ident.getElement(0)).name());
// return ident.value();
// }
// }
// return "unknown_id";
}
}
syn boolean Element.isIdentifier() = false;
syn boolean Element.isIdentifier() = false;
eq ComplexElement.isIdentifier() = name().equals("hasIdentifier"); // Ugly hack!
eq ComplexElement.isIdentifier() = name().equals("hasIdentifier"); // Ugly hack!
eq Identifier.isIdentifier() = true;
eq Identifier.isIdentifier() = true;
eq ClassUse.isIdentifier() = decl().isIdentifier();
// eq ClassUse.isIdentifier() {
// Thing decl = decl();
// if (decl != null) {
// return decl.isIdentifier();
// } else {
// System.out.println("Couldn't find decl for: "+name());
// }
// return false;
// }
syn lazy String Identifier.value() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof StringElement) {
return ((StringElement) getElement(i)).getLITERAL();
}
}
return "#valueNotFound";
}
}
}
...
@@ -96,8 +126,9 @@ aspect Decl {
...
@@ -96,8 +126,9 @@ aspect Decl {
syn boolean Attribute.isEqualId(String id) = false;
syn boolean Attribute.isEqualId(String id) = false;
eq RdfId.isEqualId(String id) {
eq RdfId.isEqualId(String id) {
System.out.println(" Checking: "+name());
//
System.out.println(" Checking: "+name());
if (name().equals(id)) {
if (name().equals(id)) {
System.out.println(" "+name()+" == "+id);
return true;
return true;
}
}
return false;
return false;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment