Skip to content

Instantly share code, notes, and snippets.

View datablend's full-sized avatar

Davy Suvee datablend

View GitHub Profile
@datablend
datablend / RDF.xml
Created July 8, 2011 11:44
Simple RDF example
<http://example.org/person/Davy_Suvee> <http://example.org/person/first_name> "Davy" .
<http://example.org/person/Davy_Suvee> <http://example.org/person/last_name> "Suvee" .
<http://example.org/person/Davy_Suvee> <http://example.org/person/age> "31" .
<http://example.org/person/Davy_Suvee> <http://example.org/company> <http://example.org/company/DataBlend> .
<http://example.org/company/DataBlend> <http://example.org/company/name> "DataBlend" .
<http://example.org/company/DataBlend> <http://example.org/company/vat> "BE0894.523.805" .
@datablend
datablend / sparql.xml
Created July 8, 2011 12:14
Simple sparql query
PREFIX person: <http://www.example.org/person/>
SELECT ?first_name ?age
WHERE {
person:Davy_Suvee person:first_name ?first_name .
person:Davy_Suvee person:age ?age
}
@datablend
datablend / RDF.xml
Created July 8, 2011 12:40
Simple RDF example
<http://example.org/person/Davy_Suvee> <http://example.org/person/first_name> "Davy" .
<http://example.org/person/Davy_Suvee> <http://example.org/person/last_name> "Suvee" .
<http://example.org/person/Davy_Suvee> <http://example.org/person/age> "31" .
<http://example.org/person/Davy_Suvee> <http://example.org/company> <http://example.org/company/DataBlend> .
<http://example.org/company/DataBlend> <http://example.org/company/name> "DataBlend" .
<http://example.org/company/DataBlend> <http://example.org/company/vat> "BE0894.523.805" .
@datablend
datablend / Test.java
Created July 8, 2011 13:24
Create graphdb connection
// Create the sail graph database
graphDb = new EmbeddedGraphDatabase("var/flights");
indexService = new LuceneIndexService(graphDb);
fulltextIndex = new SimpleFulltextIndex(graphDb, new File("var/flights/lucene-fulltext"));
rdfStore = new VerboseQuadStore(graphDb, indexService, null, fulltextIndex);
sail = new GraphDatabaseSail(graphDb, rdfStore);
// Initialize the sail store
sail.initialize();
@datablend
datablend / Test.java
Created July 8, 2011 18:10
Import rdf xml file
connection.add(getResource("sneeair.rdf"), null, RDFFormat.RDFXML, new Resource[]{});
// Create 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\" . " +
@datablend
datablend / Test.java
Created July 8, 2011 18:08
import RDF XML file
connection.add(getResource("sneeair.rdf"), null, RDFFormat.RDFXML, new Resource[]{});
// 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();
public class MyNeo4jGraph extends Neo4jGraph {
private long numberOfItems = 0;
private long maxNumberOfItems = 1;
public MyNeo4jGraph(final String directory, long maxNumberOfItems) {
super(directory, null);
this.maxNumberOfItems = maxNumberOfItems;
}
@datablend
datablend / fingerprints.json
Created August 6, 2011 14:10
fingerprint counts output
{
"fingerprint" : "0[N]1[C O]2[C C C]",
"count" : 472
}
{
"fingerprint" : "0[N]1[C O]2[C C C]3[C C C C C]",
"count" : 41
}
{
"fingerprint" : "0[O]1[C]2[C O]3[C C C]",