C++: Reorganize Validity and Condition, add Condition and Voucher to
authorjani <jani@asema.com>
Thu, 29 Aug 2019 21:49:58 +0000 (00:49 +0300)
committerjani <jani@asema.com>
Thu, 29 Aug 2019 21:49:58 +0000 (00:49 +0300)
PriceSpecification

20 files changed:
Common/C++/SmartAPI/smartapi.pro
Common/C++/SmartAPI/smartapi/common/Duration.cpp
Common/C++/SmartAPI/smartapi/common/PROPERTY.h
Common/C++/SmartAPI/smartapi/common/RESOURCE.h
Common/C++/SmartAPI/smartapi/model/Condition.cpp
Common/C++/SmartAPI/smartapi/model/Condition.h
Common/C++/SmartAPI/smartapi/model/Offering.cpp
Common/C++/SmartAPI/smartapi/model/Offering.h
Common/C++/SmartAPI/smartapi/model/PriceSpecification.cpp
Common/C++/SmartAPI/smartapi/model/PriceSpecification.h
Common/C++/SmartAPI/smartapi/model/TemporalContext.cpp
Common/C++/SmartAPI/smartapi/model/TemporalContext.h
Common/C++/SmartAPI/smartapi/model/Validity.cpp
Common/C++/SmartAPI/smartapi/model/Validity.h
Common/C++/SmartAPI/smartapi/model/Velocity.h
Common/C++/SmartAPI/smartapi/model/Voucher.h
Common/C++/SmartAPI/tests/TestSequences.cpp
Common/Java/SmartAPI/src/smartapi/agents/SearchAgent.java
Examples/Python/AdaptDataService/AdaptDataService.py
Ontology/src/1.0/TradingOntology-1.0.ttl

index 7f405b41366c0280d842c2d75ddb746e074d9fbb..7c9dd851643effc8bba83f01d19d248f9176f9af 100644 (file)
@@ -137,26 +137,13 @@ SOURCES += smartapi/agents/Agent.cpp \
         smartapi/model/Transaction.cpp \
         smartapi/model/TypeAndQuantityNode.cpp \
         smartapi/model/UnitPriceSpecification.cpp \
+        smartapi/model/Validity.cpp \
         smartapi/model/ValueObject.cpp \
         smartapi/model/Velocity.cpp \
+        smartapi/model/Voucher.cpp \
         smartapi/model/Waypoint.cpp \
         smartapi/model/Waypoints.cpp \
         smartapi/model/Zone.cpp \
-        smartapi/rdf/GraphItem.cpp \
-        smartapi/rdf/PropertyList.cpp \
-        smartapi/rdf/ItemizedList.cpp \
-        smartapi/rdf/LinkedList.cpp \
-        smartapi/rdf/List.cpp \
-        smartapi/rdf/Literal.cpp \
-        smartapi/rdf/Model.cpp \
-        smartapi/rdf/NudeList.cpp \
-        smartapi/rdf/OrderedList.cpp \
-        smartapi/rdf/Property.cpp \
-        smartapi/rdf/RDFNode.cpp \
-        smartapi/rdf/Resource.cpp \
-        smartapi/rdf/Statement.cpp \
-        smartapi/rdf/Variant.cpp \
-        smartapi/common/STATUSCODE.cpp \
         smartapi/model/PriceListSpecification.cpp \
         smartapi/model/DependentPriceSpecification.cpp \
         smartapi/model/TimeDependentPriceSpecification.cpp \
@@ -177,7 +164,23 @@ SOURCES += smartapi/agents/Agent.cpp \
         smartapi/model/DurationAtZoneDependentPriceSpecification.cpp \
         smartapi/model/TimeDependentPriceListSpecification.cpp \
         smartapi/model/ObjectOperationDependentPriceSpecification.cpp \
-        smartapi/model/License.cpp
+        smartapi/model/License.cpp \
+        smartapi/rdf/GraphItem.cpp \
+        smartapi/rdf/PropertyList.cpp \
+        smartapi/rdf/ItemizedList.cpp \
+        smartapi/rdf/LinkedList.cpp \
+        smartapi/rdf/List.cpp \
+        smartapi/rdf/Literal.cpp \
+        smartapi/rdf/Model.cpp \
+        smartapi/rdf/NudeList.cpp \
+        smartapi/rdf/OrderedList.cpp \
+        smartapi/rdf/Property.cpp \
+        smartapi/rdf/RDFNode.cpp \
+        smartapi/rdf/Resource.cpp \
+        smartapi/rdf/Statement.cpp \
+        smartapi/rdf/Variant.cpp \
+        smartapi/common/STATUSCODE.cpp
+
 
        
 HEADERS += smartapi/agents/Agent.h \
@@ -278,28 +281,13 @@ HEADERS += smartapi/agents/Agent.h \
         smartapi/model/Transaction.h \
         smartapi/model/TypeAndQuantityNode.h \
         smartapi/model/UnitPriceSpecification.h \
+        smartapi/model/Validity.h \
         smartapi/model/ValueObject.h \
         smartapi/model/Velocity.h \
+        smartapi/model/Voucher.h \
         smartapi/model/Waypoint.h \
         smartapi/model/Waypoints.h \
         smartapi/model/Zone.h \
-        smartapi/rdf/PropertyListItem.h \
-        smartapi/rdf/PropertyList.h \
-        smartapi/rdf/PropertyList.tcc \
-        smartapi/rdf/GraphItem.h \
-        smartapi/rdf/ItemizedList.h \
-        smartapi/rdf/LinkedList.h \
-        smartapi/rdf/List.h \
-        smartapi/rdf/Literal.h \
-        smartapi/rdf/Model.h \
-        smartapi/rdf/NudeList.h \
-        smartapi/rdf/OrderedList.h \
-        smartapi/rdf/Property.h \
-        smartapi/rdf/RDFNode.h \
-        smartapi/rdf/Resource.h \
-        smartapi/rdf/Resource.tcc \
-        smartapi/rdf/Statement.h \
-        smartapi/rdf/Variant.h \
         smartapi/model/PriceListSpecification.h \
         smartapi/model/DependentPriceSpecification.h \
         smartapi/model/TimeDependentPriceSpecification.h \
@@ -321,7 +309,25 @@ HEADERS += smartapi/agents/Agent.h \
         smartapi/model/DurationAtZoneDependentPriceSpecification.h \
         smartapi/model/TimeDependentPriceListSpecification.h \
         smartapi/model/ObjectOperationDependentPriceSpecification.h \
-        smartapi/model/License.h
+        smartapi/model/License.h \
+        smartapi/rdf/PropertyListItem.h \
+        smartapi/rdf/PropertyList.h \
+        smartapi/rdf/PropertyList.tcc \
+        smartapi/rdf/GraphItem.h \
+        smartapi/rdf/ItemizedList.h \
+        smartapi/rdf/LinkedList.h \
+        smartapi/rdf/List.h \
+        smartapi/rdf/Literal.h \
+        smartapi/rdf/Model.h \
+        smartapi/rdf/NudeList.h \
+        smartapi/rdf/OrderedList.h \
+        smartapi/rdf/Property.h \
+        smartapi/rdf/RDFNode.h \
+        smartapi/rdf/Resource.h \
+        smartapi/rdf/Resource.tcc \
+        smartapi/rdf/Statement.h \
+        smartapi/rdf/Variant.h
+
 
 
 DESTDIR = lib
index 5cfa53eafce99885b5127805d1fc721a0317a00f..8d22164a612606906ae4b6877861846a9f229629 100644 (file)
 #include <QDebug>
 
 Duration::Duration()
-    : mLexicalRepresentation(),
-      mIsPositive(true),
-      mYears(0),
-      mMonths(0),
-      mDays(0),
-      mHours(0),
-      mMinutes(0),
-      mSeconds(0)
+       : mLexicalRepresentation(),
+       mIsPositive(true),
+       mYears(0),
+       mMonths(0),
+       mDays(0),
+       mHours(0),
+       mMinutes(0),
+       mSeconds(0)
 {
 }
 
 Duration::Duration(QString lexicalRepresentation)
-    : Duration()
+       : Duration()
 {
-    mLexicalRepresentation = lexicalRepresentation;
-    parseLexicalRepresentation(lexicalRepresentation);
+       mLexicalRepresentation = lexicalRepresentation;
+       parseLexicalRepresentation(lexicalRepresentation);
 }
 
 Duration::Duration(bool isPositive, int years, int months, int days, int hours, int minutes, int seconds)
-    : Duration()
+       : Duration()
 {
-    mIsPositive = isPositive;
-    mYears = years;
-    mMonths = months;
-    mDays = days;
-    mHours = hours;
-    mMinutes = minutes;
-    mSeconds = seconds;
+       mIsPositive = isPositive;
+       mYears = years;
+       mMonths = months;
+       mDays = days;
+       mHours = hours;
+       mMinutes = minutes;
+       mSeconds = seconds;
 }
 
 Duration::Duration(int years, int months, int days, int hours, int minutes, int seconds)
-    : Duration(true, years, months, days, hours, minutes, seconds)
+       : Duration(true, years, months, days, hours, minutes, seconds)
 {
 }
 
 Duration::Duration(Duration* d)
 {
-    if (d != NULL) {
-        mIsPositive = d->isPositive();
-        mYears = d->getYears();
-        mMonths = d->getMonths();
-        mDays = d->getDays();
-        mHours = d->getHours();
-        mMinutes = d->getMinutes();
-        mSeconds = d->getSeconds();
-        mLexicalRepresentation = d->toString();
-    }
+       if (d != NULL) {
+               mIsPositive = d->isPositive();
+               mYears = d->getYears();
+               mMonths = d->getMonths();
+               mDays = d->getDays();
+               mHours = d->getHours();
+               mMinutes = d->getMinutes();
+               mSeconds = d->getSeconds();
+               mLexicalRepresentation = d->toString();
+       }
 }
 
 QDateTime Duration::add(QDateTime date)
 {
-    return date.addYears(mIsPositive ? mYears : -mYears)
-               .addMonths(mIsPositive ? mMonths : -mMonths)
-               .addDays(mIsPositive ? mDays : -mDays)
-               .addSecs(mIsPositive ? (((mHours * 24) + mMinutes) * 60 + mSeconds)
-                                    : -(((mHours * 24) + mMinutes) * 60 + mSeconds));
+       return date.addYears(mIsPositive ? mYears : -mYears)
+                               .addMonths(mIsPositive ? mMonths : -mMonths)
+                               .addDays(mIsPositive ? mDays : -mDays)
+                               .addSecs(mIsPositive ? (((mHours * 24) + mMinutes) * 60 + mSeconds)
+                                                               : -(((mHours * 24) + mMinutes) * 60 + mSeconds));
 }
 
 QString Duration::toString()
 {
-    if (mLexicalRepresentation.isNull()) {
-        mLexicalRepresentation = constructLexicalRepresentation();
-    }
+       if (mLexicalRepresentation.isNull()) {
+               mLexicalRepresentation = constructLexicalRepresentation();
+       }
 
-    return mLexicalRepresentation;
+       return mLexicalRepresentation;
 }
 
 bool Duration::parseLexicalRepresentation(QString str)
 {
-    int i;
-    bool ok;
-
-    if (str.startsWith("-")) {
-        mIsPositive = false;
-        str.remove(0, 1);
-    }
-
-    if (str.startsWith("P")) {
-        str.remove(0, 1);
-    } else {
-        qCritical() << "Invalid duration: period indicator missing";
-        return false;
-    }
-
-    // parse years
-    if ((i = str.indexOf('Y')) >= 0) {
-        mYears = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of years is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    // parse months
-    if ((i = str.indexOf('M')) >= 0) {
-        mMonths = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of months is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    // parse days
-    if ((i = str.indexOf('D')) >= 0) {
-        mDays = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of days is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    // start of time section is indicated with 'T' if it is present
-    if (str.isEmpty()) {
-        mHours = mMinutes = mSeconds = 0;
-        return true;
-    } else if (!str.startsWith('T')) {
-        qCritical() << "Invalid duration";
-    }
-    str.remove(0, 1);
-
-    // parse hours
-    if ((i = str.indexOf('H')) >= 0) {
-        mHours = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of hours is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    // parse minutes
-    if ((i = str.indexOf('M')) >= 0) {
-        mMinutes = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of minutes is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    // parse seconds
-    if ((i = str.indexOf('S')) >= 0) {
-        mSeconds = str.left(i).toInt(&ok);
-        if (!ok) {
-            qCritical() << "Invalid duration: number of seconds is not a valid integer";
-            return false;
-        }
-        str.remove(0, i + 1);
-    }
-
-    if (!str.isEmpty()) {
-        qCritical() << "Invalid duration: string format not canonical";
-        return false;
-    }
-
-    return true;
+       int i;
+       bool ok;
+
+       if (str.startsWith("-")) {
+               mIsPositive = false;
+               str.remove(0, 1);
+       }
+
+       if (str.startsWith("P")) {
+               str.remove(0, 1);
+       } else {
+               qCritical() << "Invalid duration: period indicator missing";
+               return false;
+       }
+
+       // parse years
+       if ((i = str.indexOf('Y')) >= 0) {
+               mYears = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of years is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       // parse months
+       if ((i = str.indexOf('M')) >= 0) {
+               mMonths = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of months is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       // parse days
+       if ((i = str.indexOf('D')) >= 0) {
+               mDays = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of days is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       // start of time section is indicated with 'T' if it is present
+       if (str.isEmpty()) {
+               mHours = mMinutes = mSeconds = 0;
+               return true;
+       } else if (!str.startsWith('T')) {
+               qCritical() << "Invalid duration";
+       }
+       str.remove(0, 1);
+
+       // parse hours
+       if ((i = str.indexOf('H')) >= 0) {
+               mHours = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of hours is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       // parse minutes
+       if ((i = str.indexOf('M')) >= 0) {
+               mMinutes = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of minutes is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       // parse seconds
+       if ((i = str.indexOf('S')) >= 0) {
+               mSeconds = str.left(i).toInt(&ok);
+               if (!ok) {
+                       qCritical() << "Invalid duration: number of seconds is not a valid integer";
+                       return false;
+               }
+               str.remove(0, i + 1);
+       }
+
+       if (!str.isEmpty()) {
+               qCritical() << "Invalid duration: string format not canonical";
+               return false;
+       }
+
+       return true;
 }
 
 QString Duration::constructLexicalRepresentation()
 {
-    QString str;
-
-    if (mYears == 0 && mMonths == 0 && mDays == 0 && mHours == 0 && mMinutes == 0 && mSeconds == 0) {
-        // special case: zero duration
-        return "P0D";
-    }
-
-    if (!mIsPositive) {
-        str = "-P";
-    } else {
-        str = "P";
-    }
-
-    if (mYears > 0) {
-        str += QString::number(mYears);
-        str += 'Y';
-    }
-
-    if (mMonths > 0) {
-        str += QString::number(mMonths);
-        str += 'M';
-    }
-
-    if (mDays > 0) {
-        str += QString::number(mDays);
-        str += 'D';
-    }
-
-    if (mHours == 0 && mMinutes == 0 && mSeconds == 0) {
-        // no time section needed
-        return str;
-    }
-
-    str += 'T';
-    if (mHours > 0) {
-        str += QString::number(mHours);
-        str += 'H';
-    }
-
-    if (mMinutes > 0) {
-        str += QString::number(mMinutes);
-        str += 'M';
-    }
-
-    if (mSeconds > 0) {
-        str += QString::number(mSeconds);
-        str += 'S';
-    }
-
-    return str;
+       QString str;
+
+       if (mYears == 0 && mMonths == 0 && mDays == 0 && mHours == 0 && mMinutes == 0 && mSeconds == 0) {
+               // special case: zero duration
+               return "P0D";
+       }
+
+       if (!mIsPositive) {
+               str = "-P";
+       } else {
+               str = "P";
+       }
+
+       if (mYears > 0) {
+               str += QString::number(mYears);
+               str += 'Y';
+       }
+
+       if (mMonths > 0) {
+               str += QString::number(mMonths);
+               str += 'M';
+       }
+
+       if (mDays > 0) {
+               str += QString::number(mDays);
+               str += 'D';
+       }
+
+       if (mHours == 0 && mMinutes == 0 && mSeconds == 0) {
+               // no time section needed
+               return str;
+       }
+
+       str += 'T';
+       if (mHours > 0) {
+               str += QString::number(mHours);
+               str += 'H';
+       }
+
+       if (mMinutes > 0) {
+               str += QString::number(mMinutes);
+               str += 'M';
+       }
+
+       if (mSeconds > 0) {
+               str += QString::number(mSeconds);
+               str += 'S';
+       }
+
+       return str;
 }
index f49df70162dba527ae2048426c669367e638bced..7c32ecf072c3ae478d178759212978ab777cdfb0 100644 (file)
 #define PROPERTY__ZONENUMBER           "http://smart-api.io/ontology/1.0/smartapi#zoneNumber"
 #define PROPERTY__ZONEROUTE            "http://smart-api.io/ontology/1.0/smartapi#zoneRoute"
 
+#define PROPERTY__VOUCHER              "http://smart-api.io/ontology/1.0/smartapi#voucher"
+
 #endif //__PROPERTY_H__
index 6ecaf3a431484cf7da2f0bcef393f63de7d92329..e44f08e723676b7b3fadec7ee35419f29c0efd59 100644 (file)
 #define RESOURCE__UNIT_POINT           "http://data.nasa.gov/qudt/owl/unit#Point"
 #define RESOURCE__UNKNOWN              "http://www.w3.org/2006/vcard/ns#Unknown"
 #define RESOURCE__UNSUBSCRIBE          "http://smart-api.io/ontology/1.0/smartapi#Unsubscribe"
-#define RESOURCE__UPS          "http://purl.org/goodrelations/v1#UPS"
-#define RESOURCE__URI          "http://purl.org/dc/terms/URI"
+#define RESOURCE__UPS          "http://purl.org/goodrelations/v1#UPS"
+#define RESOURCE__URI          "http://purl.org/dc/terms/URI"
 #define RESOURCE__URUGUAYPESO          "http://data.nasa.gov/qudt/owl/unit#UruguayPeso"
 #define RESOURCE__USDOLLAR             "http://data.nasa.gov/qudt/owl/unit#USDollar"
 #define RESOURCE__USDOLLAR_NEXTDAY             "http://data.nasa.gov/qudt/owl/unit#USDollar-NextDay"
 #define RESOURCE__ZONETRAVELDEPENDENTPRICESPECIFICATION                "http://smart-api.io/ontology/1.0/smartapi#ZoneTravelDependentPriceSpecification"
 #define RESOURCE__ZONETRAVELDURATIONDEPENDENTPRICESPECIFICATION                "http://smart-api.io/ontology/1.0/smartapi#ZoneTravelDurationDependentPriceSpecification"
 
+#define RESOURCE__VOUCHER              "http://smart-api.io/ontology/1.0/smartapi#Voucher"
+
 #endif //__RESOURCE_H__
index 8932e0e9f627227936cdd80f630c8a6b5029477b..4649b49eaf744332105e031204dd2ba19dfafe66 100755 (executable)
@@ -8,7 +8,7 @@
 Condition::Condition(QString uri) : Obj(uri)
 {
        setType(RESOURCE__CONDITION);
-       INIT_PROPERTY(mTemporalContext)
+       INIT_PROPERTY(mValidity)
        INIT_PROPERTYLIST(mActions, PROPERTY__ACTION)
        INIT_PROPERTYLIST(mOrs, PROPERTY__OR)
        INIT_PROPERTYLIST(mXors, PROPERTY__XOR)
@@ -24,7 +24,7 @@ Condition::Condition(QString uri) : Obj(uri)
        
 Condition::Condition(Condition* c) : Obj(c)
 {
-       SET_PROPERTY_REFERENCE(PROPERTY__TEMPORALCONTEXT, mTemporalContext, TemporalContext)
+       SET_PROPERTY_REFERENCE(PROPERTY__VALID, mValidity, Validity)
        SET_PROPERTYLIST_REFERENCE(PROPERTY__ACTION, mActions, Variant)
        SET_PROPERTYLIST_REFERENCE(PROPERTY__OR, mOrs, Variant)
        SET_PROPERTYLIST_REFERENCE(PROPERTY__XOR, mXors, Variant)
@@ -45,13 +45,13 @@ Condition::~Condition()
 
 void Condition::clearReferences(QSet<GraphItem*>* trash)
 {
-       INIT_CLEAR(Obj,trash);
-       FINISH_CLEAR(Obj,trash);
+       INIT_CLEAR(Obj, trash);
+       FINISH_CLEAR(Obj, trash);
 }
 
 Resource* Condition::serialize(Model* model)
 {
-       INIT_SERIALIZE(Obj,model)
+       INIT_SERIALIZE(Obj, model)
        FINISH_SERIALIZE(Obj)
 }
 
@@ -69,6 +69,6 @@ void Condition::parse(Statement* statement)
        PARSE_PROPERTY(PROPERTY__LESSEROREQUAL, addLesserOrEqual, Variant)
        PARSE_PROPERTY(PROPERTY__GREATER, addGreater, Variant)
        PARSE_PROPERTY(PROPERTY__GREATEROREQUAL, addGreaterOrEqual, Variant)
-       PARSE_PROPERTY(PROPERTY__TEMPORALCONTEXT, setTemporalContext, TemporalContext)
+       PARSE_PROPERTY(PROPERTY__VALID, setValidity, Validity)
        FINISH_PARSE(Obj)
 }
index d5ca9b373ca68db50cc5fb12d1764d00f2ed5f74..eeb5a2fb7bb323d688ea94f409ba36eca0b9445c 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "smartapi/common/RESOURCE.h"
 #include "smartapi/model/Obj.h"
-#include "smartapi/model/TemporalContext.h"
+#include "smartapi/model/Validity.h"
 #include "smartapi/rdf/Variant.h"
 #include "smartapi/rdf/Model.h"
 #include "smartapi/rdf/Resource.h"
@@ -92,15 +92,15 @@ public:
        void addGreaterOrEqual(Variant* variant)    { mGreaterOrEquals.append(variant); }
        void removeGreaterOrEqual(Variant* variant) { mGreaterOrEquals.removeOne(variant); }
 
-       bool hasTemporalContext()                                                                                               { return (mTemporalContext != NULL); }
-       TemporalContext* getTemporalContext()                                                                   { return mTemporalContext; }
-       void setTemporalContext(TemporalContext* temporalContext)                               { add(PROPERTY__TEMPORALCONTEXT, temporalContext); mTemporalContext = temporalContext; }
-       void setTemporalContext(QDateTime start)                                                                { setTemporalContext(new TemporalContext(start)); }
-       void setTemporalContext(QDateTime start, QDateTime end)                                 { setTemporalContext(new TemporalContext(start, end)); }
-       void setTemporalContext(QDateTime start, QDateTime end, QString during) { setTemporalContext(new TemporalContext(start, end, during)); }
+       bool hasTemporalContext()                                                                                               { return (mValidity != NULL); }
+       Validity* getTemporalContext()                                                                                  { return mValidity; }
+       void setValidity(Validity* v)                                                                                   { add(PROPERTY__VALID, v); mValidity = v; }
+       void setValidity(QDateTime start)                                                                               { setValidity(new Validity(start)); }
+       void setValidity(QDateTime start, QDateTime end)                                                { setValidity(new Validity(start, end)); }
+       void setValidity(QDateTime start, QDateTime end, QString during)                { setValidity(new Validity(start, end, during)); }
 
 private:
-       TemporalContext* mTemporalContext;
+       Validity* mValidity;
        PropertyList<Variant*> mActions;
        PropertyList<Variant*> mOrs;
        PropertyList<Variant*> mXors;
index f7417a820188a41f14b7b392ac1bd0cabb4452a9..ee270f6ae6fc121917d9c1cf1f1c6ec1f7772cb1 100755 (executable)
@@ -3,7 +3,7 @@
 #include "smartapi/common/PROPERTY.h"
 #include "smartapi/common/RESOURCE.h"
 #include "smartapi/common/Tools.h"
-#include "smartapi/model/PriceSpecification.h"
+#include "smartapi/model/UnitPriceSpecification.h"
 #include "smartapi/model/SomeItems.h"
 
 
@@ -59,3 +59,11 @@ void Offering::parse(Statement* statement)
        PARSE_PROPERTY(PROPERTY__INCLUDESOBJECT, addTypeAndQuantityNode, TypeAndQuantityNode)
        FINISH_PARSE(GrObj)
 }
+
+void Offering::addPrice(float price, QString unit, QString secondaryUnit,
+                       QString secondaryQuantity, QDateTime validFrom,
+                       QDateTime validThrough) {
+       addPriceSpecification(new UnitPriceSpecification(price, unit, secondaryUnit, secondaryQuantity, validFrom, validThrough));
+}
+
+
index 88fc523be29a4c0e3afede5907b6a71057d0e967..bee6f1d5c619e69b406386379173df26dd8d7b17 100644 (file)
@@ -3,10 +3,11 @@
 
 #include "smartapi/model/GrObj.h"
 #include "smartapi/model/TypeAndQuantityNode.h"
-#include "smartapi/model/UnitPriceSpecification.h"
 #include "smartapi/rdf/PropertyList.h"
 
 class SomeItems;
+class PriceSpecification;
+class UnitPriceSpecification;
 
 class Offering : public GrObj
 {
@@ -30,7 +31,7 @@ public:
        PropertyList<PriceSpecification*> getPriceSpecification()                       { return mPriceSpecifications; }
        void addPrice(float price, QString unit, QString secondaryUnit,
                                QString secondaryQuantity, QDateTime validFrom,
-                               QDateTime validThrough)                                                                 { addPriceSpecification(new UnitPriceSpecification(price, unit, secondaryUnit, secondaryQuantity, validFrom, validThrough)); }
+                               QDateTime validThrough);
 
        bool hasIncludes()                                                                                                      { return !mIncludes.isEmpty(); }
        void addIncludes(SomeItems* someItem)                                                           { mIncludes.append(someItem); }
@@ -43,7 +44,7 @@ public:
        void addItem(Obj* item, float amount, QString unitOfMeasurement,
                                QString name, QString description)                                              { addTypeAndQuantityNode(new TypeAndQuantityNode(item, amount, unitOfMeasurement, name, description)); }
 
-private:
+protected:
        Variant* mBusinessFunction;
        PropertyList<PriceSpecification*> mPriceSpecifications;
        PropertyList<SomeItems*> mIncludes;
index b6b71a5f76c94d3c6a8761aabd82323e3b53558b..2617afc0b4b75e7a6ab3ddf74269562ecfddedeb 100755 (executable)
@@ -1,6 +1,8 @@
 #include "PriceSpecification.h"
 #include "smartapi/common/PROPERTY.h"
 #include "smartapi/common/Tools.h"
+#include "smartapi/model/Voucher.h"
+#include "smartapi/model/Condition.h"
 
 PriceSpecification::PriceSpecification(QString identifierUri)
        : GrObj(identifierUri)
@@ -19,6 +21,8 @@ PriceSpecification::PriceSpecification(QString identifierUri)
        INIT_PROPERTY(mUnit)
        INIT_PROPERTY(mSecondaryQuantity)
        INIT_PROPERTY(mSecondaryUnit)
+       INIT_PROPERTY(mVoucher)
+       INIT_PROPERTY(mCondition)
        setQuantity(RESOURCE__CURRENCY);
 }
 
@@ -39,6 +43,8 @@ PriceSpecification::PriceSpecification(float price, QString unit, QString second
        INIT_PROPERTY(mUnit)
        INIT_PROPERTY(mSecondaryQuantity)
        INIT_PROPERTY(mSecondaryUnit)
+       INIT_PROPERTY(mVoucher)
+       INIT_PROPERTY(mCondition)
        setQuantity(RESOURCE__CURRENCY);
        setCurrencyValue(price);
        setUnit(unit);
@@ -50,19 +56,21 @@ PriceSpecification::PriceSpecification(float price, QString unit, QString second
 
 PriceSpecification::PriceSpecification(PriceSpecification* o) : GrObj(o)
 {
-       SET_PROPERTY_REFERENCE(PROPERTY__HASCURRENCY,mCurrency,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__HASCURRENCYVALUE,mCurrencyValue,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__VALIDFROM,mValidFrom,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__VALIDTHROUGH,mValidThrough,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__VALUEADDEDTAXINCLUDED,mValueAddedTaxIncluded,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__VATPERCENTAGE,mVatPercentage,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__FIXEDMARKUP,mFixedMarkup,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__PERCENTAGEMARKUP,mPercentageMarkup,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__PERCENTAGEMARGIN,mPercentageMargin,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__QUANTITYKIND,mQuantity,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__UNIT,mUnit,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__SECONDARYQUANTITYKIND,mSecondaryQuantity,Variant);
-       SET_PROPERTY_REFERENCE(PROPERTY__SECONDARYUNIT,mSecondaryUnit,Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__HASCURRENCY, mCurrency, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__HASCURRENCYVALUE, mCurrencyValue, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__VALIDFROM, mValidFrom, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__VALIDTHROUGH, mValidThrough, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__VALUEADDEDTAXINCLUDED, mValueAddedTaxIncluded, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__VATPERCENTAGE, mVatPercentage, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__FIXEDMARKUP, mFixedMarkup, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__PERCENTAGEMARKUP, mPercentageMarkup, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__PERCENTAGEMARGIN, mPercentageMargin, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__QUANTITYKIND, mQuantity, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__UNIT, mUnit, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__SECONDARYQUANTITYKIND, mSecondaryQuantity, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__SECONDARYUNIT, mSecondaryUnit, Variant);
+       SET_PROPERTY_REFERENCE(PROPERTY__VOUCHER, mVoucher, Voucher);
+       SET_PROPERTY_REFERENCE(PROPERTY__CONDITION, mCondition, Condition);
        setType(RESOURCE__PRICESPECIFICATION);
 }
 
@@ -98,5 +106,7 @@ void PriceSpecification::parse(Statement* statement)
        PARSE_PROPERTY(PROPERTY__UNIT, setUnit, Variant)
        PARSE_PROPERTY(PROPERTY__SECONDARYQUANTITYKIND, setSecondaryQuantity, Variant)
        PARSE_PROPERTY(PROPERTY__SECONDARYUNIT, setSecondaryUnit, Variant)
+       PARSE_PROPERTY(PROPERTY__VOUCHER, setVoucher, Voucher)
+       PARSE_PROPERTY(PROPERTY__CONDITION, setCondition, Condition)
        FINISH_PARSE(GrObj)
 }
index 8054671c333e2b784ebb5e7155ee26299d7e9643..21e2d97b5441458a486dad72769499c2800d0f77 100644 (file)
@@ -2,6 +2,8 @@
 #define _PRICESPECIFICATION_H_
 
 #include "smartapi/model/GrObj.h"
+#include "smartapi/model/Voucher.h"
+#include "smartapi/model/Condition.h"
 
 class Variant;
 
@@ -87,6 +89,14 @@ public:
        void setSecondaryUnit(QString unit)                                             { if (unit.length() > 0) setSecondaryUnit(QUrl(unit)); }
        void setSecondaryUnit(QUrl unit)                                                        { setSecondaryUnit(new Variant(unit)); }
 
+       bool hasVoucher()                                                                                       { return mVoucher != NULL; }
+       void setVoucher(Voucher* v)                                                                     { add(PROPERTY__VOUCHER, v); mVoucher = v; }
+       Voucher* getVoucher()                                                                           { return mVoucher; }
+
+       bool hasCondition()                                                                                     { return mCondition != NULL; }
+       void setCondition(Condition* c)                                                         { add(PROPERTY__CONDITION, c); mCondition = c; }
+       Condition* getCondition()                                                                       { return mCondition; }
+
        virtual bool isTimeDependent() { return false; };
 
 private:
@@ -103,6 +113,8 @@ private:
        Variant* mFixedMarkup;
        Variant* mPercentageMarkup;
        Variant* mPercentageMargin;
+       Voucher* mVoucher;
+       Condition* mCondition;
 };
 
 #endif // _PRICESPECIFICATION_H_
index ad6719ab2bc8a0a0943cc0280483a644a02f9825..8eac242ea27eab67aecab4c54954fe589997c03d 100755 (executable)
@@ -16,6 +16,7 @@ TemporalContext::TemporalContext() :
        setType(RESOURCE__TEMPORALCONTEXT);
        INIT_PROPERTY(mStart)
        INIT_PROPERTY(mEnd)
+       INIT_PROPERTY(mCount)
        INIT_PROPERTY(mDuration)
        INIT_PROPERTY(mDuring)
 }
@@ -26,6 +27,7 @@ TemporalContext::TemporalContext(QString uri) :
        setType(RESOURCE__TEMPORALCONTEXT);
        INIT_PROPERTY(mStart)
        INIT_PROPERTY(mEnd)
+       INIT_PROPERTY(mCount)
        INIT_PROPERTY(mDuration)
        INIT_PROPERTY(mDuring)
 }
@@ -64,6 +66,7 @@ TemporalContext::TemporalContext(TemporalContext* t) : Obj(t)
 {
        SET_PROPERTY_REFERENCE(PROPERTY__START, mStart, Variant)
        SET_PROPERTY_REFERENCE(PROPERTY__END, mEnd, Variant)
+       SET_PROPERTY_REFERENCE(PROPERTY__COUNT, mCount, Variant)
        SET_PROPERTY_REFERENCE(PROPERTY__DURATION, mDuration, Variant)
        SET_PROPERTY_REFERENCE(PROPERTY__DURING, mDuring, Variant)
        setType(RESOURCE__TEMPORALCONTEXT);
@@ -90,6 +93,7 @@ void TemporalContext::parse(Statement* statement)
        INIT_PARSE(statement)
        PARSE_PROPERTY(PROPERTY__START, setStart, Variant)
        PARSE_PROPERTY(PROPERTY__END, setEnd, Variant)
+       PARSE_PROPERTY(PROPERTY__COUNT, setCount, Variant)
        PARSE_PROPERTY(PROPERTY__DURATION, setDuration, Variant)
        PARSE_PROPERTY(PROPERTY__DURING, setDuring, Variant)
        FINISH_PARSE(Obj)
index 3ad962c66cfb0280378224bfe7b1e2c5f3020728..56455fa71aa203610560e2bb2942cb2baaf0cec2 100644 (file)
@@ -47,7 +47,7 @@ public:
        bool hasCount()                                         { return mCount != NULL; }
        int getCount()                                          { PROPERTYVAL(mCount, asInt, -1); }
        void setCount(Variant* c)                       { add(PROPERTY__COUNT, c); mCount = c; }
-       void setCount(int _count)                       { setDuring(new Variant(_count)); }
+       void setCount(int _count)                       { setCount(new Variant(_count)); }
 
        bool hasDuration()                                      { return mDuration != NULL; }
        QString getDuration()                           { PROPERTYVAL(mDuration, asString, QString()); }
index 0b5f2c9003deff6e9a7b48b9d24fd4bf2a666aaa..1226ed527e38450a6dd3f148aa9f6ac87b6a8447 100755 (executable)
@@ -1,48 +1,57 @@
-#include "Waypoint.h"
+#include "Validity.h"
 #include "smartapi/common/PROPERTY.h"
-#include "smartapi/common/Tools.h"
-#include "smartapi/rdf/List.h"
 
-Waypoint::Waypoint() :
+
+Validity::Validity() :
        Obj()
 {
-       setType(RESOURCE__WAYPOINT);
-       INIT_PROPERTY(mCoordinates)
-       INIT_PROPERTY(mAddress)
-       INIT_PROPERTY(mRoute)
+       setType(RESOURCE__VALIDITY);
+       INIT_PROPERTY(mTemporalContext);
+}
+
+Validity::Validity(QDateTime start, QDateTime end) :
+       Validity()
+{
+       setTemporalContext(start, end);
+}
+
+Validity::Validity(QDateTime start, QDateTime end, QString during) :
+       Validity()
+{
+       setTemporalContext(start, end, during);
+}
+
+Validity::Validity(QDateTime start) :
+       Validity()
+{
+       setTemporalContext(start);
 }
 
-Waypoint::Waypoint(Waypoint* w) : Obj(w)
+Validity::Validity(Validity* v) : Obj(v)
 {
-       SET_PROPERTY_REFERENCE(PROPERTY__LOCATION, mCoordinates, Coordinates)
-       SET_PROPERTY_REFERENCE(PROPERTY__HASADDRESS, mAddress, Address)
-       SET_PROPERTY_REFERENCE(PROPERTY__INSTANT, mInstant, Variant)
-       SET_PROPERTY_REFERENCE(PROPERTY__ROUTE, mRoute, Route)
-       setType(RESOURCE__WAYPOINT);
+       setType(RESOURCE__VALIDITY);
+       SET_PROPERTY_REFERENCE(PROPERTY__TEMPORALCONTEXT, mTemporalContext, TemporalContext)
 }
 
-Waypoint::~Waypoint()
+Validity::~Validity()
 {
 }
 
-void Waypoint::clearReferences(QSet<GraphItem*>* trash)
+void Validity::clearReferences(QSet<GraphItem*>* trash)
 {
        INIT_CLEAR(Obj,trash);
        FINISH_CLEAR(Obj,trash);
 }
 
-Resource* Waypoint::serialize(Model* model)
+Resource* Validity::serialize(Model* model)
 {
        INIT_SERIALIZE(Obj,model)
        FINISH_SERIALIZE(Obj)
 }
 
-void Waypoint::parse(Statement* statement)
+void Validity::parse(Statement* statement)
 {
        INIT_PARSE(statement)
-       PARSE_PROPERTY(PROPERTY__LOCATION, setCoordinates, Coordinates)
-       PARSE_PROPERTY(PROPERTY__HASADDRESS, setAddress, Address)
-       PARSE_PROPERTY(PROPERTY__INSTANT, setInstant, Variant)
-       PARSE_PROPERTY(PROPERTY__ROUTE, setRoute, Route)
+       PARSE_PROPERTY(PROPERTY__TEMPORALCONTEXT, setTemporalContext, TemporalContext)
        FINISH_PARSE(Obj)
 }
index cf4e3a8da4d4af5e785aa9ca93af7d0a3af8e26e..0490d0ec4a240f207e504034ef8a6ad05550cb9e 100644 (file)
@@ -1,49 +1,35 @@
-#ifndef _WAYPOINT_H_
-#define _WAYPOINT_H_
+#ifndef _VALIDITY_H_
+#define _VALIDITY_H_
 
-#include "smartapi/model/Coordinates.h"
-#include "smartapi/model/Address.h"
-#include "smartapi/model/Route.h"
-#include "smartapi/rdf/Resource.h"
-#include "smartapi/rdf/Statement.h"
-#include "smartapi/rdf/Model.h"
+#include "smartapi/model/Obj.h"
+#include "smartapi/model/TemporalContext.h"
 
-#include <QString>
-#include <QDateTime>
-
-class Waypoint : public Obj
+class Validity : public Obj
 {
 public:
-       Waypoint();
-       Waypoint(Waypoint* l);
-       ~Waypoint();
+       Validity();
+       Validity(Validity* l);
+       Validity(QDateTime mStart, QDateTime mEnd);
+       Validity(QDateTime mStart, QDateTime mEnd, QString mDuring);
+       Validity(QDateTime mStart);
+       ~Validity();
 
        Resource* serialize(Model* model);
        void parse(Statement* statement);
        void clearReferences(QSet<GraphItem*>* trash);
        
-       Coordinates* getCoordinates()                   { return mCoordinates; }
-       bool hasCoordinates()                                   { return (mCoordinates != NULL); }
-       void setCoordinates(Coordinates* l)             { add(PROPERTY__LOCATION, l); mCoordinates = l; }
-
-       Address* getAddress()                                   { return mAddress; }
-       bool hasAddress()                                               { return (mAddress != NULL); }
-       void setAddress(Address* l)                             { add(PROPERTY__HASADDRESS, l); mAddress = l; }
-       
-       QDateTime getInstant()                                  { PROPERTYVAL(mInstant, asDateTime, QDateTime()); }
-       bool hasInstant()                                               { return mInstant != NULL; }
-       void setInstant(Variant* l)                             { set(PROPERTY__INSTANT, l); mInstant = l; }
-       void setInstant(QDateTime l)                    { setInstant(new Variant(l)); }
-
-       Route* getRoute()                                               { return mRoute; }
-       bool hasRoute()                                                 { return (mRoute != NULL); }
-       void setRoute(Route* l)                                 { add(PROPERTY__ROUTE, l); mRoute = l; }
+       bool hasTemporalContext()                                                                       { return (mTemporalContext != NULL); }
+       TemporalContext* getTemporalContext()                                           { return mTemporalContext; }
+       void setTemporalContext(TemporalContext* temporalContext)       { set(PROPERTY__TEMPORALCONTEXT, temporalContext); mTemporalContext = temporalContext; }
+       void setTemporalContext(QDateTime start, QDateTime end)         { setTemporalContext(new TemporalContext(start, end)); }
+       void setTemporalContext(QDateTime start, QDateTime end, QString during) { setTemporalContext(new TemporalContext(start, end, during)); }
+       void setTemporalContext(QDateTime start)                                        { setTemporalContext(new TemporalContext(start)); }
+       void setTemporalContext(QTime start, QTime end)                         { setTemporalContext(new TemporalContext(start, end)); }
+       void setTemporalContext(QTime start, QTime end, QString during) { setTemporalContext(new TemporalContext(start, end, during)); }
 
 private:
-       Coordinates* mCoordinates;
-       Address* mAddress;
-       Route* mRoute;
        Variant* mInstant;
+       TemporalContext* mTemporalContext;
 };
 
-#endif // _WAYPOINT_H_
+#endif // _VALIDITY_H_
index 294accb7322f155b715d1f147567abf1402a6600..3e8526c97cc533d342d4437b76fd9b4b059700d3 100644 (file)
@@ -12,7 +12,7 @@
 class Velocity : public Obj
 {
 public:
-    Velocity();
+       Velocity();
        Velocity(Velocity* s);
        ~Velocity();
 
index 4ee26cdcb6356dfebb87d232d7723fa15b39c2f3..1515af0444ed1be17180761798f2330d57281fbd 100644 (file)
@@ -24,4 +24,4 @@ private:
        Variant* mMaxAvailable;
 };
 
-#endif // _OFFERING_H_
+#endif // _VOUCHER_H_
index ffce29679d3d3750653b42925e59b85097d33b48..42361d87895ed29110f017473818f05a77cdcb90 100644 (file)
@@ -3060,10 +3060,12 @@ bool priceSpecificationTimeDependentSerializeParseTest()
        TimeDependentPriceSpecification* ps = new TimeDependentPriceSpecification();
        ps->setValidFrom(QDateTime::currentDateTime());
        Condition* c = new Condition();
+       Validity* validity = new Validity();
        TemporalContext* tcx = new TemporalContext();
        tcx->setStart(QTime::currentTime());
 
-       c->setTemporalContext(tcx);
+       validity->setTemporalContext(tcx);
+       c->setValidity(validity);
        c->addAction(new Variant(10));
        ps->addCondition(c);
 
index 6dde24c5b82de76dea96d59ce88b20d6010ee4ad..60a079d3ecc6b48959ae3adc051bd2268f1a443d 100644 (file)
@@ -84,7 +84,7 @@ public class SearchAgent {
                                                Tools.printErrors(response);
                                        }
                                        if ( response.hasActivity() ) {
-                                               return response.getFirstActivity().getEntities();                                               
+                                               return response.getFirstActivity().getEntities();
                                        } else {
                                                return null;
                                        }
@@ -98,7 +98,7 @@ public class SearchAgent {
                                
                        } catch(Exception e) {
                                System.err.println("Exception while sending an HTTP request to " + SearchAgent.serverUri);
-                               e.printStackTrace();    
+                               e.printStackTrace();
                                return null;
                        }
 
@@ -547,7 +547,7 @@ public class SearchAgent {
                maxR.setUnit(RESOURCE.KILOMETER);
                maxR.setValue(new Variant(maxRadius));
                ring.setMaxRadius(maxR);
-               entity.add(NS.SMARTAPI + "ring", ring);         
+               entity.add(NS.SMARTAPI + "ring", ring);
        }
 
        public void clearSearchArea()
@@ -587,6 +587,5 @@ public class SearchAgent {
        {
                return SearchAgent.serverUri;
        }
-
-
 }
+
index 4c799f2cd2ed15fa11b1df8cd9c533b24688608e..6c6351f4655a274839a708cace6053c23e686411 100755 (executable)
@@ -264,7 +264,7 @@ class SampleDataService(BaseHTTPRequestHandler):
                        iface = activity.getInterfaces()[0]
                        print "Will send data to", iface.getHost().asString()
                        n = Notifier(iface)
-                       n.run()
+                       #n.run()
                
                else:
                        print "Error: cannot subscribe without inteface data"
@@ -284,9 +284,18 @@ class SampleDataService(BaseHTTPRequestHandler):
                return Tools.serializeResponse(response)[0]
                
        def handleTimeseriesRequest(self, activity, request):
-               start = activity.temporalContext.start.asDateTime()
-               end =  activity.temporalContext.end.asDateTime()
-               print "Timeseries request from ", start, "to", end
+               start = None
+               end = None
+               count = None
+               
+               if activity.temporalContext.hasStart():
+                       start = activity.temporalContext.start.asDateTime()
+               if activity.temporalContext.hasEnd():
+                       end =  activity.temporalContext.end.asDateTime()
+               if activity.temporalContext.hasCount():
+                       count = activity.temporalContext.count.asInt()
+                       
+               print "Timeseries request from", start, "to", end, "(count", count, ")"
 
                # For the client to recognize from which activity this result is, the response
                # activity will carry the same identifier that was in the request
@@ -298,13 +307,15 @@ class SampleDataService(BaseHTTPRequestHandler):
                for instance be a result from a database query,
                """
                time_series = TimeSeries()
-               while start < end:
+               i = 0
+               while (end is not None and start < end) or (count is not None and i < count):
                        value_object = ValueObject()
                        value_object.setInstant(start)
                        value_object.setValue(random.randint(100, 400))
                        
                        time_series.addListItem(value_object)
                        start = start + datetime.timedelta(hours=1)
+                       i = i+1
                        
                # Add timeseries to respose activity
                response_activity.addTimeSerie(time_series)
index c19ce74055f6f481aa4283bafd69f6ae33b0dc15..e3642c7e286cedc8146521a61afeef9a2c96e771 100644 (file)
@@ -100,7 +100,7 @@ smartapi:PriceTypeMargin a owl:Class ;
   rdfs:isDefinedBy smartapi:TradingOntology ;
   vs:term_status "testing".
   
-
+  
 # balance
 
 smartapi:initialBalance a owl:DatatypeProperty ;
@@ -231,6 +231,7 @@ smartapi:currency a owl:ObjectProperty ;
   rdfs:isDefinedBy smartapi:TradingOntology ;
   vs:term_status "testing" .
 
+
 # references
 
 smartapi:reference a owl:DatatypeProperty ;
@@ -290,7 +291,7 @@ smartapi:AccountTransaction a owl:Class ;
   rdfs:comment "A transaction that relates to an account."@en ;
   vs:term_status "testing" ;
   rdfs:subClassOf smartapi:Object ;
-  rdfs:isDefinedBy smartapi:TradingOntology.   
+  rdfs:isDefinedBy smartapi:TradingOntology.
   
 smartapi:accountTransaction a owl:ObjectProperty;
   rdfs:range smartapi:AccountTransaction ;
@@ -340,6 +341,20 @@ smartapi:account a owl:ObjectProperty;
   rdfs:isDefinedBy smartapi:TradingOntology ;
   vs:term_status "testing" .
 
+smartapi:Voucher a owl:Class ;
+  rdfs:label "Voucher"@en ;
+  rdfs:comment "A voucher issued to redeem product for a certain price. Effectively this is an offering with a limit on how many offerings can be issued."@en ;
+  rdfs:isDefinedBy smartapi:TradingOntology ;
+  rdfs:subClassOf smartapi:Offering ;
+  vs:term_status "testing".
+
+smartapi:voucher a owl:ObjectProperty;
+  rdfs:range smartapi:Voucher ;
+  rdfs:label "Voucher"@en ;
+  rdfs:comment "The property that links this resource to a Voucher."@en ;
+  rdfs:isDefinedBy smartapi:TradingOntology ;
+  vs:term_status "testing" .
+  
 
 # license