@base         <http://www.w3.org/TR/usdl/functional#> .
@prefix : <#> .
@prefix ctag:    <http://commontag.org/ns#> .
@prefix dcterms:  <http://purl.org/dc/terms/> .
@prefix dctypes:  <http://purl.org/dc/dcmitype/> .
@prefix foaf:    <http://xmlns.com/foaf/0.1/> .
@prefix gr:      <http://purl.org/goodrelations/v1#> .
@prefix msm:     <http://cms-wg.sti2.org/ns/minimal-service-model#> .
@prefix org:     <http://www.w3.org/ns/org#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos:    <http://www.w3.org/2004/02/skos/core#> .
@prefix time:    <http://www.w3.org/2006/time#> .
@prefix usdl-f:  <http://www.w3.org/TR/usdl/foundation#> .
@prefix usdl-func:  <http://www.w3.org/TR/usdl/functional#> .
@prefix usdl-int:  <http://www.w3.org/TR/usdl/interaction#> .
@prefix usdl-legal:  <http://www.w3.org/TR/usdl/legal#> .
@prefix usdl-part:  <http://www.w3.org/TR/usdl/participants#> .
@prefix usdl-price:  <http://www.w3.org/TR/usdl/pricing#> .
@prefix usdl-sl:  <http://www.w3.org/TR/usdl/service-level#> .
@prefix vcard:   <http://www.w3.org/2006/vcard/ns#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

<http://www.w3.org/TR/usdl/functional>
      rdf:type owl:Ontology ;
      rdfs:label "Functional module of USDL v3 M5" ;
      dcterms:contributor :Torsten_Leidig ;
      dcterms:created "2011-04-18"^^xsd:date ;
      dcterms:creator :Torsten_Leidig ;
      dcterms:description "Functional module of USDL" ;
      dcterms:modified "2011-03-29"^^xsd:date ;
      owl:versionInfo "0.1" .

:Torsten_Leidig
      rdf:type foaf:Person ;
      foaf:name "Torsten Leidig";
      foaf:title "Dr";
      foaf:firstName "Torsten";
      foaf:phone "+49 6227 7 52535";
      foaf:lastName "Leidig" .

:Function 
	rdf:type rdfs:Class ;
	rdfs:label "function" ;
	rdfs:comment "Function is used to capture an informal description of what the service does, i.e., its core functionality. A Function is an entity of activity that is performed by an actor (agent). Functions that are available to external parties, e.g. partners in a business network, are understood as capabilities. In this context a Function expresses the ability to perform a course of action, which ultimately constitutes the service rendered to the consumer. Hence, a Service has to have at least one capability; otherwise it cannot be considered a service.<br>Apart from this mandatory requirement, USDL offers much flexibility in describing the conceptual side of a service. Functions can be decomposed explicitly into lower-level function blocks (sub-functions), with the possibility to include descriptions of input/output parameters, faults and conditions on each layer. If such a grey-box view is not desired, a traditional black-box approach can be taken (only describing top-level functions, i.e. capabilities). Alternatively, USDL also offers a way to provide a white-box view using the artifact concept to include a link to an external, possibly complete, specification of the function’s implementation.<br> Furthermore, functions may be associated with resource descriptions in order to capture information about the resource objects upon which actors operate during service execution (rendering of capabilities), e.g., which they transform or manipulate in terms of appearance, state, etc. This might also involve other resources, which are utilized during operation, e.g. as tools.
" ;
	rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> .

:Parameter 
	rdf:type rdfs:Class ;
	rdfs:label "parameter" ;
	rdfs:comment "Parameter is used to capture conceptual input to and output of functions. Parameters, on the one hand, may be something very vague, like an idea. On the other hand, they can be something specific, such as the architecture blueprint of a building." ;
	rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> .

:Condition 
	rdf:type rdfs:Class ;
	rdfs:label "condition" ;
	rdfs:comment "The class of conditions for a function. Preconditions or postcondition" ;
	rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> .

:Fault 
	rdf:type rdfs:Class ;
	rdfs:label "fault" ;
	rdfs:comment "Fault is used to capture information about conceptual faults/exceptions that may occur when a function is performed." ;
	rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> .

:FunctionalOption 
	rdf:type rdfs:Class ;
	rdf:subClassOf usdl-f:Option;
	rdfs:label "functional option" ;
	rdfs:comment "FunctionalOption is a concrete service option that defines a subset from the overall functionality offered by a service, i.e. a subset of the service’s capabilities." ;
	rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> .

# Properties

:hasInput
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Input parameters required to perform the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "input paramter"@en ;
      rdfs:range :Parameter .

:hasOutut
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Output parameters required to perform the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "output paramter"@en ;
      rdfs:range :Parameter .

# hasSubfunction could also be modeled as usdl-serv:hasPartTransitive

:hasFunction
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Functional building blocks of a service" ;
      rdfs:domain usdl-serv:Service;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/service> ;
      rdfs:label "has function" ;
      rdfs:range :Function .

:hasSubfunction
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Functional building blocks (subfunctions) of a function" ;
      rdfs:domain :Function;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/service> ;
      rdfs:label "has subfunction" ;
      rdfs:range :Function;
      rdfs:subPropertyOf usdl-serv:hasPartTransitive .  # can we do this?

:hasPrecondition
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Preconditions to be fulfilled to perform the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "precondition"@en ;
      rdfs:range :Condition .

:hasPostcondition
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Postcondition that holds if the function was performed sucessfully" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "postcondition"@en ;
      rdfs:range :Condition .

:hasFault
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Faults that can occur during the function execution" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "has fault"@en ;
      rdfs:range :Fault .

:affectedVariable
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Variable that is affected by the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "affected variable"@en ;
      rdfs:range :Variable .

:affectedResource
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Resource that is affected by the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "affected resource"@en ;
      rdfs:range usdl-f:Resource .

:utilizedResource
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Resource that is utilized by the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "utilized resource"@en ;
      rdfs:range usdl-f:Resource .

:hasImplementationSpecification
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Link to the formal specification of the service implementation" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "implementation specification"@en ;
      rdfs:range usdl-f:TechnicalMetadata .

:hasExternalInterface
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Reference to a separate (technical) interface that allows to acces the function" ;
      rdfs:domain :Function ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "utilized resource"@en ;
      rdfs:range rdf:Resource . # what is the exact type?


:isOptional
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Indicates whether a parameter is optional or mandatory" ;
      rdfs:domain :Parameter ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "optional"@en ;
      rdfs:range xsd:boolean . # is that posible or do I have to use rdfs:Literal?

# name of a parameter is expressed by rdf:label ?


# typeReference is a bit more complex:

:hasType
      rdf:type owl:ObjectProperty ;
      rdfs:comment "References to the type of the parameter" ;
      rdfs:domain :Parameter ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "has type"@en ;
      rdfs:range usdl-f:TypeReference .
#              [ rdf:type owl:Class ;
#                owl:unionOf (usdl-f:Quantity usdl-f:Amount ) # to be defined
#              ] .
#
# UN/Cefact Core Component Types: amount, binary object, code, date, identifier, indicator,
# numeric, measure, quantity, text
# and derived data types
#
# CCT can have additional attributes. E.g. measure has a decimal value and has attribute
# unitCode and codeListVersion

# quantity, measures, units:
# NASA QUTO Unit Dimension Type ontology could be used but is complex.
# http://www.qudt.org/qudt/owl/1.0.0/unit/index.html
# http://www.qudt.org/qudt/owl/1.0.0/quantity/index.html
# http://www.qudt.org/qudt/owl/1.0.0/qudt/index.html
#
# http://unitsofmeasure.org/
# http://www.xe.com/iso4217.php currency symbols

:includesFunction
      rdf:type owl:ObjectProperty ;
      rdfs:comment "Function that is included by an option" ;
      rdfs:domain :FunctionalOption ;
      rdfs:isDefinedBy <http://www.w3.org/TR/usdl/functional> ;
      rdfs:label "includes function"@en ;
      rdfs:range :Function .

