Mist, da habe ich vorhin was falsch rauskopiert.
die description:
<?xml version="1.0"?>
Client methode:
public void start(BundleContext context) {
ServiceReference reference = context.getServiceReference(ContextManager.class.getName());
contextManager = (ContextManager) context.getService(reference);
System.out.println(„Starting Lamptester!“);
String uriLamp = „http://www.openaal.org/SAM/Ontology/highLevelThing#Lamp“;
String uriMyLamp = „http://www.openaal.org/SAM/Ontology/highLevelThing#t…“;
Resource mylampRes = Resource.fromURI(uriMyLamp);
Resource lampRes = Resource.fromURI(uriLamp);
String uriPropertyHasOpenState = „http://www.openaal.org/SAM/Ontology#has-open-state“;
Resource openRes = Resource.fromURI("http://www.openaal.org/SAM/Ontology#open");
Resource closedRes = Resource.fromURI("http://www.openaal.org/SAM/Ontology#closed");
Lamp lamp123 = Lamp.create(mylampRes);
try{
mylampRes = contextManager.generateNewInstance(mylampRes, lampRes);
System.out.println(„Added mylamp instance to CM“);
}catch(NullPointerException e){
System.out.println(„Could not find ContextManager - please check the Service Description!“);
}
if(contextManager.isInstance(mylampRes))
System.out.println(„mylampRes is instance of lampRes!“);
Statement doorhasBeenOpened =
new Statement( mylampRes,
Resource.fromURI(uriPropertyHasOpenState),
openRes,
MetaLiterals.getInstance());
Statement doorhasBeenClosed =
new Statement( mylampRes,
Resource.fromURI(uriPropertyHasOpenState),
closedRes,
MetaLiterals.getInstance());
try{
contextManager.storeNewStatement(doorhasBeenOpened);
}catch(NullPointerException e){
System.out.println(„Could not find ContextManager - please check the Service Description!“);
}
Open open = Open.getInstance();
Closed closed = Closed.getInstance();
contextManager.storeNewStatement(doorhasBeenOpened);
while(true){
try {
System.out.println(„Setting Lampstatus to closed“);
contextManager.storeNewStatement(doorhasBeenClosed);
wait(20);
System.out.println(„Setting Lampstatus to open“);
contextManager.storeNewStatement(doorhasBeenOpened);
wait(20);
} catch (InterruptedException e) {
System.out.println(„Waiting Error!“);
e.printStackTrace();
} catch (NullPointerException e) {
System.out.println(„Could not find ContextMaanger - please check the Service Description!“);
}
}
clientmanager-description:
<?xml version="1.0"?>org/openaal/sam/contextmanager
ContextManager interface manifest:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: wolf
Bundle-ManifestVersion: 2
Bundle-Name: SAM_Interface Plug-in
Bundle-SymbolicName: org.openaal.sam.interface
Bundle-Version: 0.7.20
Bundle-Vendor: CAS, FZI
Bundle-Category: openAAL
Service-Component: OSGI-INF/store-description.xml
Export-Package: diane.dsd.ontology.parser.transformer,
dsd.elements,
dsd.elements.iterationDirective,
dsd.elements.multiAttributeCondition,
dsd.elements.operation,
dsd.elements.reference,
dsd.elements.xsd,
dsd.instance.category.valuation.RateUnit,
dsd.instance.domain.cinema.Category,
dsd.instance.domain.cinema.Cinema,
dsd.instance.domain.cinema.Hall,
dsd.instance.domain.cinema.Row,
dsd.instance.domain.cinema.SoundSystem,
dsd.instance.domain.color.Color,
dsd.instance.domain.economy.Company,
dsd.instance.domain.economy.OrderStatus,
dsd.instance.domain.electronic.CRTTVSet,
dsd.instance.domain.electronic.PlasmaTVSet,
dsd.instance.domain.electronic.TFTTVSet,
dsd.instance.domain.electronic.TVAspectRatio,
dsd.instance.domain.electronic.Technology,
dsd.instance.domain.file.DocumentType,
dsd.instance.domain.file.Format,
dsd.instance.domain.file.printing.Color,
dsd.instance.domain.groupservices.BillBoard,
dsd.instance.domain.groupservices.Note,
dsd.instance.domain.groupservices.OnlineUser,
dsd.instance.domain.information.Format,
dsd.instance.domain.information.Perspective,
dsd.instance.domain.literature.Binding,
dsd.instance.domain.literature.Category,
dsd.instance.domain.location.City,
dsd.instance.domain.location.Continent,
dsd.instance.domain.location.Country,
dsd.instance.domain.location.Language,
dsd.instance.domain.location.Region,
dsd.instance.domain.location.Room,
dsd.instance.domain.location.State,
dsd.instance.domain.measure.DataCapacityUnit,
dsd.instance.domain.measure.FrequencyUnit,
dsd.instance.domain.measure.LengthUnit,
dsd.instance.domain.measure.SpeedUnit,
dsd.instance.domain.measure.VoltageUnit,
dsd.instance.domain.measure.WeightUnit,
dsd.instance.domain.money.CreditCard,
dsd.instance.domain.money.Currency,
dsd.instance.domain.movie.Genre,
dsd.instance.domain.movie.Movie,
dsd.instance.domain.person.Person,
dsd.instance.domain.person.Role,
dsd.instance.domain.transportation.CoachType,
dsd.instance.domain.transportation.QualityClass,
dsd.instance.domain.transportation.Reduction,
dsd.instance.domain.transportation.TrainType,
dsd.instance.domain.university.Course,
dsd.instance.domain.university.Faculty,
dsd.instance.domain.university.Institute,
dsd.instance.domain.university.Professor,
dsd.instance.domain.university.ResearchAssistant,
dsd.instance.domain.university.Student,
dsd.instance.domain.university.SummerOrWinter,
dsd.instance.domain.university.University,
dsd.instance.upper.ServiceOffer,
dsd.instance.upper.ServiceRequest,
dsd.instance.xsd.XSD_Date,
dsd.instance.xsd.XSD_DateTime,
dsd.instance.xsd.XSD_Time,
dsd.schema.category.access,
dsd.schema.category.assignment,
dsd.schema.category.capability,
dsd.schema.category.instantiation,
dsd.schema.category.knowledge,
dsd.schema.category.position,
dsd.schema.category.possession,
dsd.schema.category.relationship,
dsd.schema.category.valuation,
dsd.schema.domain.accomodation,
dsd.schema.domain.cinema,
dsd.schema.domain.color,
dsd.schema.domain.communication,
dsd.schema.domain.computer,
dsd.schema.domain.database,
dsd.schema.domain.economy,
dsd.schema.domain.electronic,
dsd.schema.domain.file,
dsd.schema.domain.file.printing,
dsd.schema.domain.flight,
dsd.schema.domain.groupservices,
dsd.schema.domain.information,
dsd.schema.domain.legal,
dsd.schema.domain.literature,
dsd.schema.domain.location,
dsd.schema.domain.measure,
dsd.schema.domain.money,
dsd.schema.domain.movie,
dsd.schema.domain.person,
dsd.schema.domain.telecommunication,
dsd.schema.domain.transportation,
dsd.schema.domain.university,
dsd.schema.top,
dsd.schema.upper,
dsd.schema.upper.grounding,
dsd.schema.upper.model,
dsd.schema.upper.profile,
dsd.visualization,
org.openaal.constants,
org.openaal.sam.composer.interfaces,
org.openaal.sam.contextmanager.interfaces,
org.openaal.sam.contextmanager.uplifter,
org.openaal.sam.matcher.cache,
org.openaal.sam.meta.event,
org.openaal.sam.meta.resource,
org.openaal.sam.meta.statement,
org.openaal.sam.meta.statement.condition,
org.openaal.sam.ontology.connector,
org.openaal.sam.ontology.datatypes,
org.openaal.sam.ontology.meta,
org.openaal.sam.proceduralmanager.impl.engine.activities.extensions.values,
org.openaal.sam.proceduralmanager.interfaces
Bundle-ClassPath: .,
lib/dsd-ontology.jar,
lib/dsd-parser.jar
Require-Bundle: org.openaal.logger
Import-Package: net.sf.ehcache,
net.sf.ehcache.bootstrap,
net.sf.ehcache.concurrent,
net.sf.ehcache.config,
net.sf.ehcache.constructs.asynchronous,
net.sf.ehcache.constructs.blocking,
net.sf.ehcache.distribution,
net.sf.ehcache.event,
net.sf.ehcache.exceptionhandler,
net.sf.ehcache.extension,
net.sf.ehcache.hibernate,
net.sf.ehcache.loader,
net.sf.ehcache.management,
net.sf.ehcache.store,
net.sf.ehcache.util,
org.osgi.framework;version=„1.4.0“,
org.osgi.service.component;version=„1.0.0“
ContextMangerImpl manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.openaal.sam.contextmanager
Bundle-SymbolicName: org.openaal.sam.contextmanager
Bundle-Version: 1.0.0
Service-Component: OSGI-INF/contextmanager-description.xml, OSGI-INF/schemamanager-description.xml, OSGI-INF/transformer-description.xml
Import-Package: com.hp.hpl.jena,
com.hp.hpl.jena.ontology,
com.hp.hpl.jena.rdf.model,
com.hp.hpl.jena.util,
com.hp.hpl.jena.util.iterator,
org.h2,
org.openaal.constants,
org.openaal.sam.contextmanager.interfaces,
org.openaal.sam.meta.event,
org.openaal.sam.meta.resource,
org.openaal.sam.meta.statement,
org.openaal.sam.meta.statement.condition,
org.openaal.sam.ontology.datatypes,
org.openaal.sam.ontology.meta,
org.osgi.framework;version=„1.4.0“,
org.osgi.service.component;version=„1.0.0“,
org.osgi.service.event;version=„1.1.0“,
org.osgi.util.tracker;version=„1.3.3“
Require-Bundle: org.openaal.logger,
org.openaal.sam.ontology