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
{ | |
"compound_cid" : "46200001" , | |
"smiles" : "CCC1C(C(C(C(=NOCC=CCN2CCCCC2)C(CC(C(C(C(C(C(=O)O1)C)OC3CC(C(C(O3)C)O)(C)OC)C)OC4C(C(CC(O4)C)N(C)CC5=CC=CC=C5)O)(C)O)C)C)O)(C)O" , | |
"fingerprint_count" : 120 , | |
"fingerprints" : [ | |
"0[N]1[C O]2[C C C]" , | |
"0[N]1[C O]2[C C C]3[C C C C C]" , | |
"0[C]1[C C C]2[C C N O]3[C C C C O O]" , | |
"0[C]1[C C]2[C C C C O]3[C C N O]" , | |
"0[O]1[C]2[C O]3[C C C]" , |
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
{ | |
"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]", |
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
// Calculate the essential numbers | |
int maxnumberofcompoundfingerprints = (int) (fingerprintsToFind.size() / 0.6); | |
int minnumberofcompoundfingerprints = (int) (fingerprintsToFind.size() * 0.6); | |
int numberoffingerprintstoconsider = fingerprintsToFind.size() - minnumberofcompoundfingerprints; | |
List<String> fingerprintsToConsider = fingerprintsToFind.subList(0,numberoffingerprintstoconsider+1); | |
// Find all compounds that satisfy the specified conditions | |
DBObject compoundquery = | |
QueryBuilder.start(FINGERPRINTS_PROPERTY).in(fingerprintsToConsider) |
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
neograph = new Neo4jGraph("var/rdf"); | |
// Let's use manual transaction mode | |
neograph.setMaxBufferSize(0); | |
sail = new ForwardChainingRDFSInferencer(new GraphSail(neograph)); | |
sail.initialize(); | |
connection = sail.getConnection(); | |
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
InferenceLoop loop = new InferenceLoop(); | |
Scanner in = new Scanner(System.in); | |
while (true) { | |
System.out.println("Provide RDF statement:"); | |
System.out.print("=> "); | |
String input = in.nextLine(); | |
System.out.println("The following edges were created:"); | |
loop.inference(input); | |
} |
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
// Parses and add the RDF statement accordingly | |
public void inference(String statement) throws SailException, InterruptedException { | |
String[] triple = statement.split(" "); | |
inference(new URIImpl(triple[0]), new URIImpl(triple[1]), new URIImpl(triple[2])); | |
} | |
// Add the inference | |
public void inference(URI subject, URI predicate, URI object) throws SailException, InterruptedException { | |
neograph.startTransaction(); | |
connection.addStatement(subject, predicate, object); |
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
// Parses and add the RDF statement accordingly | |
public void inference(String statement) throws SailException, InterruptedException { | |
String[] triple = statement.split(" "); | |
inference(new URIImpl(triple[0]), new URIImpl(triple[1]), new URIImpl(triple[2])); | |
} | |
// Add the inference | |
public void inference(URI subject, URI predicate, URI object) throws SailException, InterruptedException { | |
neograph.startTransaction(); | |
connection.addStatement(subject, predicate, object); |
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
public class PushTransactionEventHandler implements TransactionEventHandler<Object> { | |
private int id = 1; | |
public void afterCommit(TransactionData transactionData, Object o) { | |
// Retrieve the created relationships. (The relevant nodes will be retrieved through these relationships) | |
Iterable<Relationship> relationships = transactionData.createdRelationships(); | |
// Iterate and add | |
for (Relationship relationship : relationships) { |
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
public class PushUtility { | |
private static final String url = "http://localhost:8080/workspace0?operation=updateGraph"; | |
private static final String nodejson = "{\"an\":{\"%1$s\":{\"label\":\"%1$s\"}}}"; | |
private static final String edgejson = "{\"ae\":{\"%1$d\":{\"source\":\"%2$s\",\"target\":\"%3$s\",\"directed\":true,\"label\":\"%4$s\",\"inferred\":\"%5$b\"}}}"; | |
private static void push(String message) { | |
try { | |
// Create a connection and push the node or edge json message | |
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); |
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
http://datablend.be/example/teaches http://www.w3.org/2000/01/rdf-schema#domain http://datablend.be/example/teacher | |
http://datablend.be/example/teaches http://www.w3.org/2000/01/rdf-schema#range http://datablend.be/example/student | |
http://datablend.be/example/Davy http://datablend.be/example/teaches http://datablend.be/example/Bob |