2ronwalf/*
2ronwalf * Created on Dec 10, 2004
2ronwalf */
2ronwalfpackage impl.owls;
2ronwalf
2ronwalfimport impl.owl.list.RDFListImpl;
2ronwalfimport impl.owls.generic.expression.SWRLExpressionImpl;
2ronwalfimport impl.owls.generic.list.OWLSObjListImpl;
2ronwalfimport impl.owls.grounding.GroundingImpl;
2ronwalfimport impl.owls.grounding.JavaAtomicGroundingImpl;
24daenzeroramaimport impl.owls.grounding.JavaParameterImpl;
24daenzeroramaimport impl.owls.grounding.JavaVariableImpl;
2ronwalfimport impl.owls.grounding.UPnPAtomicGroundingImpl;
2ronwalfimport impl.owls.grounding.UPnPMessageMapImpl;
2ronwalfimport impl.owls.grounding.WSDLAtomicGroundingImpl;
2ronwalfimport impl.owls.grounding.WSDLMessageMapImpl;
2ronwalfimport impl.owls.grounding.WSDLOperationRefImpl;
2ronwalfimport impl.owls.process.AtomicProcessImpl;
2ronwalfimport impl.owls.process.CompositeProcessImpl;
2ronwalfimport impl.owls.process.ResultImpl;
2ronwalfimport impl.owls.process.ResultVarImpl;
2ronwalfimport impl.owls.process.SimpleProcessImpl;
2ronwalfimport impl.owls.process.ValueOfImpl;
22daenzeroramaimport impl.owls.process.binding.BindingImpl;
22daenzeroramaimport impl.owls.process.binding.InputBindingImpl;
22daenzeroramaimport impl.owls.process.binding.OutputBindingImpl;
22daenzeroramaimport impl.owls.process.constructs.AnyOrderImpl;
22daenzeroramaimport impl.owls.process.constructs.ChoiceImpl;
22daenzeroramaimport impl.owls.process.constructs.ControlConstructBagImpl;
22daenzeroramaimport impl.owls.process.constructs.ControlConstructListImpl;
22daenzeroramaimport impl.owls.process.constructs.ForEachImpl;
22daenzeroramaimport impl.owls.process.constructs.IfThenElseImpl;
22daenzeroramaimport impl.owls.process.constructs.PerformImpl;
22daenzeroramaimport impl.owls.process.constructs.ProduceImpl;
22daenzeroramaimport impl.owls.process.constructs.RepeatUntilImpl;
22daenzeroramaimport impl.owls.process.constructs.RepeatWhileImpl;
22daenzeroramaimport impl.owls.process.constructs.SequenceImpl;
22daenzeroramaimport impl.owls.process.constructs.SplitImpl;
22daenzeroramaimport impl.owls.process.constructs.SplitJoinImpl;
22daenzeroramaimport impl.owls.process.parameter.InputImpl;
22daenzeroramaimport impl.owls.process.parameter.LocalImpl;
22daenzeroramaimport impl.owls.process.parameter.OutputImpl;
2ronwalfimport impl.owls.profile.ActorImpl;
2ronwalfimport impl.owls.profile.ProfileImpl;
2ronwalfimport impl.owls.profile.ServiceCategoryImpl;
2ronwalfimport impl.owls.profile.ServiceParameterImpl;
2ronwalfimport impl.owls.service.ServiceImpl;
2ronwalfimport impl.swrl.AtomImpl;
2ronwalfimport impl.swrl.AtomListImpl;
2ronwalfimport impl.swrl.BuiltinAtomImpl;
2ronwalfimport impl.swrl.ClassAtomImpl;
2ronwalfimport impl.swrl.DataPropertyAtomImpl;
2ronwalfimport impl.swrl.DifferentIndividualsAtomImpl;
2ronwalfimport impl.swrl.IndividualPropertyAtomImpl;
2ronwalfimport impl.swrl.SWRLDataValueImpl;
2ronwalfimport impl.swrl.SWRLDataVariableImpl;
2ronwalfimport impl.swrl.SWRLIndividualImpl;
2ronwalfimport impl.swrl.SWRLIndividualVariableImpl;
2ronwalfimport impl.swrl.SameIndividualAtomImpl;
2ronwalf
2ronwalfimport java.lang.reflect.Constructor;
2ronwalfimport java.util.Collections;
2ronwalfimport java.util.HashMap;
2ronwalfimport java.util.HashSet;
2ronwalfimport java.util.Map;
2ronwalfimport java.util.Set;
2ronwalf
2ronwalfimport org.mindswap.exceptions.CastingException;
2ronwalfimport org.mindswap.exceptions.ConversionException;
2ronwalfimport org.mindswap.exceptions.NotImplementedException;
2ronwalfimport org.mindswap.owl.OWLClass;
2ronwalfimport org.mindswap.owl.OWLConfig;
2ronwalfimport org.mindswap.owl.OWLDataValue;
2ronwalfimport org.mindswap.owl.OWLIndividual;
2ronwalfimport org.mindswap.owl.OWLObject;
2ronwalfimport org.mindswap.owl.OWLObjectConverter;
2ronwalfimport org.mindswap.owl.list.ListVocabulary;
2ronwalfimport org.mindswap.owl.list.RDFList;
2ronwalfimport org.mindswap.owl.vocabulary.RDF;
2ronwalfimport org.mindswap.owl.vocabulary.SWRL;
2ronwalfimport org.mindswap.owls.generic.expression.Expression;
2ronwalfimport org.mindswap.owls.generic.list.OWLSObjList;
2ronwalfimport org.mindswap.owls.grounding.AtomicGrounding;
2ronwalfimport org.mindswap.owls.grounding.Grounding;
2ronwalfimport org.mindswap.owls.grounding.JavaAtomicGrounding;
24daenzeroramaimport org.mindswap.owls.grounding.JavaParameter;
24daenzeroramaimport org.mindswap.owls.grounding.JavaVariable;
2ronwalfimport org.mindswap.owls.grounding.MessageMap;
2ronwalfimport org.mindswap.owls.grounding.UPnPAtomicGrounding;
2ronwalfimport org.mindswap.owls.grounding.WSDLAtomicGrounding;
2ronwalfimport org.mindswap.owls.grounding.WSDLOperationRef;
2ronwalfimport org.mindswap.owls.process.AnyOrder;
2ronwalfimport org.mindswap.owls.process.AtomicProcess;
2ronwalfimport org.mindswap.owls.process.Binding;
2ronwalfimport org.mindswap.owls.process.Choice;
2ronwalfimport org.mindswap.owls.process.CompositeProcess;
2ronwalfimport org.mindswap.owls.process.Condition;
2ronwalfimport org.mindswap.owls.process.ControlConstruct;
2ronwalfimport org.mindswap.owls.process.ControlConstructBag;
2ronwalfimport org.mindswap.owls.process.ControlConstructList;
2ronwalfimport org.mindswap.owls.process.ForEach;
2ronwalfimport org.mindswap.owls.process.IfThenElse;
2ronwalfimport org.mindswap.owls.process.Input;
2ronwalfimport org.mindswap.owls.process.InputBinding;
2ronwalfimport org.mindswap.owls.process.Iterate;
2ronwalfimport org.mindswap.owls.process.Local;
2ronwalfimport org.mindswap.owls.process.Output;
2ronwalfimport org.mindswap.owls.process.OutputBinding;
2ronwalfimport org.mindswap.owls.process.Parameter;
2ronwalfimport org.mindswap.owls.process.Perform;
2ronwalfimport org.mindswap.owls.process.Process;
2ronwalfimport org.mindswap.owls.process.Produce;
2ronwalfimport org.mindswap.owls.process.RepeatUntil;
2ronwalfimport org.mindswap.owls.process.RepeatWhile;
2ronwalfimport org.mindswap.owls.process.Result;
2ronwalfimport org.mindswap.owls.process.ResultVar;
2ronwalfimport org.mindswap.owls.process.Sequence;
2ronwalfimport org.mindswap.owls.process.SimpleProcess;
2ronwalfimport org.mindswap.owls.process.Split;
2ronwalfimport org.mindswap.owls.process.SplitJoin;
2ronwalfimport org.mindswap.owls.process.ValueOf;
2ronwalfimport org.mindswap.owls.profile.Actor;
2ronwalfimport org.mindswap.owls.profile.Profile;
2ronwalfimport org.mindswap.owls.profile.ServiceCategory;
2ronwalfimport org.mindswap.owls.profile.ServiceParameter;
2ronwalfimport org.mindswap.owls.service.Service;
2ronwalfimport org.mindswap.owls.vocabulary.FLAServiceOnt;
2ronwalfimport org.mindswap.owls.vocabulary.OWLS;
2ronwalfimport org.mindswap.owls.vocabulary.MoreGroundings;
2ronwalfimport org.mindswap.swrl.Atom;
2ronwalfimport org.mindswap.swrl.AtomList;
2ronwalfimport org.mindswap.swrl.BuiltinAtom;
2ronwalfimport org.mindswap.swrl.ClassAtom;
2ronwalfimport org.mindswap.swrl.DataPropertyAtom;
2ronwalfimport org.mindswap.swrl.DifferentIndividualsAtom;
2ronwalfimport org.mindswap.swrl.IndividualPropertyAtom;
2ronwalfimport org.mindswap.swrl.SWRLDataObject;
2ronwalfimport org.mindswap.swrl.SWRLDataValue;
2ronwalfimport org.mindswap.swrl.SWRLDataVariable;
2ronwalfimport org.mindswap.swrl.SWRLIndividual;
2ronwalfimport org.mindswap.swrl.SWRLIndividualObject;
2ronwalfimport org.mindswap.swrl.SWRLIndividualVariable;
2ronwalfimport org.mindswap.swrl.SameIndividualAtom;
2ronwalf
2ronwalf/**
2ronwalf * @author Evren Sirin
2ronwalf */
2ronwalfpublic class OWLSConverters {
2ronwalf public static Map getConverters() {
2ronwalf Map converters = new HashMap();
2ronwalf
2ronwalf OWLObjectConverter serviceConverter =
2ronwalf new GenericOWLSConverter(ServiceImpl.class, OWLS.Service.Service);
2ronwalf OWLObjectConverter profileConverter =
2ronwalf new GenericOWLSConverter(ProfileImpl.class, OWLS.Profile.Profile);
2ronwalf OWLObjectConverter actorConverter =
2ronwalf new GenericOWLSConverter(ActorImpl.class, OWLS.Actor.Actor);
2ronwalf OWLObjectConverter serviceParamConverter =
2ronwalf new GenericOWLSConverter(ServiceParameterImpl.class, OWLS.Profile.ServiceParameter);
2ronwalf OWLObjectConverter serviceCategoryConverter =
2ronwalf new GenericOWLSConverter(ServiceCategoryImpl.class, OWLS.Profile.ServiceCategory);
2ronwalf
2ronwalf OWLObjectConverter atomicProcessConverter =
2ronwalf new GenericOWLSConverter(AtomicProcessImpl.class, OWLS.Process.AtomicProcess);
2ronwalf OWLObjectConverter compositeProcessConverter =
2ronwalf new GenericOWLSConverter(CompositeProcessImpl.class, OWLS.Process.CompositeProcess);
2ronwalf OWLObjectConverter simpleProcessConverter =
2ronwalf new GenericOWLSConverter(SimpleProcessImpl.class, OWLS.Process.SimpleProcess);
2ronwalf OWLObjectConverter processConverter =
2ronwalf new CombinedOWLSConverter(Process.class, new OWLObjectConverter[]
2ronwalf {atomicProcessConverter, compositeProcessConverter, simpleProcessConverter});
2ronwalf
2ronwalf OWLObjectConverter inputConverter =
2ronwalf new GenericOWLSConverter(InputImpl.class, OWLS.Process.Input);
2ronwalf OWLObjectConverter outputConverter =
2ronwalf new GenericOWLSConverter(OutputImpl.class, OWLS.Process.Output);
2ronwalf OWLObjectConverter localConverter =
2ronwalf new GenericOWLSConverter(LocalImpl.class, OWLS.Process.Local);
2ronwalf OWLObjectConverter resultVarConverter =
2ronwalf new GenericOWLSConverter(ResultVarImpl.class, OWLS.Process.ResultVar);
2ronwalf OWLObjectConverter parameterConverter =
2ronwalf new CombinedOWLSConverter(Parameter.class, new OWLObjectConverter[]
2ronwalf {inputConverter, outputConverter, localConverter, resultVarConverter});
2ronwalf
2ronwalf OWLObjectConverter conditionConverter = new ExpressionConverter(false);
2ronwalf OWLObjectConverter expressionConverter = new ExpressionConverter(true);
2ronwalf
2ronwalf Set performs = new HashSet();
2ronwalf performs.add(Perform.TheParentPerform);
2ronwalf performs.add(Perform.ThisPerform);
2ronwalf OWLObjectConverter performConverter =
2ronwalf new GenericOWLSConverter(PerformImpl.class, OWLS.Process.Perform, performs);
2ronwalf OWLObjectConverter sequenceConverter =
2ronwalf new GenericOWLSConverter(SequenceImpl.class, OWLS.Process.Sequence);
2ronwalf OWLObjectConverter choiceConverter =
2ronwalf new GenericOWLSConverter(ChoiceImpl.class, OWLS.Process.Choice);
2ronwalf OWLObjectConverter anyOrderConverter =
2ronwalf new GenericOWLSConverter(AnyOrderImpl.class, OWLS.Process.AnyOrder);
2ronwalf OWLObjectConverter ifThenElseConverter =
2ronwalf new GenericOWLSConverter(IfThenElseImpl.class, OWLS.Process.IfThenElse);
2ronwalf OWLObjectConverter repeatWhileConverter =
2ronwalf new GenericOWLSConverter(RepeatWhileImpl.class, OWLS.Process.RepeatWhile);
2ronwalf OWLObjectConverter repeatUntilConverter =
2ronwalf new GenericOWLSConverter(RepeatUntilImpl.class, OWLS.Process.RepeatUntil);
2ronwalf OWLObjectConverter forEachConverter =
2ronwalf new GenericOWLSConverter(ForEachImpl.class, OWLS.Process.ForEach);
2ronwalf OWLObjectConverter splitConverter =
2ronwalf new GenericOWLSConverter(SplitImpl.class, OWLS.Process.Split);
2ronwalf OWLObjectConverter splitJoinConverter =
2ronwalf new GenericOWLSConverter(SplitJoinImpl.class, OWLS.Process.SplitJoin);
2ronwalf OWLObjectConverter produceConverter =
2ronwalf new GenericOWLSConverter(ProduceImpl.class, OWLS.Process.Produce);
2ronwalf
2ronwalf OWLObjectConverter iterateConverter =
2ronwalf new CombinedOWLSConverter(Iterate.class, new OWLObjectConverter[]
2ronwalf {repeatWhileConverter, repeatUntilConverter, forEachConverter});
2ronwalf OWLObjectConverter controlConstructConverter =
2ronwalf new CombinedOWLSConverter(ControlConstruct.class, new OWLObjectConverter[]
2ronwalf {performConverter, sequenceConverter, choiceConverter, anyOrderConverter,
2ronwalf ifThenElseConverter, repeatWhileConverter, repeatUntilConverter, forEachConverter,
2ronwalf splitConverter, splitJoinConverter, produceConverter});
2ronwalf
2ronwalf OWLObjectConverter objListConverter =
2ronwalf new ListConverter(OWLSObjListImpl.class, OWLS.ObjList);
2ronwalf OWLObjectConverter rdfListConverter =
2ronwalf new ListConverter(RDFListImpl.class, RDF.ListVocabulary);
2ronwalf OWLObjectConverter listConverter =
2ronwalf new CombinedOWLSConverter(OWLSObjList.class, new OWLObjectConverter[] {
2ronwalf objListConverter, rdfListConverter});
2ronwalf OWLObjectConverter ccListConverter =
2ronwalf new ListConverter(ControlConstructListImpl.class, OWLS.CCList);
2ronwalf OWLObjectConverter ccBagConverter =
2ronwalf new ListConverter(ControlConstructBagImpl.class, OWLS.CCBag);
2ronwalf
2ronwalf OWLObjectConverter inputBindingConverter =
2ronwalf new GenericOWLSConverter(InputBindingImpl.class, OWLS.Process.InputBinding);
2ronwalf OWLObjectConverter outputBindingConverter =
2ronwalf new GenericOWLSConverter(OutputBindingImpl.class, OWLS.Process.OutputBinding);
2ronwalf OWLObjectConverter bindingConverter =
2ronwalf new CombinedOWLSConverter(BindingImpl.class, new OWLObjectConverter[] {
2ronwalf inputBindingConverter, outputBindingConverter});
2ronwalf
2ronwalf
2ronwalf OWLObjectConverter resultConverter =
2ronwalf new GenericOWLSConverter(ResultImpl.class, OWLS.Process.Result);
2ronwalf OWLObjectConverter valueOfConverter =
2ronwalf new GenericOWLSConverter(ValueOfImpl.class, OWLS.Process.ValueOf);
2ronwalf// OWLObjectConverter valueDataConverter =
2ronwalf// new ValueDataConverter();
2ronwalf
2ronwalf OWLObjectConverter genericGroundingConverter =
2ronwalf new GenericOWLSConverter(GroundingImpl.class, OWLS.Service.ServiceGrounding);
2ronwalf OWLObjectConverter wsdlGroundingConverter =
2ronwalf new GenericOWLSConverter(GroundingImpl.class, OWLS.Grounding.WsdlGrounding);
2ronwalf // added by Michael Daenzer
2ronwalf OWLObjectConverter javaGroundingConverter =
2ronwalf new GenericOWLSConverter(GroundingImpl.class, MoreGroundings.JavaGrounding);
2ronwalf // end added by Michael Daenzer
2ronwalf // changed by Michael Daenzer
2ronwalf OWLObjectConverter groundingConverter =
2ronwalf new CombinedOWLSConverter(Grounding.class, new OWLObjectConverter[] {
2ronwalf genericGroundingConverter, wsdlGroundingConverter, javaGroundingConverter
2ronwalf });
2ronwalf // end changed by Michael Daenzer
2ronwalf OWLObjectConverter wsdlAtomicGroundingConverter =
2ronwalf new GenericOWLSConverter(WSDLAtomicGroundingImpl.class, OWLS.Grounding.WsdlAtomicProcessGrounding);
2ronwalf OWLObjectConverter upnpAtomicGroundingConverter =
2ronwalf new GenericOWLSConverter(UPnPAtomicGroundingImpl.class, FLAServiceOnt.UPnPAtomicProcessGrounding);
2ronwalf // added by Michael Daenzer
2ronwalf OWLObjectConverter javaAtomicGroundingConverter =
2ronwalf new GenericOWLSConverter(JavaAtomicGroundingImpl.class, MoreGroundings.JavaAtomicProcessGrounding);
2ronwalf // end added by Michael Daenzer
2ronwalf // changed by Michael Daenzer
2ronwalf OWLObjectConverter atomicGroundingConverter =
2ronwalf new CombinedOWLSConverter(AtomicGrounding.class, new OWLObjectConverter[] {
2ronwalf upnpAtomicGroundingConverter, javaAtomicGroundingConverter, wsdlAtomicGroundingConverter});
24daenzerorama OWLObjectConverter javaVariableConverter =
24daenzerorama new GenericOWLSConverter(JavaVariableImpl.class, MoreGroundings.JavaVariable);
24daenzerorama OWLObjectConverter javaParameterConverter =
24daenzerorama new GenericOWLSConverter(JavaParameterImpl.class, MoreGroundings.JavaParameter);
2ronwalf // end changed by Michael Daenzer
2ronwalf OWLObjectConverter wsdlOperationRefConverter =
2ronwalf new GenericOWLSConverter(WSDLOperationRefImpl.class, OWLS.Grounding.WsdlOperationRef);
2ronwalf OWLObjectConverter wsdlInputMessageMapConverter =
2ronwalf new GenericOWLSConverter(WSDLMessageMapImpl.class, OWLS.Grounding.WsdlInputMessageMap);
2ronwalf OWLObjectConverter wsdlOutputMessageMapConverter =
2ronwalf new GenericOWLSConverter(WSDLMessageMapImpl.class, OWLS.Grounding.WsdlOutputMessageMap);
2ronwalf OWLObjectConverter upnpMessageMapConverter =
2ronwalf new GenericOWLSConverter(UPnPMessageMapImpl.class, FLAServiceOnt.UPnPMap);
2ronwalf OWLObjectConverter messageMapConverter =
2ronwalf new CombinedOWLSConverter(MessageMap.class, new OWLObjectConverter[] {
2ronwalf wsdlInputMessageMapConverter, wsdlOutputMessageMapConverter, upnpMessageMapConverter});
2ronwalf
2ronwalf OWLObjectConverter atomListConverter =
2ronwalf new ListConverter(AtomListImpl.class, SWRL.AtomListVocabulary);
2ronwalf OWLObjectConverter classAtomConverter =
2ronwalf new GenericOWLSConverter(ClassAtomImpl.class, SWRL.ClassAtom);
2ronwalf OWLObjectConverter indPropAtomConverter =
2ronwalf new GenericOWLSConverter(IndividualPropertyAtomImpl.class, SWRL.IndividualPropertyAtom);
2ronwalf OWLObjectConverter dataPropAtomConverter =
2ronwalf new GenericOWLSConverter(DataPropertyAtomImpl.class, SWRL.DatavaluedPropertyAtom);
2ronwalf OWLObjectConverter sameIndAtomConverter =
2ronwalf new GenericOWLSConverter(SameIndividualAtomImpl.class, SWRL.SameIndividualAtom);
2ronwalf OWLObjectConverter diffIndAtomConverter =
2ronwalf new GenericOWLSConverter(DifferentIndividualsAtomImpl.class, SWRL.DifferentIndividualsAtom);
2ronwalf OWLObjectConverter builtinAtomConverter =
2ronwalf new GenericOWLSConverter(BuiltinAtomImpl.class, SWRL.BuiltinAtom);
2ronwalf OWLObjectConverter atomConverter =
2ronwalf new CombinedOWLSConverter(AtomImpl.class, new OWLObjectConverter[] {
2ronwalf classAtomConverter, indPropAtomConverter, dataPropAtomConverter,
2ronwalf sameIndAtomConverter, diffIndAtomConverter, builtinAtomConverter});
2ronwalf OWLObjectConverter swrlIndVarConverter =
2ronwalf new CombinedOWLSConverter(SWRLIndividualVariableImpl.class, new OWLObjectConverter[] {
2ronwalf new GenericOWLSConverter(SWRLIndividualVariableImpl.class, SWRL.Variable),
2ronwalf new GenericOWLSConverter(SWRLIndividualVariableImpl.class, OWLS.Process.Input),
2ronwalf new GenericOWLSConverter(SWRLIndividualVariableImpl.class, OWLS.Process.Output),
2ronwalf new GenericOWLSConverter(SWRLIndividualVariableImpl.class, OWLS.Process.Local),
2ronwalf new GenericOWLSConverter(SWRLIndividualVariableImpl.class, OWLS.Process.ResultVar)});
2ronwalf OWLObjectConverter swrlIndConverter =
2ronwalf new SWRLIndividualConverter();
2ronwalf OWLObjectConverter swrlDataVarConverter =
2ronwalf new CombinedOWLSConverter(SWRLDataVariableImpl.class, new OWLObjectConverter[] {
2ronwalf new GenericOWLSConverter(SWRLDataVariableImpl.class, SWRL.Variable),
2ronwalf new GenericOWLSConverter(SWRLDataVariableImpl.class, OWLS.Process.Input),
2ronwalf new GenericOWLSConverter(SWRLDataVariableImpl.class, OWLS.Process.Output),
2ronwalf new GenericOWLSConverter(SWRLDataVariableImpl.class, OWLS.Process.Local),
2ronwalf new GenericOWLSConverter(SWRLDataVariableImpl.class, OWLS.Process.ResultVar)});
2ronwalf OWLObjectConverter swrlDataValueConverter =
2ronwalf new SWRLDataValueConverter();
2ronwalf OWLObjectConverter swrlIndObjConverter =
2ronwalf new CombinedOWLSConverter(SWRLIndividualObject.class, new OWLObjectConverter[] {
2ronwalf swrlIndVarConverter, swrlIndConverter});
2ronwalf OWLObjectConverter swrlDataObjConverter =
2ronwalf new CombinedOWLSConverter(SWRLDataObject.class, new OWLObjectConverter[] {
2ronwalf swrlDataVarConverter, swrlDataValueConverter});
2ronwalf
2ronwalf converters.put(Service.class, serviceConverter);
2ronwalf converters.put(Profile.class, profileConverter);
2ronwalf converters.put(ServiceParameter.class, serviceParamConverter);
2ronwalf converters.put(ServiceCategory.class, serviceCategoryConverter);
2ronwalf converters.put(Actor.class, actorConverter);
2ronwalf
2ronwalf converters.put(Grounding.class, groundingConverter);
2ronwalf converters.put(AtomicGrounding.class, atomicGroundingConverter);
2ronwalf converters.put(WSDLAtomicGrounding.class, wsdlAtomicGroundingConverter);
2ronwalf converters.put(UPnPAtomicGrounding.class, upnpAtomicGroundingConverter);
2ronwalf converters.put(JavaAtomicGrounding.class, javaAtomicGroundingConverter);
24daenzerorama converters.put(JavaVariable.class, javaVariableConverter);
24daenzerorama converters.put(JavaParameter.class, javaParameterConverter);
2ronwalf converters.put(WSDLOperationRef.class, wsdlOperationRefConverter);
2ronwalf converters.put(MessageMap.class, messageMapConverter);
2ronwalf
2ronwalf converters.put(AtomicProcess.class, atomicProcessConverter);
2ronwalf converters.put(CompositeProcess.class, compositeProcessConverter);
2ronwalf converters.put(SimpleProcess.class, simpleProcessConverter);
2ronwalf converters.put(Process.class, processConverter);
2ronwalf
2ronwalf converters.put(Perform.class, performConverter);
2ronwalf converters.put(Sequence.class, sequenceConverter);
2ronwalf converters.put(Choice.class, choiceConverter);
2ronwalf converters.put(AnyOrder.class, anyOrderConverter);
2ronwalf converters.put(IfThenElse.class, ifThenElseConverter);
2ronwalf converters.put(Iterate.class, iterateConverter);
2ronwalf converters.put(RepeatWhile.class, repeatWhileConverter);
2ronwalf converters.put(RepeatUntil.class, repeatUntilConverter);
2ronwalf converters.put(ForEach.class, forEachConverter);
2ronwalf converters.put(Split.class, splitConverter);
2ronwalf converters.put(SplitJoin.class, splitJoinConverter);
2ronwalf converters.put(Produce.class, produceConverter);
2ronwalf converters.put(ControlConstruct.class, controlConstructConverter);
2ronwalf
2ronwalf converters.put(Input.class, inputConverter);
2ronwalf converters.put(Output.class, outputConverter);
2ronwalf converters.put(Local.class, localConverter);
2ronwalf converters.put(ResultVar.class, resultVarConverter);
2ronwalf converters.put(Parameter.class, parameterConverter);
2ronwalf
2ronwalf converters.put(InputBinding.class, inputBindingConverter);
2ronwalf converters.put(OutputBinding.class, outputBindingConverter);
2ronwalf converters.put(Binding.class, bindingConverter);
2ronwalf
2ronwalf converters.put(Result.class, resultConverter);
2ronwalf converters.put(ValueOf.class, valueOfConverter);
2ronwalf// converters.put(ValueData.class, valueDataConverter);
2ronwalf
2ronwalf converters.put(OWLSObjList.class, listConverter);
2ronwalf converters.put(RDFList.class, rdfListConverter);
2ronwalf converters.put(ControlConstructList.class, ccListConverter);
2ronwalf converters.put(ControlConstructBag.class, ccBagConverter);
2ronwalf
2ronwalf converters.put(Condition.class, conditionConverter);
2ronwalf converters.put(Expression.class, expressionConverter);
2ronwalf
2ronwalf converters.put(AtomList.class, atomListConverter);
2ronwalf converters.put(Atom.class, atomConverter);
2ronwalf converters.put(ClassAtom.class, classAtomConverter);
2ronwalf converters.put(IndividualPropertyAtom.class, indPropAtomConverter);
2ronwalf converters.put(SameIndividualAtom.class, sameIndAtomConverter);
2ronwalf converters.put(DifferentIndividualsAtom.class, diffIndAtomConverter);
2ronwalf converters.put(DataPropertyAtom.class, dataPropAtomConverter);
2ronwalf converters.put(BuiltinAtom.class, builtinAtomConverter);
2ronwalf converters.put(SWRLIndividual.class, swrlIndConverter);
2ronwalf converters.put(SWRLIndividualVariable.class, swrlIndVarConverter);
2ronwalf converters.put(SWRLIndividualObject.class, swrlIndObjConverter);
2ronwalf converters.put(SWRLDataVariable.class, swrlDataVarConverter);
2ronwalf converters.put(SWRLDataValue.class, swrlDataValueConverter);
2ronwalf converters.put(SWRLDataObject.class, swrlDataObjConverter);
2ronwalf
2ronwalf return converters;
2ronwalf }
2ronwalf
2ronwalf public static class GenericOWLSConverter implements OWLObjectConverter {
2ronwalf Class javaClass;
2ronwalf OWLClass owlClass;
2ronwalf Set individuals;
2ronwalf Constructor constructor;
2ronwalf
2ronwalf public GenericOWLSConverter(Class javaClass, OWLClass owlClass) {
2ronwalf this(javaClass, owlClass, Collections.EMPTY_SET);
2ronwalf }
2ronwalf
2ronwalf public GenericOWLSConverter(Class javaClass, OWLClass owlClass, Set individuals) {
2ronwalf this.javaClass = javaClass;
2ronwalf this.owlClass = owlClass;
2ronwalf this.individuals = individuals;
2ronwalf
2ronwalf try {
2ronwalf constructor = javaClass.getConstructor(new Class[] {OWLIndividual.class});
2ronwalf } catch(Exception e) {
2ronwalf throw new RuntimeException(e);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf return (object instanceof OWLIndividual) &&
2ronwalf (!OWLConfig.getStrictConversion() ||
2ronwalf ((OWLIndividual) object).isType(owlClass) ||
2ronwalf individuals.contains(object));
2ronwalf }
2ronwalf
2ronwalf public OWLObject cast(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("OWLObject " + object + " cannot be cast to " + owlClass);
2ronwalf
2ronwalf try {
2ronwalf return (OWLObject) constructor.newInstance(new Object[] {(OWLIndividual) object});
2ronwalf } catch(Exception e) {
2ronwalf e.printStackTrace();
2ronwalf throw new CastingException("OWLObject " + object + " cannot be cast to " + javaClass);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf ((OWLIndividual) object).addType(owlClass);
2ronwalf
2ronwalf return cast(object);
2ronwalf }
2ronwalf
2ronwalf public String toString() {
2ronwalf return "Converter " + owlClass + " -> " + javaClass;
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public static class CombinedOWLSConverter implements OWLObjectConverter {
2ronwalf OWLObjectConverter[] converters;
2ronwalf Class javaClass;
2ronwalf
2ronwalf public CombinedOWLSConverter(Class javaClass, OWLObjectConverter[] converters) {
2ronwalf this.converters = converters;
2ronwalf this.javaClass = javaClass;
2ronwalf }
2ronwalf
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf boolean strict = OWLConfig.setStrictConversion(true);
2ronwalf for(int i = 0; i < converters.length; i++) {
2ronwalf OWLObjectConverter converter = converters[i];
2ronwalf if(converter.canCast(object)) {
2ronwalf OWLConfig.setStrictConversion(strict);
2ronwalf return true;
2ronwalf }
2ronwalf }
2ronwalf OWLConfig.setStrictConversion(strict);
2ronwalf
2ronwalf return false;
2ronwalf }
2ronwalf
2ronwalf public OWLObject cast(OWLObject object) {
2ronwalf boolean strict = OWLConfig.setStrictConversion(true);
2ronwalf for(int i = 0; i < converters.length; i++) {
2ronwalf OWLObjectConverter converter = converters[i];
2ronwalf if(converter.canCast(object)) {
2ronwalf OWLConfig.setStrictConversion(strict);
2ronwalf return converters[i].cast(object);
2ronwalf }
2ronwalf }
2ronwalf OWLConfig.setStrictConversion(strict);
2ronwalf
2ronwalf System.err.println(((OWLIndividual)object).toRDF(false));
2ronwalf throw new CastingException("OWLObject " + object + " cannot be cast to " + javaClass);
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("Cannot convert " + object + " to abstract class " + javaClass);
2ronwalf
2ronwalf return cast(object);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public static class ListConverter extends GenericOWLSConverter {
2ronwalf ListVocabulary vocabulary;
2ronwalf
2ronwalf public ListConverter(Class javaClass, ListVocabulary vocabulary) {
2ronwalf super(javaClass, vocabulary.List());
2ronwalf
2ronwalf this.vocabulary = vocabulary;
2ronwalf }
2ronwalf
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf if(object instanceof OWLIndividual) {
2ronwalf OWLIndividual ind = (OWLIndividual) object;
2ronwalf
2ronwalf return ind.equals(vocabulary.nil()) ||
2ronwalf ind.isType(vocabulary.List()) ||
2ronwalf ind.hasProperty(vocabulary.first()) ||
2ronwalf ind.hasProperty(vocabulary.rest());
2ronwalf }
2ronwalf
2ronwalf return false;
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("Cannot do conversion for object lists!");
2ronwalf
2ronwalf return cast(object);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public static class ExpressionConverter implements OWLObjectConverter {
2ronwalf boolean convertToExpression;
2ronwalf OWLClass owlClass;
2ronwalf// OWLClass specificClass;
2ronwalf// OWLIndividual specificValue;
2ronwalf
2ronwalf public ExpressionConverter(boolean convertToExpression) {
2ronwalf this.convertToExpression = convertToExpression;
2ronwalf
2ronwalf if(convertToExpression) {
2ronwalf owlClass = OWLS.Expression.Expression;
2ronwalf// specificClass = OWLS.Expression.SWRL_Expression;
2ronwalf }
2ronwalf else {
2ronwalf owlClass = OWLS.Expression.Condition;
2ronwalf// specificClass = OWLS.Expression.SWRL_Condition;
2ronwalf }
2ronwalf// specificValue = OWLS.Expression.SWRL;
2ronwalf }
2ronwalf
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf if(object instanceof OWLIndividual) {
2ronwalf if(!OWLConfig.getStrictConversion())
2ronwalf return true;
2ronwalf
2ronwalf OWLIndividual ind = (OWLIndividual) object;
2ronwalf
2ronwalf if(ind.equals(OWLS.Expression.AlwaysTrue))
2ronwalf return true;
2ronwalf
2ronwalf if(convertToExpression) {
2ronwalf return ind.isType(OWLS.Expression.SWRL_Expression) ||
2ronwalf ind.isType(OWLS.Expression.SWRL_Condition) ||
2ronwalf ind.hasProperty(OWLS.Expression.expressionLanguage, OWLS.Expression.SWRL);
2ronwalf
2ronwalf }
2ronwalf else {
2ronwalf return ind.isType(OWLS.Expression.SWRL_Condition) ||
2ronwalf (ind.isType(OWLS.Expression.Condition) &&
2ronwalf ind.hasProperty(OWLS.Expression.expressionLanguage, OWLS.Expression.SWRL));
2ronwalf
2ronwalf }
2ronwalf// if(ind.equals(OWLS.Expression.AlwaysTrue))
2ronwalf// ind.isType(specificClass) ||
2ronwalf// (ind.isType(owlClass) && ind.hasProperty(OWLS.Expression.expressionLanguage, specificValue)))
2ronwalf// return true;
2ronwalf }
2ronwalf
2ronwalf return false;
2ronwalf }
2ronwalf
2ronwalf public OWLObject cast(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("OWLObject " + object + " cannot be converted to " + owlClass);
2ronwalf
2ronwalf try {
2ronwalf if(convertToExpression)
2ronwalf return new SWRLExpressionImpl((OWLIndividual) object);
2ronwalf else
2ronwalf return new SWRLExpressionImpl((OWLIndividual) object);
2ronwalf } catch(Exception e) {
2ronwalf e.printStackTrace();
2ronwalf throw new CastingException("OWLObject " + object + " cannot be converted to " + owlClass);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf ((OWLIndividual) object).addType(owlClass);
2ronwalf
2ronwalf return cast(object);
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public static class SWRLIndividualConverter implements OWLObjectConverter {
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf return (object instanceof OWLIndividual);
2ronwalf }
2ronwalf
2ronwalf public OWLObject cast(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("OWLObject " + object + " cannot be converted to " + SWRLIndividualObject.class);
2ronwalf
2ronwalf return new SWRLIndividualImpl((OWLIndividual) object);
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(canCast(object))
2ronwalf cast(object);
2ronwalf
2ronwalf throw new NotImplementedException();
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf public static class SWRLDataValueConverter implements OWLObjectConverter {
2ronwalf public SWRLDataValueConverter() {
2ronwalf }
2ronwalf
2ronwalf public boolean canCast(OWLObject object) {
2ronwalf return (object instanceof OWLDataValue);
2ronwalf }
2ronwalf
2ronwalf public OWLObject cast(OWLObject object) {
2ronwalf if(!canCast(object))
2ronwalf throw new ConversionException("OWLObject " + object + " cannot be converted to SWRLDataValue");
2ronwalf
2ronwalf
2ronwalf return new SWRLDataValueImpl((OWLDataValue) object);
2ronwalf }
2ronwalf
2ronwalf public OWLObject convert(OWLObject object) {
2ronwalf if(canCast(object))
2ronwalf cast(object);
2ronwalf
2ronwalf throw new NotImplementedException();
2ronwalf }
2ronwalf }
2ronwalf
2ronwalf// public static class ValueDataConverter implements OWLObjectConverter {
2ronwalf// public ValueDataConverter() {
2ronwalf// }
2ronwalf//
2ronwalf// public boolean canCast(OWLObject object) {
2ronwalf// return (object instanceof OWLDataValue);
2ronwalf// }
2ronwalf//
2ronwalf// public OWLObject cast(OWLObject object) {
2ronwalf// if(!canCast(object))
2ronwalf// throw new ConversionException("OWLObject " + object + " cannot be converted to ValueData");
2ronwalf//
2ronwalf// OWLDataValue literal = (OWLDataValue) object;
2ronwalf// OWLOntology test = OWLFactory.createKB().parseLiteral(literal.getLexicalValue(), null);
2ronwalf// OWLValue value = test.findTheIndividual(OWL.Thing);
2ronwalf// if(value == null)
2ronwalf// value = literal;
2ronwalf//
2ronwalf// return new ValueDataImpl(value);
2ronwalf// }
2ronwalf//
2ronwalf// public OWLObject convert(OWLObject object) {
2ronwalf// if(canCast(object))
2ronwalf// cast(object);
2ronwalf//
2ronwalf// throw new NotImplementedException();
2ronwalf// }
2ronwalf// }
2ronwalf}
2ronwalf