Java implementation of Osrank
Right now IntelliJ is the main IDE that we're using to develop. This will seem quite heavyweight to some developers, but is really nice and very powerful once it's set up. An alternative would be to use a lighter-weight editor like Emacs or Sublime and then simply build using Maven, or manually. If you'd like to do that but don't know how, reach out to @andrewpdickson for help.
- Install Java JDK. Any reasonably recent version:
https://www.oracle.com/technetwork/java/javase/downloads/index.html
- Install IntelliJ IDEA. The community edition is fine. Any reasonably recent version:
https://www.jetbrains.com/idea/download/#section=mac
- Clone the repo into your local environment.
git clone https://github.com/oscoin/osrank-java.git
-
Open IntelliJ IDEA. Choose "Import Project".
-
Select the pom.xml in the base project directory.
-
A project import detail screen appears. Make sure "Import Maven projects automatically" is checked, and click "Next".
-
Click "Next" two more times and then "Finish".
-
The project should now be open. You can try running OsrankNaiveSimpleGraphApp by finding that file in a sub-folder of src/ and then right-clicking on it and choosing to run or debug it. To change the parameters, open that file and change the values of the various constants.
-
You're all set up -- enjoy!
Once Java and IntelliJ have been installed and the project configured as described above, try the following:
-
Open the file io.oscoin.app.OsrankNaiveRandomGraphApp
-
Choose Run > Debug... and then click on OsrankNaiveRandomGraphApp in the little window that opens.
-
It will take a moment to build and then updates and eventually results will start to be printed out in the console. Congrats! You just ran Osrank on a randomly generated graph. If you would like to adjust the parameters related to graph generation or the run itself, they can be found as constant fields at the top of the OsrankNaiveRandomGraphApp class.
-
Now let's try running against data from the Rust/Cargo ecosystem. For convenience, this data has been included in the project subdirectory:
data/rust_cargo/
- Open the file io.oscoin.app.OsrankNaiveFileGraphApp and set the constant values for DEPENDENCIES_FILE_PATH and CONTRIBUTIONS_FILE_PATH to point to the dependencies and contributions files respectively in the repository you just cloned, specifically:
data/rust_cargo/dependencies.csv
data/rust_cargo/contributions.csv
-
Choose Run > Debug... and then click on OsrankNaiveFileGraphApp in the little window that opens.
-
It will take a moment to build and run. Congrats, you just ran Osrank on a graph of real project data from Cargo!
- Add a JAR as a "Build Artifact" to your Project Structure.
- Build the JAR.
Build -> BuildProject or Build -> Artifacts
- Run from command line:
java -jar out/artifacts/osrank_jar/osrank.jar metadataFilePath=./data/rust_cargo/metadata.csv dependenciesFilePath=./data/rust_cargo/dependencies.csv contributionsFilePath=./data_/rust_cargocontributions.csv