1
- /*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
1
package uff .ic .swlab .datasetsearch .classifier ;
7
2
8
3
import java .io .FileNotFoundException ;
9
- import java .io .FileOutputStream ;
10
4
import java .sql .Connection ;
11
5
import java .sql .PreparedStatement ;
12
6
import java .sql .ResultSet ;
21
15
import java .util .Set ;
22
16
import org .apache .jena .query .QueryExecution ;
23
17
import org .apache .jena .query .QueryExecutionFactory ;
24
- import org .apache .jena .rdf .model .Literal ;
25
18
import org .apache .jena .rdf .model .Model ;
26
19
import org .apache .jena .rdf .model .ModelFactory ;
27
20
import org .apache .jena .rdf .model .Property ;
28
21
import org .apache .jena .rdf .model .Resource ;
29
- import org .apache .jena .vocabulary .VCARD4 ;
30
22
31
23
/**
32
24
*
@@ -41,9 +33,8 @@ public static Float GetProbability(int linkset, int dataset, Connection conn) th
41
33
stm .setInt (1 , linkset );
42
34
stm .setInt (2 , dataset );
43
35
ResultSet rs = stm .executeQuery ();
44
- while (rs .next ()) {
36
+ while (rs .next ())
45
37
result = rs .getFloat ("prob" );
46
- }
47
38
rs .close ();
48
39
stm .close ();
49
40
return result ;
@@ -55,9 +46,8 @@ public static Float GetProbabilityGlobal(int dataset, Connection conn) throws SQ
55
46
PreparedStatement stm = conn .prepareStatement (qr );
56
47
stm .setInt (1 , dataset );
57
48
ResultSet rs = stm .executeQuery ();
58
- while (rs .next ()) {
49
+ while (rs .next ())
59
50
result = rs .getFloat ("prob" );
60
- }
61
51
rs .close ();
62
52
stm .close ();
63
53
return result ;
@@ -121,16 +111,15 @@ public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
121
111
for (Map .Entry <String , Double > pair : list ) {
122
112
123
113
int t = java .lang .Double .compare (pair .getValue (), Double .NEGATIVE_INFINITY );
124
- if (t == 0 ) {
114
+ if (t == 0 )
125
115
result = -Double .MAX_VALUE ;
126
- } else {
116
+ else
127
117
result = pair .getValue ();
128
- }
129
118
Resource resouce = model .createResource (pair .getKey ())
130
119
.addProperty (property_rank , hasRank )
131
120
.addProperty (property_value , model .createTypedLiteral (result ));
132
121
}
133
-
122
+
134
123
String qr = "PREFIX vrank: <http://purl.org/voc/vrank#>\n "
135
124
+ "\n "
136
125
+ "CONSTRUCT {?dataset a vrank:hasrank. \n "
0 commit comments