objectstring.java
来自「Semantic Web Ontology Editor」· Java 代码 · 共 587 行 · 第 1/2 页
JAVA
587 行
package org.mindswap.swoop.utils.owlapi.diff;import java.io.PrintStream;import java.util.Iterator;import org.semanticweb.owl.model.OWLAnd;import org.semanticweb.owl.model.OWLAnnotationInstance;import org.semanticweb.owl.model.OWLAnnotationProperty;import org.semanticweb.owl.model.OWLClass;import org.semanticweb.owl.model.OWLDataAllRestriction;import org.semanticweb.owl.model.OWLDataCardinalityRestriction;import org.semanticweb.owl.model.OWLDataEnumeration;import org.semanticweb.owl.model.OWLDataProperty;import org.semanticweb.owl.model.OWLDataPropertyInstance;import org.semanticweb.owl.model.OWLDataPropertyRangeAxiom;import org.semanticweb.owl.model.OWLDataSomeRestriction;import org.semanticweb.owl.model.OWLDataType;import org.semanticweb.owl.model.OWLDataValue;import org.semanticweb.owl.model.OWLDataValueRestriction;import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;import org.semanticweb.owl.model.OWLDisjointClassesAxiom;import org.semanticweb.owl.model.OWLEntity;import org.semanticweb.owl.model.OWLEnumeration;import org.semanticweb.owl.model.OWLEquivalentClassesAxiom;import org.semanticweb.owl.model.OWLEquivalentPropertiesAxiom;import org.semanticweb.owl.model.OWLException;import org.semanticweb.owl.model.OWLFrame;import org.semanticweb.owl.model.OWLFunctionalPropertyAxiom;import org.semanticweb.owl.model.OWLIndividual;import org.semanticweb.owl.model.OWLIndividualTypeAssertion;import org.semanticweb.owl.model.OWLInverseFunctionalPropertyAxiom;import org.semanticweb.owl.model.OWLInversePropertyAxiom;import org.semanticweb.owl.model.OWLNamedObject;import org.semanticweb.owl.model.OWLNot;import org.semanticweb.owl.model.OWLObject;import org.semanticweb.owl.model.OWLObjectAllRestriction;import org.semanticweb.owl.model.OWLObjectCardinalityRestriction;import org.semanticweb.owl.model.OWLObjectProperty;import org.semanticweb.owl.model.OWLObjectPropertyInstance;import org.semanticweb.owl.model.OWLObjectPropertyRangeAxiom;import org.semanticweb.owl.model.OWLObjectSomeRestriction;import org.semanticweb.owl.model.OWLObjectValueRestriction;import org.semanticweb.owl.model.OWLObjectVisitor;import org.semanticweb.owl.model.OWLOntology;import org.semanticweb.owl.model.OWLOr;import org.semanticweb.owl.model.OWLPropertyDomainAxiom;import org.semanticweb.owl.model.OWLSameIndividualsAxiom;import org.semanticweb.owl.model.OWLSubClassAxiom;import org.semanticweb.owl.model.OWLSubPropertyAxiom;import org.semanticweb.owl.model.OWLSymmetricPropertyAxiom;import org.semanticweb.owl.model.OWLTransitivePropertyAxiom;import org.semanticweb.owl.model.change.AddAnnotationInstance;import org.semanticweb.owl.model.change.AddClassAxiom;import org.semanticweb.owl.model.change.AddDataPropertyInstance;import org.semanticweb.owl.model.change.AddDataPropertyRange;import org.semanticweb.owl.model.change.AddDataType;import org.semanticweb.owl.model.change.AddDomain;import org.semanticweb.owl.model.change.AddEntity;import org.semanticweb.owl.model.change.AddEnumeration;import org.semanticweb.owl.model.change.AddEquivalentClass;import org.semanticweb.owl.model.change.AddForeignEntity;import org.semanticweb.owl.model.change.AddImport;import org.semanticweb.owl.model.change.AddIndividualAxiom;import org.semanticweb.owl.model.change.AddIndividualClass;import org.semanticweb.owl.model.change.AddInverse;import org.semanticweb.owl.model.change.AddObjectPropertyInstance;import org.semanticweb.owl.model.change.AddObjectPropertyRange;import org.semanticweb.owl.model.change.AddPropertyAxiom;import org.semanticweb.owl.model.change.AddSuperClass;import org.semanticweb.owl.model.change.AddSuperProperty;import org.semanticweb.owl.model.change.ChangeVisitor;import org.semanticweb.owl.model.change.OntologyChange;import org.semanticweb.owl.model.change.RemoveAnnotationInstance;import org.semanticweb.owl.model.change.RemoveClassAxiom;import org.semanticweb.owl.model.change.RemoveDataPropertyInstance;import org.semanticweb.owl.model.change.RemoveDataPropertyRange;import org.semanticweb.owl.model.change.RemoveDataType;import org.semanticweb.owl.model.change.RemoveDomain;import org.semanticweb.owl.model.change.RemoveEntity;import org.semanticweb.owl.model.change.RemoveEnumeration;import org.semanticweb.owl.model.change.RemoveEquivalentClass;import org.semanticweb.owl.model.change.RemoveForeignEntity;import org.semanticweb.owl.model.change.RemoveImport;import org.semanticweb.owl.model.change.RemoveIndividualAxiom;import org.semanticweb.owl.model.change.RemoveIndividualClass;import org.semanticweb.owl.model.change.RemoveInverse;import org.semanticweb.owl.model.change.RemoveObjectPropertyInstance;import org.semanticweb.owl.model.change.RemoveObjectPropertyRange;import org.semanticweb.owl.model.change.RemovePropertyAxiom;import org.semanticweb.owl.model.change.RemoveSuperClass;import org.semanticweb.owl.model.change.RemoveSuperProperty;import org.semanticweb.owl.model.change.SetDeprecated;import org.semanticweb.owl.model.change.SetFunctional;import org.semanticweb.owl.model.change.SetInverseFunctional;import org.semanticweb.owl.model.change.SetLinkTarget;import org.semanticweb.owl.model.change.SetLogicalURI;import org.semanticweb.owl.model.change.SetOneToOne;import org.semanticweb.owl.model.change.SetSymmetric;import org.semanticweb.owl.model.change.SetTransitive;/** * This is a simple test class to return a pretty string representing the object * @author ronwalf * */public class ObjectString implements ChangeVisitor, OWLObjectVisitor { private String value; private ObjectString() { } public static String getString(OWLObject obj) throws OWLException { ObjectString objString = new ObjectString(); obj.accept(objString); if (objString.value == null) { objString.value = obj.toString(); } return objString.value; } public static String getString(OntologyChange obj) throws OWLException { ObjectString objString = new ObjectString(); obj.accept(objString); if (objString.value == null) { objString.value = obj.toString(); } return objString.value; } private String namedString(OWLNamedObject entity) throws OWLException { if (entity.getURI() != null) { return "<"+entity.getURI()+">"; } else { return "(Anonymous "+entity.getClass()+")"; } } public void visit(AddAnnotationInstance event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddEntity event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddDataType event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveEntity event) throws OWLException { value = "RemoveEntity "+namedString(event.getEntity()); } public void visit(AddImport event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddIndividualAxiom event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddClassAxiom event) throws OWLException { value = "AddClassAxiom("+getString(event.getAxiom())+")"; } public void visit(AddPropertyAxiom event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddSuperClass event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddSuperProperty event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddIndividualClass event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddEquivalentClass event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddEnumeration event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddDomain event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddDataPropertyRange event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddObjectPropertyRange event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddInverse event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetFunctional event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetTransitive event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetSymmetric event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetInverseFunctional event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetOneToOne event) throws OWLException { // TODO Auto-generated method stub } public void visit(SetDeprecated event) throws OWLException { // TODO Auto-generated method stub } public void visit(AddObjectPropertyInstance event) throws OWLException { value = ("AddObjectPropertyInstance(" +getString(event.getSubject())+", " +getString(event.getProperty())+", " +getString(event.getObject())+")"); } public void visit(AddDataPropertyInstance event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveClassAxiom event) throws OWLException { value = "RemoveClassAxiom("+getString(event.getAxiom())+")"; } public void visit(RemoveSuperClass event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveEquivalentClass event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveEnumeration event) throws OWLException { value = "RemoveEnumeration("+getString(event.getOWLClass())+", "+getString(event.getEnumeration())+")"; } public void visit(SetLogicalURI event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveDomain event) throws OWLException { // TODO Auto-generated method stub } public void visit(RemoveDataPropertyRange event) throws OWLException {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?