Created
July 16, 2011 09:58
-
-
Save datablend/1086222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the sail graph database | |
graph = new MyNeo4jGraph("var/flights", 100000); | |
graph.setTransactionMode(TransactionalGraph.Mode.MANUAL); | |
sail = new GraphSail(graph); | |
// Initialize the sail store | |
sail.initialize(); | |
// Get the sail repository connection | |
connection = new SailRepository(sail).getConnection(); | |
// Import the data | |
connection.add(getResource("sneeair.rdf"), null, RDFFormat.RDFXML); | |
// Execute SPARQL query | |
TupleQuery durationquery = connection.prepareTupleQuery(QueryLanguage.SPARQL, | |
"PREFIX io: <http://www.daml.org/2001/06/itinerary/itinerary-ont#> " + | |
"PREFIX fl: <http://www.snee.com/ns/flights#> " + | |
"SELECT ?number ?departure ?destination " + | |
"WHERE { " + | |
"?flight io:flight ?number . " + | |
"?flight fl:flightFromCityName ?departure . " + | |
"?flight fl:flightToCityName ?destination . " + | |
"?flight io:duration \"1:35\" . " + | |
"}"); | |
TupleQueryResult result = durationquery.evaluate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment