Commit 5ee1300e authored by Nicolas Seydoux's avatar Nicolas Seydoux
Browse files

Clearing repo for master merge

parent 988b6c24
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR1Envelope
edr:hasTransferShape ex:IIoTR1TransferShape ;
edr:hasApplyShape ex:IIoTR1ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR1ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR1ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR1ActiveShape.
ex:IIoTR1TransferShape
......@@ -220,7 +220,7 @@ ex:IIoTR1ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR1RuleShape
......@@ -232,7 +232,7 @@ ex:IIoTR1CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR1ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR2Envelope
edr:hasTransferShape ex:IIoTR2TransferShape ;
edr:hasApplyShape ex:IIoTR2ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR2ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR2ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR2ActiveShape.
ex:IIoTR2TransferShape
......@@ -221,7 +221,7 @@ ex:IIoTR2ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR2RuleShape
......@@ -233,7 +233,7 @@ ex:IIoTR2CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR2ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR3Envelope
edr:hasTransferShape ex:IIoTR3TransferShape ;
edr:hasApplyShape ex:IIoTR3ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR3ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR3ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR3ActiveShape.
ex:IIoTR3TransferShape
......@@ -219,7 +219,7 @@ ex:IIoTR3ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR3RuleShape
......@@ -231,7 +231,7 @@ ex:IIoTR3CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR3ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR4Envelope
edr:hasTransferShape ex:IIoTR4TransferShape ;
edr:hasApplyShape ex:IIoTR4ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR4ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR4ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR4ActiveShape.
ex:IIoTR4TransferShape
......@@ -219,7 +219,7 @@ ex:IIoTR4ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR4RuleShape
......@@ -231,7 +231,7 @@ ex:IIoTR4CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR4ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR5Envelope
edr:hasTransferShape ex:IIoTR5TransferShape ;
edr:hasApplyShape ex:IIoTR5ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR5ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR5ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR5ActiveShape.
ex:IIoTR5TransferShape
......@@ -219,7 +219,7 @@ ex:IIoTR5ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR5RuleShape
......@@ -231,7 +231,7 @@ ex:IIoTR5CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR5ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR6Envelope
edr:hasTransferShape ex:IIoTR6TransferShape ;
edr:hasApplyShape ex:IIoTR6ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR6ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR6ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR6ActiveShape.
ex:IIoTR6TransferShape
......@@ -220,7 +220,7 @@ ex:IIoTR6ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR6RuleShape
......@@ -232,7 +232,7 @@ ex:IIoTR6CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR6ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -18,7 +18,7 @@ prefix time: <http://www.w3.org/2006/time#>
ex:IIoTR7Envelope
edr:hasTransferShape ex:IIoTR7TransferShape ;
edr:hasApplyShape ex:IIoTR7ApplicableShape ;
edr:hasResultTransferShape ex:IIoTR7ResultTransferShape ;
edr:hasDeliveryShape ex:IIoTR7ResultTransferShape ;
edr:hasDeductionShape ex:IIoTR7ActiveShape.
ex:IIoTR7TransferShape
......@@ -218,7 +218,7 @@ ex:IIoTR7ResultTransfer
ex:myIIoTApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://140.93.48.11:8006";
iotl:endpoint "http://blacksad.laas.fr:8006";
].
ex:IIoTR7RuleShape
......@@ -230,7 +230,7 @@ ex:IIoTR7CoreRule
a sh:SPARQLRule ;
sh:condition ex:IIoTR7ActiveShape ;
edr:ruleOriginatedFrom ex:myIIoTApp ;
edr:originatingEndpoint "http://140.93.48.11:8006" ;
edr:originatingEndpoint "http://blacksad.laas.fr:8006" ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
PREFIX ex:<http://example.com/ns#>
......
......@@ -265,6 +265,7 @@ ex:R2 a sh:SPARQLRule ;
?l_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?luminosityValue;
ssn:observedProperty ?l;
ssn:observedBy ?luminosity_sensor.
FILTER(?temperatureValue > '50.0'^^xsd:float)
?n rdf:type/rdfs:subClassOf* adr:Noise;
ssn:isPropertyOf ?feature.
......
......@@ -245,7 +245,7 @@ ex:IIoTR1CoreRule
PREFIX iiot: <https://w3id.org/laas-iot/edr/iiot/factory#>
CONSTRUCT {
?deduction a rdf:Statement;
rdf:subject ?feature;
rdf:subject ?machine;
rdf:predicate rdf:type;
rdf:object ex:LowMachineVisibility;
edr:deducedAt ?now;
......
#! /bin/bash
for i in {1..10}
logs_path=logs/thesis/iter_7
results_path=results/thesis/iter_7
for topo in {2..4}
do
echo "Computing results round $i"
# mkdir results_minimal_local_$i
python3 results.py --adp logs/logs_minimal_reproduce/iter_2/logs_minimal_adp_$i --cir logs/logs_minimal_reproduce/iter_2/logs_minimal_cir_$i --cip logs/logs_minimal_reproduce/iter_2/logs_minimal_cip_$i --cdp logs/logs_minimal_reproduce/iter_2/logs_minimal_cdp_$i --cdr logs/logs_minimal_reproduce/iter_2/logs_minimal_cdr_$i -o results/results_minimal_reproduce/iter_2/results_minimal_local_$i
file_seed=logs_distrib_$topo
result_seed=results_distrib_$topo
# for iter in {1..1}
# do
echo "Computing results round $iter"
results_folder=$results_path/$result_seed #"_$iter"
mkdir -p $results_folder
python3 results.py --adp $logs_path/$file_seed"_adp" --cir $logs_path/$file_seed"_cir"/ --cdp $logs_path/$file_seed"_cdp"/ --cdr $logs_path/$file_seed"_cdr"/ --cip $logs_path/$file_seed"_cip"/ -o $results_folder
# python3 results.py --adp $logs_path/$file_seed"_adp_$iter" --cir $logs_path/$file_seed"_cir_$iter"/ --cdp $logs_path/$file_seed"_cdp_$iter"/ --cdr $logs_path/$file_seed"_cdr_$iter"/ --cip $logs_path/$file_seed"_cip_$iter"/ -o $results_folder
# done
done
......@@ -79,7 +79,7 @@ def compute_delay(graph):
deduction_received = dateutil.parser.parse(row[6])
last_symptom = dateutil.parser.parse(row[1])
if not(deduction_uri in rules[rule]):
rules[rule][deduction_uri] = {"deduction_received":deduction_received, "deduction_time":deduction_time, "last_symptom":last_symptom, "node":node, "obs_uri":str(obs_uri)}
rules[rule][deduction_uri] = {"uri":str(deduction_uri), "deduction_received":deduction_received, "deduction_time":deduction_time, "last_symptom":last_symptom, "node":node, "obs_uri":str(obs_uri)}
else:
if last_symptom > rules[rule][deduction_uri]["last_symptom"]:
rules[rule][deduction_uri]["last_symptom"] = last_symptom
......@@ -148,10 +148,10 @@ def compute_avg_reasoning(reasoning_times):
dev[rule] = np.std([x for x in reasoning_times[rule]])
return (avg, dev)
def compute_single_journey(obs_uri, trace):
def compute_single_journey(deduction_uri, obs_uri, trace):
journey = []
for event in trace:
if "observation" in event and event["observation"] == obs_uri:
if "observation" in event and (event["observation"] == obs_uri or event["observation"] == deduction_uri):
journey.append(event)
return journey
......@@ -162,11 +162,12 @@ def display_journey(journey):
def summarize_journey(journey, deduction, rule):
summary = {"idle":0, "transit":0, "processing":0, "additional-processing":0, "additional-idle":0}
deduced = False
for i in range(len(journey)-1):
for i in range(len(journey)):
event = journey[i]
if event["event"] == "Enrichment ended":
summary["creation"] = event["time"]
summary["idle"] = (dateutil.parser.parse(journey[i+1]["time"]) - dateutil.parser.parse(event["time"])).total_seconds()
if i<len(journey)-1:
summary["idle"] = (dateutil.parser.parse(journey[i+1]["time"]) - dateutil.parser.parse(event["time"])).total_seconds()
# If the deducer sent the data, it is processed elsewhere
if event["event"] == "Sending data":
#if event["node"] != deduction["node"]:
......@@ -180,16 +181,21 @@ def summarize_journey(journey, deduction, rule):
day_agnostic_deduction = dateutil.parser.parse(str(naive_deduction_received.time()))
event_time = dateutil.parser.parse(event["time"])
summary["transit"] += (day_agnostic_deduction - dateutil.parser.parse(event["time"])).total_seconds()
if event["event"] == "Received observation":
if event["event"] == "Received observation" and i<len(journey)-1:
summary["idle"] += (dateutil.parser.parse(journey[i+1]["time"]) - dateutil.parser.parse(event["time"])).total_seconds()
if event["event"] == "Reasoning starts":
if event["event"] == "Reasoning starts" and i<len(journey)-1:
summary["processing"] += (dateutil.parser.parse(journey[i+1]["time"]) - dateutil.parser.parse(event["time"])).total_seconds()
# if event["rule"] == rule:
# summary["deduction"] = journey[i+1]["time"]
# deduced = True
if event["event"] == "Reasoning ends":
if event["event"] == "Reasoning ends" and i<len(journey)-1:
summary["idle"] += (dateutil.parser.parse(journey[i+1]["time"]) - dateutil.parser.parse(event["time"])).total_seconds()
summary["delay"]=summary["idle"]+summary["transit"]+summary["processing"]
if summary["transit"] <= 0:
# print(journey)
# print(summary)
# print(deduction)
return None
return summary
def compute_journeys(graph, trace):
......@@ -200,10 +206,11 @@ def compute_journeys(graph, trace):
for deduction in rules[rule]:
# print("Searching for observation "+rules[rule][deduction]["obs_uri"])
# print("delay is "+str(rules[rule][deduction]["delay"]))
j = compute_single_journey(rules[rule][deduction]["obs_uri"], trace)
j = compute_single_journey(rules[rule][deduction]["uri"], rules[rule][deduction]["obs_uri"], trace)
#display_journey(j)
sj = summarize_journey(j, rules[rule][deduction], str(rule))
journeys.append(sj)
if sj != None:
journeys.append(sj)
return journeys
def extract_delays_details(journeys):
......@@ -522,21 +529,22 @@ if args.adp != None or args.cir != None or args.cdp != None or args.cip != None
"cip":args.cip,
"cdr":args.cdr,
"cir":args.cir}.items():
print("Collecting results for "+method)
trace = prepare_trace(folder)
graph = prepare_graph(folder)
journey = compute_journeys(graph, trace)
with open(args.output+"/journeys_{0}.pkl".format(method), "wb") as f:
pickle.dump(journey, f)
journeys[method]=journey
delay = extract_delays_details(journey)
with open(args.output+"/delays_{0}.pkl".format(method), "wb") as f:
pickle.dump(delay, f)
with open(args.output+"/messages_{0}.txt".format(method), "w") as f:
f.write(str(count_messages(trace)))
del(trace)
del(graph)
del(delay)
if folder != None:
print("Collecting results for "+method)
trace = prepare_trace(folder)
graph = prepare_graph(folder)
journey = compute_journeys(graph, trace)
with open(args.output+"/journeys_{0}.pkl".format(method), "wb") as f:
pickle.dump(journey, f)
journeys[method]=journey
delay = extract_delays_details(journey)
with open(args.output+"/delays_{0}.pkl".format(method), "wb") as f:
pickle.dump(delay, f)
with open(args.output+"/messages_{0}.txt".format(method), "w") as f:
f.write(str(count_messages(trace)))
del(trace)
del(graph)
del(delay)
if len(journeys) > 0:
histogram_journeys(journeys, args.output)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment