Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
IndikaKuma committed Sep 12, 2021
2 parents 542dac6 + 33cc3f7 commit adccd1d
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pipeline {
steps {
sh """ #!/bin/bash
cd tosca
mvn clean install
mvn clean install -Ddefault.min.distinct.threshold=104857600
"""
}
}
Expand Down
7 changes: 4 additions & 3 deletions tosca/api/src/main/resources/sparql/suspiciousComment.sparql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
select distinct ?resource ?comment
select distinct ?resource ?comment ?classifier
where {
?resource rdfs:comment ?comment .
?resource rdfs:comment|dcterms:description ?comment;
DUL:classifies ?classifier
FILTER (regex(lcase(str(?comment)), "(bug|hack|later|todo|later2)","i")).
}
}
10 changes: 7 additions & 3 deletions tosca/core/src/main/java/nl/jads/tosca/DefectPredictorKBApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,10 @@ public List<Comment> suspiciousComment(RepositoryConnection connection) throws I
while (result.hasNext()) {
BindingSet bindingSet = result.next();
IRI p1 = (IRI) bindingSet.getBinding("resource").getValue();
comments.add(new Comment(p1, bindingSet.getValue("comment").stringValue()));
IRI classifier = (IRI) bindingSet.getBinding("classifier").getValue();
Comment c = new Comment(classifier, bindingSet.getValue("comment").stringValue());
c.setClassifiedBy(p1);
comments.add(c);
}
result.close();
return comments;
Expand Down Expand Up @@ -457,9 +460,10 @@ public void fillContext(BugRecord bugRecord, Feature property, RepositoryConnect
String query = PREFIXES + sparql;
IRI var;
if (property instanceof Comment) {
var = ((Comment) property).getIri();
//var = ((Comment) property).getIri();
var = ((Comment) property).getClassifiedBy();
} else {
var = property.getClassifiedBy();
var = property.getClassifiedBy();
}
TupleQueryResult result = QueryUtil.evaluateSelectQuery(connection,
query, new SimpleBinding("var", var));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
select distinct ?var ?resource
where {
?var DUL:hasParameter ?p .
?p DUL:classifies tosca:default .
?p tosca:hasDataValue "0.0.0.0".
}
?var DUL:classifies ?resource.

optional {
?var DUL:hasParameter ?p .
?p DUL:classifies tosca:default .
?p tosca:hasDataValue ?value .
VALUES ?value {"0.0.0.0" "0.0.0.0/0"}.
}

optional {
?var (DUL:hasParameter)*/tosca:hasDataValue ?value.
VALUES ?value {"0.0.0.0" "0.0.0.0/0"}.
}
FILTER (bound(?value)).
}
6 changes: 3 additions & 3 deletions tosca/core/src/main/resources/sparql/invalidPortRange.sparql
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
select distinct ?var ?resource
where {
?var DUL:classifies ?resource.
FILTER (regex(str(?resource), "port(.+?)|(.+?)?port","i")).
FILTER (regex(str(?resource), "port(.+?)|(.+?)?port|(.+?)?ports","i")).
optional {
?var DUL:hasParameter ?p .
?p DUL:classifies tosca:default .
?p tosca:hasDataValue ?value.
}.
optional {
?var tosca:hasDataValue ?value.
?var (tosca:hasDataValue|(tosca:hasObjectValue/tosca:hasDataValue)) ?value.
}.
FILTER (bound(?value)).
FILTER( ?value < 0 || ?value > 65535 )
}
}
7 changes: 4 additions & 3 deletions tosca/core/src/main/resources/sparql/suspiciousComment.sparql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
select distinct ?resource ?comment
select distinct ?resource ?comment ?classifier
where {
?resource rdfs:comment ?comment .
?resource rdfs:comment|dcterms:description ?comment;
DUL:classifies ?classifier
FILTER (regex(lcase(str(?comment)), "(bug|hack|later|todo|later2)","i")).
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ clinical1:Property_1
clinical1:Property_2
rdf:type tosca:Property ;
dcterms:description
"Job script template with j2 extension, such that Ansible can process it with the template module" ;
"later Job script template with j2 extension, such that Ansible can process it with the template module" ;
DUL:classifies clinical1:script_template ;
DUL:hasParameter clinical1:SodaliteParameter_P1_2 ;
.
Expand Down Expand Up @@ -664,7 +664,7 @@ clinical1:my.nodes.hpc.wm.torque
rdf:type owl:Class ;
rdfs:subClassOf tosca:tosca.nodes.Compute ;
soda:hasContext clinical1:SodaliteDescription_1 ;
rdfs:comment "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
dcterms:description "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
.

clinical1:my.nodes.hpc.job.torque
Expand All @@ -677,4 +677,4 @@ clinical1:my.relationships.jobHostedOn
rdf:type owl:Class ;
rdfs:subClassOf tosca:tosca.relationships.HostedOn ;
soda:hasContext clinical1:SodaliteDescription_3 ;
.
.
6 changes: 4 additions & 2 deletions tosca/core/src/test/resources/snow/snow_tier1.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ snowt1:Property_2
DUL:classifies snowt1:imageName ;
DUL:hasParameter snowt1:SodaliteParameter_19 ;
DUL:hasParameter snowt1:SodaliteParameter_20 ;
dcterms:description "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
.

snowt1:Property_3
Expand All @@ -113,6 +114,7 @@ snowt1:Property_3
DUL:classifies snowt1:ports ;
DUL:hasParameter snowt1:SodaliteParameter_21 ;
DUL:hasParameter snowt1:SodaliteParameter_22 ;
dcterms:description "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
.

snowt1:Property_4
Expand Down Expand Up @@ -687,7 +689,7 @@ snowt1:SodaliteParameter_PS_1
rdf:type soda:SodaliteParameter ;
DUL:classifies tosca:default ;
tosca:hasDataValue "admin" ;
rdfs:comment "TODO: Replace hardcoded password with secure vault"^^rdfs:Literal
dcterms:description "TODO: Replace hardcoded password with secure vault"^^rdfs:Literal
.

snowt1:SodaliteParameter_PS_4
Expand Down Expand Up @@ -834,7 +836,7 @@ snowt1:bind_host
rdf:type owl:Class ;
rdfs:subClassOf <https://www.sodalite.eu/ontologies/tosca/tosca.nodes.Compute> ;
soda:hasContext snowt1:SodaliteDescription_3 ;
rdfs:comment "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
dcterms:description "addresses bug: https://bugs.launchpad.net/keystone/+bug/1472285"^^rdfs:Literal
.

snowt1:vm_name
Expand Down
2 changes: 1 addition & 1 deletion tosca/core/src/test/resources/snow/snow_tier2.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ snowt1:User_1
:skyline-extractor
rdf:type <https://www.sodalite.eu/ontologies/snow/tier1/sodalite.nodes.DockerizedComponent> ;
soda:hasContext :SodaliteDescription_6 ;
rdfs:comment "addresses skyline-extractor bug: https://bugs.launchpad.net/keystone/+bug/323345"^^rdfs:Literal
dcterms:description "addresses skyline-extractor bug: https://bugs.launchpad.net/keystone/+bug/323345"^^rdfs:Literal
.

:vm
Expand Down

0 comments on commit adccd1d

Please sign in to comment.