-
Notifications
You must be signed in to change notification settings - Fork 1
Example snippets
A PricePlan is a set of charges associated with a network-provisioned entity. Alternative sets of fees (i.e. alternative PricePlans) of the same service provision may be made available for the consumer to choose from, for example to offer the consumer the choice between a flat price scheme and a usage-based scheme (a common practice in the telecommunication industry). Several PricePlans may exist for the same service in order to suit different user profiles and charge them appropriately (e.g. heavy- and light-usage users), or as a key price customization instrument to individually match diverse service valuations.
:PricePlan_Enterprise_Subscription
rdf:type usdl-price:PricePlan ;
rdfs:label "An example service Enterprise plan subscription"^^xsd:string ;
usdl-price:hasPriceComponent
:PriceComponent_Web_Hosting ;
usdl-price:hasPriceFloor
[ rdf:type gr:PriceSpecification ;
gr:hasCurrency "USD" ;
gr:hasCurrencyValue "5" ;
gr:hasUnitOfMeasurement
"MON"
] ;
usdl-price:hasPriceCap
[ rdf:type gr:PriceSpecification ;
gr:hasCurrency "USD" ;
gr:hasCurrencyValue "50" ;
gr:hasUnitOfMeasurement
"MON"
] .
This example describes a simple price plan for an enterprise subscription for a web-hosting service. The price plan is limited to a maximum price cap of 50 US Dollars per month, and a minimum fee of 5 USD per month. There is only one PriceComponent used for this plan wich is the price for the web-hosting.
We could add more PriceComponents under the usdl-price:hasPriceComponent
property.
:PricePlan_Premium_Subscription
rdf:type usdl-price:PricePlan ;
rdfs:label "An example service Premium plan subscription"^^xsd:string ;
usdl-price:hasPriceComponent
:PriceComponent_Web_Hosting ,
:PriceComponent_Premium_Support ,
:PriceComponent_Usage_Discount ;
usdl-price:hasPriceFloor
[ rdf:type gr:PriceSpecification ;
gr:hasCurrency "USD" ;
gr:hasCurrencyValue "5" ;
gr:hasUnitOfMeasurement
"MON"
] .
Now we have another plan for the same service, this time for a premium subscription. This price plan does not have any maximum cap but is linked to a new PriceComponent :PriceComponent_Usage_Discount
which is a discount (a subclass of PriceComponent).
PriceComponents are fees included in a PricePlan, which subject to conditions Functions) may contribute to the total amount charged. Components within the same plan are summed together in order to get the total amount (price of the service). Common examples of PriceComponents that may coexist in the same PricePlan are: startup or membership charges (to access the service), periodic subscription fees (with a certain recurrence - e.g. monthly - as long as committed to by the contract), pay-per-unit charges (whose total will be proportional to the metered usage), options or feature dependent charges. The final value of the component will depend on the Variables values (determined by the evaluation of the PriceFunction) and the Price Adjustments that may apply (e.g. discounts).
There are three ways to define a Price for a PriceComponent:
- Simply by specifying the
usdl-price:hasPrice
property with a defined price. (Example 1) - Using the
usdl-price:hasTextFuntion
to express in natural language a price function to calculate the final price. (Example 2) - Using the
Spin:Function
extension to declare a price function that calculates the price based onusdl-price:PriceVariables
. (Example 3)
:PriceComponent_Premium_Support
rdf:type usdl-price:PriceComponent ;
rdfs:label "Premium Support"^^xsd:string ;
usdl-price:hasPrice
[ rdf:type gr:PriceSpecification ;
gr:hasCurrency "USD" ;
gr:hasCurrencyValue "10"^^xsd:string ;
gr:hasUnitOfMeasurement "MON"
] .
In this example we have a Price Component for the Premium Support that costs exactly 10 US Dollars a month. In this case directly defining the price is sufficient. This means that this priceComponent has a static price.
:PriceComponent_Web_Hosting
rdf:type usdl-price:PriceComponent ;
rdfs:label "Usage Discount"^^xsd:string ;
usdl-price:hasTextFuntion
"Number of hosted web-sites * price per hosted web-site"^^xsd:string .
If we want to define a dynamic price the property usdl-price:hasPrice
is not the way to do it. We need to calculate this price based on some other values. Our PriceComponent price is based on two Variables, the number of web-sites the customer wants to host and the price for each web-site hosting.
With the property usdl-price:hasTextFuntion
we can define these kind of price calculations. Note that we use natural language so virtually any kind of price calculation can be used.
:PriceComponent_Web_Hosting
rdf:type usdl-price:PriceComponent ;
rdfs:label "Usage Discount"^^xsd:string ;
usdl-price:hasTextFuntion
"Number of hosted websites * price per hosted web-site"^^xsd:string .
usdl-price:hasPriceFuntion
:Function_Web_Hosting ;
For using the Spin:Function capabilities and define PriceFunction we use the property usdl-price:hasPriceFuntion
which links a Spin:Function
to our PriceComponent. These Function should be the Spin implementation of out PriceFunction defined in the usdl-price:hasTextFuntion
property.
Please refer to the SPIN tutorial for a better explanation of its functionalities.
:Function_Web_Hosting
a spin:Function ;
rdfs:label "Function Web Hosting"^^xsd:string ;
spin:body
[ a sp:Select ;
sp:resultVariables ([ sp:varName "price"^^xsd:string
]) ;
sp:where ([ sp:object
[ sp:varName "a"^^xsd:string
] ;
sp:predicate usdl-price:hasValue ;
sp:subject :Variable_Number_of_WebSites
] [ sp:object
[ sp:varName "websites"^^xsd:string
] ;
sp:predicate <http://purl.org/goodrelations/v1#hasValueFloat> ;
sp:subject
[ sp:varName "a"^^xsd:string
]
] [ sp:object
[ sp:varName "b"^^xsd:string
] ;
sp:predicate usdl-price:hasValue ;
sp:subject :Variable_WebSite_Cost
] [ sp:object
[ sp:varName "priceWS"^^xsd:string
] ;
sp:predicate <http://purl.org/goodrelations/v1#hasValueInteger> ;
sp:subject
[ sp:varName "b"^^xsd:string
]
] [ a sp:Bind ;
sp:expression
[ a sp:mul ;
sp:arg1 [ sp:varName "websites"^^xsd:string
] ;
sp:arg2 [ sp:varName "priceWS"^^xsd:string
]
] ;
sp:variable
[ sp:varName "price"^^xsd:string
]
])
] ;
usdl-price:hasVariable
:Variable_WebSite_Cost , :Variable_Number_of_WebSites .
This is the example for the previous function for the :PriceComponent_Web_Hosting
PriceComponent. Note that in the final two lines we link the two needed variables to the Function itself with the property usdl-price:hasVariable
.
Deduction is a negative price component. The total price will be reduced by a certain amount. Deductions are defined in the same way as any PriceComponent as they are a specialization.
:PriceComponent_Usage_Discount
rdf:type usdl-price:Deduction ;
rdfs:label "Usage Discount"^^xsd:string ;
usdl-price:hasPriceFuntion
:Function_Usage_Discount ;
usdl-price:hasTextFuntion
"If number of hosted web-sites > 5 apply discount of 10%"^^xsd:string .
In this example we have a Deduction which is a special PriceComponent. This deduction specifies that if one user has more than 5 hosted web-sites he has a discount of 10% in the final price. Note that for better comprehension of the price calculation formula we use the property usdl-price:hasTextFuntion
with a natural language description of the expression.
A variable can be used for price function expressions of dynamic price models. It has a name (rdfs:label) and a quantitative value. This quantitative value may not be specified if the variable is not known prior to a user service configuration (e.g. usage variables) Variables can be referred from different price functions.
:Variable_WebSite_Cost
rdf:type usdl-price:Constant ;
rdfs:label "hosting for one Web-Site Cost"^^xsd:string ;
usdl-price:hasValue
[ rdf:type gr:QuantitativeValue ;
gr:hasValueFloat "5.0"^^xsd:float
] .
This is a usdl-price:Constant
definition where a specific value is assigned with the property usdl-price:hasValue
. In this case the cost for hosting one web-site is 5 (No currency was defined). However we can have Usage Variables.
:Variable_Number_of_WebSites
rdf:type usdl-price:Usage ;
rdfs:label "The number of hosted web-sites"^^xsd:string ;
Some variables do not have as assigned value prior to service contracting. Usage Variables as used in this cases. This examples shows an usdl-price:Usage
Variable for storing the total number of web-sites the user needs to be hosted.
These are particularly important in pay-per-use models.