Skip to content

Commit

Permalink
Bump networkanalysis from 1.2.0 to 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neesjanvaneck committed Aug 21, 2023
1 parent 2bc26b6 commit ed5766b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repositories {
}

dependencies {
implementation group: 'nl.cwts', name: 'networkanalysis', version: '1.3.0'
implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '12.2.0.jre8'
implementation group: 'nl.cwts', name: 'networkanalysis', version: '1.2.0'
}

java {
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/nl/cwts/publicationclassification/run/DatabaseIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.sql.Statement;

import nl.cwts.networkanalysis.Network;
import nl.cwts.util.LargeDoubleArray;
import nl.cwts.util.LargeIntArray;

public class DatabaseIO
{
Expand All @@ -25,8 +27,8 @@ public class DatabaseIO
public static Network readNetwork(String server, String database, String pubTable, String citLinkTable)
{
double[] pubWeight = null;
int[][] citLink = null;
double[] citLinkWeight = null;
LargeIntArray[] citLink = null;
LargeDoubleArray citLinkWeight = null;

Connection connection = null;
try
Expand Down Expand Up @@ -57,23 +59,25 @@ public static Network readNetwork(String server, String database, String pubTabl

// Read number of citation links.
statement = connection.createStatement();
resultSet = statement.executeQuery("select count(*) from " + citLinkTable);
resultSet = statement.executeQuery("select count_big(*) from " + citLinkTable);
resultSet.next();
int nCitLinks = resultSet.getInt(1);
long nCitLinks = resultSet.getLong(1);
statement.close();

citLink = new int[2][nCitLinks];
citLinkWeight = new double[nCitLinks];
citLink = new LargeIntArray[2];
citLink[0] = new LargeIntArray(nCitLinks);
citLink[1] = new LargeIntArray(nCitLinks);
citLinkWeight = new LargeDoubleArray(nCitLinks);

// Read citation links.
statement = connection.createStatement();
resultSet = statement.executeQuery("select pub_no1, pub_no2, cit_weight from " + citLinkTable + " order by pub_no1, pub_no2");
for (int i = 0; i < nCitLinks; i++)
for (long i = 0; i < nCitLinks; i++)
{
resultSet.next();
citLink[0][i] = resultSet.getInt(1);
citLink[1][i] = resultSet.getInt(2);
citLinkWeight[i] = resultSet.getDouble(3);
citLink[0].set(i, resultSet.getInt(1));
citLink[1].set(i, resultSet.getInt(2));
citLinkWeight.set(i, resultSet.getDouble(3));
}
statement.close();

Expand Down
23 changes: 12 additions & 11 deletions src/main/java/nl/cwts/publicationclassification/run/FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.io.IOException;

import nl.cwts.networkanalysis.Network;
import nl.cwts.util.DynamicDoubleArray;
import nl.cwts.util.DynamicIntArray;
import nl.cwts.util.LargeDoubleArray;
import nl.cwts.util.LargeIntArray;

public class FileIO
{
Expand All @@ -29,11 +29,15 @@ public class FileIO
*/
public static Network readNetwork(String pubFile, String citLinkFile)
{
DynamicDoubleArray pubWeight = new DynamicDoubleArray(100);
DynamicIntArray[] citLink = new DynamicIntArray[2];
citLink[0] = new DynamicIntArray(100);
citLink[1] = new DynamicIntArray(100);
DynamicDoubleArray citLinkWeight = new DynamicDoubleArray(100);
LargeDoubleArray pubWeight = new LargeDoubleArray(0);
pubWeight.ensureCapacity(100);
LargeIntArray[] citLink = new LargeIntArray[2];
citLink[0] = new LargeIntArray(0);
citLink[0].ensureCapacity(100);
citLink[1] = new LargeIntArray(0);
citLink[1].ensureCapacity(100);
LargeDoubleArray citLinkWeight = new LargeDoubleArray(0);
citLinkWeight.ensureCapacity(100);

BufferedReader reader = null;
// Read publications file.
Expand Down Expand Up @@ -153,12 +157,9 @@ public static Network readNetwork(String pubFile, String citLinkFile)

// Create citation network.
Network citNetwork = null;
int[][] citLink2 = new int[2][];
citLink2[0] = citLink[0].toArray();
citLink2[1] = citLink[1].toArray();
try
{
citNetwork = new Network(pubWeight.toArray(), citLink2, citLinkWeight.toArray(), true, true);
citNetwork = new Network(pubWeight.toArray(), citLink, citLinkWeight, true, true);
}
catch (IllegalArgumentException e)
{
Expand Down

0 comments on commit ed5766b

Please sign in to comment.