Skip to content

Commit 74f9ffd

Browse files
2 parents f84d8f0 + 43a25f6 commit 74f9ffd

File tree

1 file changed

+74
-73
lines changed

1 file changed

+74
-73
lines changed

README.md

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,82 +5,35 @@ Here's an article by that explains gives some more detail about the project: *[N
55

66
Here's an example of an analysis that you can do with pbprdf: *[Analysis: 3-point shot percentage after other team makes or misses](https://gist.github.com/andrewstellman/4872dbb9dc7593e56abddbe8b998b509)*
77

8+
## Running pbprdf
89

9-
Install and run
10-
===============
10+
To run pbprdf, download the latest release from the Releases page: https://github.com/andrewstellman/pbprdf/releases and make sure Java 8 or later is in your path.
1111

12-
__Prerequisite: [sbt](http://www.scala-sbt.org/) 1.x and Java 8 or later must be in your path__
13-
* [Installing SBT](https://www.scala-sbt.org/1.x/docs/Setup.html)
14-
* [Install sbt 1.x on Mac](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Mac.html)
15-
* [Install sbt 1.x on Unix](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html)
16-
* [Install sbt 1.x on Windows](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Windows.html)
17-
18-
Mac or Unix:
19-
```
20-
$ git clone https://github.com/andrewstellman/pbprdf.git
21-
$ cd pbprdf
22-
$ sbt assembly
23-
$ ./pbprdf
24-
```
12+
The release distribution contains an archive with the following files:
13+
* `pbprdf.jar` - the binary
14+
* `pbprdf` - Mac/Unix shell script to run pbprdf
15+
* `pbprdf.bat` - Windows batch file to run pbprdf
16+
* shell scripts to fetch WNBA or NBA play-by-play files
2517

26-
Windows:
27-
```
28-
C:\Users\Public\src>git clone https://github.com/andrewstellman/pbprdf.git
29-
C:\Users\Public\src>cd pbprdf
30-
C:\Users\Public\src\pbprdf>sbt assembly
31-
C:\Users\Public\src\pbprdf>pbprdf
32-
```
18+
### Example: Analyze a set of games
3319

34-
*(The above commands use [sbt-assembly](https://github.com/sbt/sbt-assembly) to create a fat JAR.)*
35-
36-
Other useful build commands
37-
---------------------------
38-
39-
Compile the code and run the unit tests:
40-
```
41-
$ sbt compile test
20+
Step 1: Download a set of play-by-play HTML files
4221
```
43-
44-
Generate Eclipse project files (via [sbteclipse](https://github.com/sbt/sbteclipse):
45-
```
46-
$ sbt eclipse
47-
```
48-
49-
Generate sample Turtle from the unit test data and print it to the console
50-
51-
using the script:
52-
```
53-
$ ./pbprdf src/test/resources/com/stellmangreene/pbprdf/test/htmldata/
54-
```
55-
56-
via SBT:
57-
```
58-
$ sbt "run src/test/resources/com/stellmangreene/pbprdf/test/htmldata/"
22+
$ ./fetch-wnba-play-by-plays.sh
5923
```
6024

61-
Examples
62-
========
63-
64-
Example: Analyze a set of games
65-
-------------------------------
66-
67-
Step 1: Clone the pbprdf repository
68-
```
69-
$ git clone https://github.com/andrewstellman/pbprdf.git
70-
$ cd pbprdf
71-
```
25+
This will create a folder called `data/retrieved_*` (with a timestamp at the end of the folder name) with subdirectories for various seasons and playoffs. Move the folder for a season or playoff into the current folder (in this example, the folder with the 2014 playoffs):
7226

73-
Step 2: Download a set of play-by-play HTML files
7427
```
75-
$ ./fetch-wnba-play-by-plays.sh
28+
$ mv data/retrieved_*/wnba-2018-playoffs .
7629
```
7730

78-
Step 3: Run pbprdf and generate the Turtle file for the 2014 WNBA playoffs
31+
Step 2: Run pbprdf and generate the Turtle file for the 2014 WNBA playoffs
7932
```
80-
$ ./pbprdf data/wnba-2014-playoffs/ wnba-2014-playoffs.ttl
33+
$ ./pbprdf wnba-2018-playoffs/ wnba-2018-playoffs.ttl
8134
```
8235

83-
Step 4: Import the Turtle file into RDF4J Server
36+
Step 3: Import the Turtle file into RDF4J Server
8437
*(see instructions at the bottom for spinning up an RDF4J server, loading data into it, and connecting to it with the RDF4J console)
8538
```
8639
$ console -s http://localhost:8080/rdf4j-server pbprdf-database
@@ -105,7 +58,7 @@ Data has been added to the repository (427100 ms)
10558

10659
__See 'Setting up RDF4J Server' below for details on setting up RDF4J server__
10760

108-
Step 5: Run SPARQL queries
61+
Step 4: Run SPARQL queries
10962
```
11063
pbprdf-database> SPARQL
11164
enter multi-line SPARQL query (terminate with line containing single '.')
@@ -146,8 +99,7 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
14699
```
147100

148101

149-
Example: Load the ontology into RDF4J Server
150-
--------------------------------------------
102+
### Example: Load the ontology into RDF4J Server
151103

152104
Step 1: Generate the ontology
153105
```
@@ -201,11 +153,10 @@ Evaluating SPARQL query...
201153
20 result(s) (60 ms)
202154
```
203155

204-
Other Useful Queries
205-
====================
156+
## Other Useful Queries
157+
158+
### Clutch Shots
206159

207-
Clutch Shots
208-
------------
209160
```
210161
SELECT ?playerName ?shotsTaken ?shotsMade ?shotPercentage
211162
WHERE
@@ -249,8 +200,8 @@ WHERE
249200
ORDER BY DESC(?shotPercentage)
250201
```
251202

252-
Shots made and missed at Target Center in the first five minutes
253-
----------------------------------------------------------------
203+
### Shots made and missed at Target Center in the first five minutes
204+
254205
```
255206
SELECT ?game ?gameTime ?shotsTaken ?shotsMade ?shotsMadePercentage ?shotsMissed ?shotsMissedPercentage
256207
WHERE
@@ -292,8 +243,7 @@ WHERE
292243
LIMIT 100
293244
```
294245

295-
Setting up RDF4J Server
296-
=======================
246+
## Setting up RDF4J Server
297247

298248
One effective way to execute SPARQL queries against these files is to use [RDF4J Server, Workbench, and Console](http://docs.rdf4j.org/server-workbench-console/). RDF4J Server and its GUI, RDF Workbench, are both web applications that run in an application server like Tomcat.
299249

@@ -336,3 +286,54 @@ pbprdf-database>
336286

337287
__Step 5: Import your Turtle file__
338288
You can use the instructions above to import your `*.ttl` or `*.ttl.zip` files into your newly created database. You can either use the RDF4J console or RDF4J workbench GUI to execute SPARQL queries.
289+
290+
291+
## Building pbprdf
292+
293+
__Prerequisite: [sbt](http://www.scala-sbt.org/) 1.x and Java 8 or later must be in your path__
294+
* [Installing SBT](https://www.scala-sbt.org/1.x/docs/Setup.html)
295+
* [Install sbt 1.x on Mac](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Mac.html)
296+
* [Install sbt 1.x on Unix](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html)
297+
* [Install sbt 1.x on Windows](https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Windows.html)
298+
299+
Mac or Unix:
300+
```
301+
$ git clone https://github.com/andrewstellman/pbprdf.git
302+
$ cd pbprdf
303+
$ sbt assembly
304+
$ ./pbprdf
305+
```
306+
307+
Windows:
308+
```
309+
C:\Users\Public\src>git clone https://github.com/andrewstellman/pbprdf.git
310+
C:\Users\Public\src>cd pbprdf
311+
C:\Users\Public\src\pbprdf>sbt assembly
312+
C:\Users\Public\src\pbprdf>pbprdf
313+
```
314+
315+
*(The above commands use [sbt-assembly](https://github.com/sbt/sbt-assembly) to create a fat JAR.)*
316+
317+
### Other useful build commands
318+
319+
Compile the code and run the unit tests:
320+
```
321+
$ sbt compile test
322+
```
323+
324+
Generate Eclipse project files (via [sbteclipse](https://github.com/sbt/sbteclipse):
325+
```
326+
$ sbt eclipse
327+
```
328+
329+
Generate sample Turtle from the unit test data and print it to the console
330+
331+
using the script:
332+
```
333+
$ ./pbprdf src/test/resources/com/stellmangreene/pbprdf/test/htmldata/
334+
```
335+
336+
via SBT:
337+
```
338+
$ sbt "run src/test/resources/com/stellmangreene/pbprdf/test/htmldata/"
339+
```

0 commit comments

Comments
 (0)