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

Added element to propagate parent interests

parent fc9c218d
PREFIX edr: <http://w3id.org/laas-iot/edr#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
ASK {
?interested edr:isInterestedIn <{{ interest }}>;
lmu:hasDownstreamNode <{{ self }}>.
}
......@@ -94,9 +94,14 @@ public class InterestManager {
} else {
targets = Node.getInstance().getProductionManager().getPartialProducers(interestURI);
LOGGER.debug(targets.size()+" nodes under "+Node.getInstance().getName()+" are partial producers of "+interestURI);
}
if(this.hasInterestedParent(interestURI)){
targets = Node.getInstance().getProductionManager().getProducers(interestURI);
LOGGER.debug(targets.size()+" nodes under "+Node.getInstance().getName()+" are producers of "+interestURI+", propagating for a parent");
}
//} else {
// targets.addAll(Node.getInstance().getProductionManager().getPartialProducers(interestURI));
//}
......@@ -119,6 +124,19 @@ public class InterestManager {
}
}
public Boolean hasInterestedParent(String interest){
Map<String, String> substitution = new HashMap<>();
substitution.put("self", Node.getInstance().getUri());
substitution.put("interest", interest);
try {
String query = this.queries.getTemplateQueries().get("has_interested_parent").substitute(substitution);
return Node.getInstance().getKBManager().askModel(query);
} catch (IncompleteSubstitutionException e) {
e.printStackTrace();
}
return null;
}
public void markNodeAdvertised(String node, String interest){
Map<String, String> substitution = new HashMap<>();
substitution.put("node", node);
......
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