org.coode.parsers.oppl.VariableIRI Maven / Gradle / Ivy
package org.coode.parsers.oppl;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import org.coode.oppl.Variable;
import org.coode.oppl.function.AttributeName;
import org.coode.oppl.function.IRIVariableAttribute;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotationSubjectVisitor;
import org.semanticweb.owlapi.model.OWLAnnotationSubjectVisitorEx;
import org.semanticweb.owlapi.model.OWLAnnotationValueVisitor;
import org.semanticweb.owlapi.model.OWLAnnotationValueVisitorEx;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataProperty;
import org.semanticweb.owlapi.model.OWLDatatype;
import org.semanticweb.owlapi.model.OWLEntity;
import org.semanticweb.owlapi.model.OWLNamedIndividual;
import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLObjectVisitor;
import org.semanticweb.owlapi.model.OWLObjectVisitorEx;
/** @author Luigi Iannone */
public class VariableIRI extends IRI {
private static final long serialVersionUID = 20100L;
private final IRIVariableAttribute attribute;
/** @return the attribute */
public IRIVariableAttribute getAttribute() {
return attribute;
}
/** @param variable
* variable */
public VariableIRI(Variable> variable) {
super(String.format("%s.%s", variable.getName(), AttributeName.IRI));
attribute = new IRIVariableAttribute(variable);
}
@Override
public void accept(OWLAnnotationSubjectVisitor visitor) {
visitor.visit(this);
}
@Override
public E accept(OWLAnnotationSubjectVisitorEx visitor) {
return visitor.visit(this);
}
@Override
public Set getSignature() {
return Collections. emptySet();
}
@Override
public Set getClassesInSignature() {
return Collections. emptySet();
}
@Override
public Set getDataPropertiesInSignature() {
return Collections. emptySet();
}
@Override
public Set getObjectPropertiesInSignature() {
return Collections. emptySet();
}
@Override
public Set getIndividualsInSignature() {
return Collections. emptySet();
}
@Override
public Set getDatatypesInSignature() {
return Collections. emptySet();
}
@Override
public Set getNestedClassExpressions() {
return Collections. emptySet();
}
@Override
public void accept(OWLObjectVisitor visitor) {
if (visitor instanceof IRIVisitor) {
((IRIVisitor) visitor).visitVariableIRI(this);
} else {
visitor.visit(this);
}
}
/** @param visitor
* visitor */
public void accept(IRIVisitor visitor) {
visitor.visitVariableIRI(this);
}
@Override
public O accept(OWLObjectVisitorEx visitor) {
return visitor instanceof IRIVisitorEx> ? ((IRIVisitorEx) visitor)
.visitVariableIRI(this) : visitor.visit(this);
}
/** @param visitor
* visitor
* @param
* visitor return type
* @return visitor value */
public O accept(IRIVisitorEx visitor) {
return visitor.visitVariableIRI(this);
}
@Override
public boolean isTopEntity() {
return false;
}
@Override
public boolean isBottomEntity() {
return false;
}
@Override
public int compareTo(OWLObject object) {
if (object == this) {
return 0;
} else if (!(object instanceof IRI)) {
return -1;
} else {
return toString().compareTo(object.toString());
}
}
@Override
public void accept(OWLAnnotationValueVisitor visitor) {
visitor.visit(this);
}
@Override
public O accept(OWLAnnotationValueVisitorEx visitor) {
return visitor.visit(this);
}
@Override
public URI toURI() {
return URI.create(toString());
}
@Override
public boolean isAbsolute() {
return false;
}
@Override
public String getScheme() {
return null;
}
@Override
public String getStart() {
return getScheme();
}
@Override
public IRI resolve(String s) {
return this;
}
@Override
public boolean isReservedVocabulary() {
return false;
}
@Override
public boolean isThing() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isNothing() {
return false;
}
@Override
public boolean isPlainLiteral() {
return false;
}
@Override
public String getFragment() {
return toString();
}
@Override
public String toQuotedString() {
return toString();
}
@Override
public String toString() {
return String.format("%s.%s", getAttribute().getVariable().getName(),
getAttribute().getAttribute());
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (attribute == null ? 0 : attribute.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
VariableIRI other = (VariableIRI) obj;
if (attribute == null) {
if (other.attribute != null) {
return false;
}
} else if (!attribute.equals(other.attribute)) {
return false;
}
return true;
}
}