001 /*
002 * The contents of this file are subject to the Mozilla Public License
003 * Version 1.1 (the "License"); you may not use this file except in
004 * compliance with the License. You may obtain a copy of the License at
005 * http://www.mozilla.org/MPL/
006 *
007 * Software distributed under the License is distributed on an "AS IS" basis,
008 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009 * the specific language governing rights and limitations under the License.
010 *
011 * The Original Code is Protege-2000.
012 *
013 * The Initial Developer of the Original Code is Stanford University. Portions
014 * created by Stanford University are Copyright (C) 2007. All Rights Reserved.
015 *
016 * Protege was developed by Stanford Medical Informatics
017 * (http://www.smi.stanford.edu) at the Stanford University School of Medicine
018 * with support from the National Library of Medicine, the National Science
019 * Foundation, and the Defense Advanced Research Projects Agency. Current
020 * information about Protege can be obtained at http://protege.stanford.edu.
021 *
022 */
023
024 package edu.stanford.smi.protegex.owl.swrl.model.impl;
025
026 import edu.stanford.smi.protege.model.FrameID;
027 import edu.stanford.smi.protege.model.KnowledgeBase;
028 import edu.stanford.smi.protegex.owl.model.RDFResource;
029 import edu.stanford.smi.protegex.owl.swrl.model.SWRLDifferentIndividualsAtom;
030 import edu.stanford.smi.protegex.owl.swrl.model.SWRLNames;
031 import edu.stanford.smi.protegex.owl.swrl.model.SWRLIndividualsAtom;
032
033 import java.util.Set;
034
035 public abstract class AbstractSWRLIndividualsAtom extends DefaultSWRLAtom implements SWRLIndividualsAtom {
036
037 public AbstractSWRLIndividualsAtom(KnowledgeBase kb, FrameID id) {
038 super(kb, id);
039 }
040
041
042 public AbstractSWRLIndividualsAtom() {
043 }
044
045
046 protected abstract String getOperatorName();
047
048
049 public void getReferencedInstances(Set set) {
050
051 }
052
053
054 public RDFResource getArgument1() {
055 return (RDFResource) getPropertyValue(getOWLModel().getRDFProperty(SWRLNames.Slot.ARGUMENT1));
056 } // getArgument1
057
058
059 public void setArgument1(RDFResource instance) {
060 setPropertyValue(getOWLModel().getRDFProperty(SWRLNames.Slot.ARGUMENT1), instance);
061 } // setArgument1
062
063
064 public RDFResource getArgument2() {
065 return (RDFResource) getPropertyValue(getOWLModel().getRDFProperty(SWRLNames.Slot.ARGUMENT2));
066 } // getArgument2
067
068
069 public void setArgument2(RDFResource instance) {
070 setPropertyValue(getOWLModel().getRDFProperty(SWRLNames.Slot.ARGUMENT2), instance);
071 } // setArgument2
072
073
074 public String getBrowserText() {
075
076 String s = getOperatorName() + "(";
077
078 RDFResource argument1 = getArgument1();
079 if (argument1 == null) {
080 s += "<null>";
081 }
082 else {
083 s += argument1.getBrowserText();
084 }
085 s += ", ";
086 RDFResource argument2 = getArgument2();
087 if (argument2 == null) {
088 s += "<null>";
089 }
090 else {
091 s += argument2.getBrowserText();
092 }
093 s += ")";
094
095 return s;
096
097 } // getBrowserText
098
099 } // AbstractSWRLIndividualsAtom
100
101
102