#
#	SAN Example:	Entity (a simple Entity with an one-level SAN)
#
     @prefix : <http://www.test.com/test1#> .
     @prefix log: <http://www.w3.org/2000/10/swap/log#> .
     @prefix owl: <http://www.w3.org/2002/07/owl#> .
     @prefix protege: <http://protege.stanford.edu/plugins/owl/protege#> .
     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
     @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
     @prefix san: <http://imu.ntua.gr/ontologies/san/2011/06/01/san.rdf#> .
     @prefix swrl: <http://www.w3.org/2003/11/swrl#> .
     @prefix swrlb: <http://www.w3.org/2003/11/swrlb#> .
     @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
     @prefix xsp: <http://www.owl-ontologies.com/2005/08/07/xsp.owl#> .
     
    :An_Entity	a	san:SANEntity;
		san:name	"MAIN"^^xsd:string;
		san:auto-start	"yes"^^xsd:string;
		san:hasRootGoal	:RootGoal_1.
	
	:RootGoal_1     a san:RootGoal;
         san:name "g1"^^xsd:string;
		 san:auto-start	"yes"^^xsd:string;
		 san:multiple-instances-allowed	"yes"^^xsd:string;
		 san:execution-mode	"PERSISTENT"^^xsd:string;
		 san:hasMetadata :RootGoal_1_Type;
         san:hasSituation :Situation_1;
         san:hasContextCondition :ContextCondition_1;
         san:hasAction :DummyAction_1 .
	
	:RootGoal_1_Type	a	san:Metadata;
		san:name	"goal-type"^^xsd:string ;
		san:type	"string"^^xsd:string ;
		san:value	"PRESERVE"^^xsd:string .
#		san:value	"ONCE-OFF"^^xsd:string .
    
    :Situation_1     a san:Situation ;
        san:name "s1"^^xsd:string ;
		san:dialect "default"^^xsd:string ;
#		san:defined-by "++++ DOKIMH EXPRESSION ?p1 ++++"^^xsd:string ;
#		san:defined-by "TaxiUCLocTraficInfo"^^xsd:string ;
#		san:defined-by "http://www.petalslink.org/dsb/topicsns/ TaxiUCIMP dsb My test"^^xsd:string ;
#		san:defined-by "http://www.petalslink.org/dsb/topicsns/ TaxiUCLocation dsb"^^xsd:string ;
		san:defined-by "http://streams.event-processing.org/ids/ PachubeFeed s"^^xsd:string ;
		san:hasContextualizer :Sit_1_Ctxzr_RDF .
#		san:hasContextualizer :Sit_1_Ctxzr_NVP .
	
# -------------------------   CONTEXTUALIZER DEFINITION of :Situation_1 - BEGIN   ------------------------- #
	:Sit_1_Ctxzr_RDF	a	san:Contextualizer ;
		san:type	"RDF"^^xsd:string ;
		san:contextualizer-query  :Sit_1_Ctxzr_Qry1 ;
		san:contextualizer-query  :Sit_1_Ctxzr_Qry2 ;
		san:contextualizer-query  :Sit_1_Ctxzr_Qry3 .
	
	:Sit_1_Ctxzr_Qry1	a san:ContextualizerQuery ;
		san:language	"SPARQL"^^xsd:string ;
		san:dialect		"default"^^xsd:string ;
		san:defined-by	"prefix ns1: <http://www.linkedopenservices.org/ns/temp-json#> prefix ns2: <http://events.event-processing.org/types/> SELECT ?uri ?tm WHERE { ?uri a ns2:PachubeEvent . ?uri ns2:endTime ?tm }"^^xsd:string .
	
	:Sit_1_Ctxzr_Qry2	a san:ContextualizerQuery ;
		san:language	"SPARQL"^^xsd:string ;
		san:dialect		"default"^^xsd:string ;
		san:defined-by	"prefix ns1: <http://www.linkedopenservices.org/ns/temp-json#> prefix ns2: <http://events.event-processing.org/types/> SELECT ?feed WHERE { ?uri ns1:feed ?feed }"^^xsd:string .
	
	:Sit_1_Ctxzr_Qry3	a san:ContextualizerQuery ;
		san:language	"SPARQL"^^xsd:string ;
		san:dialect		"default"^^xsd:string ;
		san:defined-by	"prefix ns1: <http://www.linkedopenservices.org/ns/temp-json#> prefix ns2: <http://events.event-processing.org/types/> SELECT ?min ?max ?avg WHERE { ?x ns1:max_value ?max . ?x ns1:min_value ?min . ?x ns1:value ?avg }"^^xsd:string .
	
	
	:Sit_1_Ctxzr_NVP	a	san:Contextualizer ;
		san:type	"NVP"^^xsd:string ;
		san:names	"evt_1234567890.id"^^xsd:string .
#		san:names	"*"^^xsd:string .
# -------------------------   CONTEXTUALIZER DEFINITION of :Situation_1 - END   ------------------------- #
	
    :ContextCondition_1     a san:ContextCondition;
        san:name "c1"^^xsd:string ;
		san:dialect "JS"^^xsd:string ;
#		san:defined-by "x=true;"^^xsd:string .
		san:defined-by "function f() { out.println( '******   '+ctx.getItem('evt_1234567890.data')+', '+ctx.getItem('evt_1234567890.type') ); return true; } f();"^^xsd:string .
    
    :DummyAction_1     a san:PrimitiveAction ;
      san:name "action1"^^xsd:string ;
	  san:command "A_PRIMITIVE_ACTION"^^xsd:string .
#      san:dialect "JS"^^xsd:string ;
#      san:defined-by "function f() { util.createEntity('http://www.test.com/test1#Another_Entity', true); out.println( 'PRIMITIVE ACTION : ENTITY CREATED' ); out.alert( 'PRIMITIVE ACTION : ENTITY CREATED' ); return true; } f();"^^xsd:string ;
#	  san:command "EXPRESSION"^^xsd:string .

#END
