Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit c57982da authored by Anders Nilsson's avatar Anders Nilsson

Moved siaras code to skillserver instead

parent 5ed09735
......@@ -7,12 +7,17 @@
*/
aspect SkillserverInterface {
public Thing Start.getIndividual(String id) {
// System.out.println("getIndividual: "+id);
return super.getIndividual(id);
}
public Thing ASTNode.getIndividual(String id) {
// System.out.println("foo: "+this);
for (int i=0; i<getNumChild(); i++) {
Thing t = getChild(i).getIndividual(id);
if (t!=null) {
System.out.println("Found: "+t);
// System.out.println("Found: "+t);
return t;
}
}
......@@ -20,8 +25,9 @@ aspect SkillserverInterface {
}
public Thing Thing.getIndividual(String id) {
System.out.println("Looking for: "+id+" in: "+id());
if (id.equals(id())) {
// System.out.println("Looking for: "+id+" in: "+id());
// System.out.println("Looking in: "+id());
if (id().contains(id)) {
return this;
} else {
return super.getIndividual(id);
......@@ -31,21 +37,45 @@ aspect SkillserverInterface {
aspect Misc {
public String Thing.id() {
for (int i=0; i<getNumElement(); i++) {
// System.out.println(" Checking "+getElement(i));
if (getElement(i).isIdentifier()) {
System.out.println(" Found identifier");
Identifier ident = (Identifier) ((ClassUse) getElement(i)).decl();
return ((StringElement) ident.getElement(0)).getLITERAL();
}
if (getNumAttribute() > 0) {
return getAttribute(0).name();
} else {
return "unknown_id";
}
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;
eq ComplexElement.isIdentifier() = name().equals("hasIdentifier"); // Ugly hack!
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 {
syn boolean Attribute.isEqualId(String id) = false;
eq RdfId.isEqualId(String id) {
System.out.println(" Checking: "+name());
// System.out.println(" Checking: "+name());
if (name().equals(id)) {
System.out.println(" "+name()+" == "+id);
return true;
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment