%%ontology
@uses: configOptions
%

%%namespace
dco http://denkbares.com/ConfigOptions/
%


!! Definitions Configuration Options

%%turtle
dco:ConfigOptionAssignment a owl:Class .
dco:hasOption a owl:ObjectProperty .
dco:hasOptionValue a owl:ObjectProperty .
dco:ConfigOption a owl:Class .
dco:ChoiceConfigOption rdfs:subClassOf ConfigOption .
dco:ChoiceValue a owl:Class .
dco:availableChoice a owl:ObjectProperty .

%


!! Definitions Constraints

%%turtle
dco:Constraint a owl:Class .
dco:hasDisjointSet a owl:ObjectProperty .
dco:hasValueA a owl:ObjectProperty .
dco:hasValueB a owl:ObjectProperty .
dco:contradicts a owl:ObjectProperty .

% 


!! Definitions Car configuration set

%%turtle
dco:CarConfigSet a owl:Class.
dco:hasConfigAssignment a owl:ObjectProperty .

%


! Option Engine

%%turtle
dco:Engine a dco:ChoiceConfigOption ; 
	dco:availableChoice dco:SmallEngine, dco:MediumEngine, dco:Turbo .
	
dco:SmallEngine a ChoiceValue .
dco:MediumEngine a ChoiceValue .  
dco:Turbo a ChoiceValue .

%


! Option Hitch

%%turtle
dco:Hitch a dco:ChoiceConfigOption ; 
	dco:availableChoice WithHitch, WithoutHitch .
	
dco:WithHitch a ChoiceValue .
dco:WithoutHitch a ChoiceValue .  

%


! Constraint 1 : Hitch contradicts Small Engine

%%

%%turtle
dco:HitchConstradictsSmallEngine a Constraint ; 
	hasValueA dco:WithHitch;
	hasValueB dco:SmallEngine .

%


!! Car 1

%%turtle
dco:Car1 a CarConfigSet ;
	hasConfigAssignment 
	[ hasOption Engine; hasOptionValue MediumEngine ] ,
	[ hasOption Hitch; hasOptionValue WithHitch] .
%

%%sparql
SELECT ?option ?value WHERE {
dco:Car1 dco:hasConfigAssignment ?assignment.
?assignment dco:hasOption ?option .
?assignment dco:hasOptionValue ?value .
}

%


!! Car 2

%%turtle
dco:Car2 a CarConfigSet ;
	hasConfigAssignment 
	[ hasOption Engine; hasOptionValue SmallEngine ] ,
	[ hasOption Hitch; hasOptionValue WithHitch] .
%

%%sparql
SELECT ?option ?value WHERE {
dco:Car2 dco:hasConfigAssignment ?assignment.
?assignment dco:hasOption ?option .
?assignment dco:hasOptionValue ?value .
}

%


!! Constraint Validation Query

%%sparql
SELECT ?car ?constraint WHERE {
?constraint rdf:type dco:Constraint .
?constraint dco:hasValueA ?valueA .
?constraint dco:hasValueB ?valueB .

?car rdf:type dco:CarConfigSet .
?car dco:hasConfigAssignment ?assignment1 .
?assignment1 dco:hasOptionValue ?valueA .
?car dco:hasConfigAssignment ?assignment2 .
?assignment2 dco:hasOptionValue ?valueB .


}

%

%%package configOptions