IT WORKS SUCKERS!!!!!!!!oneeleven
This commit is contained in:
parent
bb4808e520
commit
d53a8d6bb9
5 changed files with 85 additions and 0 deletions
|
@ -5,6 +5,10 @@ public class Actuals extends Spec {
|
|||
super(cont, anno);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return content + "\n";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,27 @@
|
|||
package de.unibremen.informatik.hets.model;
|
||||
|
||||
import de.unibremen.informatik.owl.OWLUtils;
|
||||
|
||||
import org.semanticweb.owlapi.model.OWLOntology;
|
||||
|
||||
import org.protege.editor.owl.model.OWLModelManager;
|
||||
|
||||
public class Basicspec extends Spec {
|
||||
OWLOntology ontology;
|
||||
|
||||
public Basicspec(String cont, String anno) {
|
||||
super(cont, anno);
|
||||
}
|
||||
|
||||
public OWLOntology getOntology() {
|
||||
return ontology;
|
||||
}
|
||||
|
||||
public void displayOntology(OWLModelManager owlmodelmanager, String iri) {
|
||||
ontology = OWLUtils.displayOntology(owlmodelmanager, content, iri);
|
||||
}
|
||||
|
||||
public void displayOntology(OWLModelManager owlmodelmanager, String iri, OWLOntology parent_ont, String parent_iri) {
|
||||
ontology = OWLUtils.displayOntology(owlmodelmanager, content, parent_ont, iri, parent_iri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package de.unibremen.informatik.hets.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.semanticweb.owlapi.model.OWLOntology;
|
||||
|
||||
import org.protege.editor.owl.model.OWLModelManager;
|
||||
|
||||
public class HetFile {
|
||||
private String libname;
|
||||
|
@ -39,4 +44,38 @@ public class HetFile {
|
|||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public OWLOntology getOntologyByName(String name) {
|
||||
for (SpecDefn specdefn : specdefns) {
|
||||
if (specdefn.getLogic().equals("OWL") && specdefn.getName().equals(name)) {
|
||||
return specdefn.getOntology();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void displayOntologies(OWLModelManager manager) {
|
||||
// TODO: this yet only supports basicspec and simple extension blocks
|
||||
|
||||
for (SpecDefn specdefn : specdefns) {
|
||||
if (specdefn.getLogic().equals("OWL")) {
|
||||
Iterator<Spec> it = specdefn.getIterator();
|
||||
|
||||
String parent_iri = "";
|
||||
|
||||
while (it.hasNext()) {
|
||||
Spec spec = it.next();
|
||||
if (spec instanceof Basicspec) {
|
||||
if (parent_iri != "") {
|
||||
((Basicspec)spec).displayOntology(manager, specdefn.getName(), getOntologyByName(parent_iri), parent_iri);
|
||||
} else {
|
||||
((Basicspec)spec).displayOntology(manager, specdefn.getName());
|
||||
}
|
||||
} else if (spec instanceof Actuals) {
|
||||
parent_iri = ((Actuals)spec).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package de.unibremen.informatik.hets.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.semanticweb.owlapi.model.OWLOntology;
|
||||
|
||||
public class SpecDefn {
|
||||
private ArrayList<Spec> specs;
|
||||
private String name;
|
||||
|
@ -24,6 +26,24 @@ public class SpecDefn {
|
|||
return logic;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Iterator<Spec> getIterator() {
|
||||
return specs.iterator();
|
||||
}
|
||||
|
||||
// just return the first Basicspec for now
|
||||
public OWLOntology getOntology() {
|
||||
for (Spec spec : specs) {
|
||||
if (spec instanceof Basicspec) {
|
||||
return ((Basicspec)spec).getOntology();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
|
|
|
@ -84,5 +84,7 @@ public class CGIImportHetsAction extends ProtegeOWLAction {
|
|||
}
|
||||
|
||||
System.out.println(hetfile.toString());
|
||||
|
||||
hetfile.displayOntologies(this.getOWLModelManager());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue