AGFreetextSearch.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGFreetextSearch {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("freetextsearch", AGPaths.TRIPLE_STORES);
ts.registerFreetextPredicate("<http://www.w3.org/2000/01/rdf-schema#comment>");
ts.addStatement("\"Jans\"", "!rdfs:comment", "\"Born in Emmen in the Netherlands\"");
ts.addStatement("\"Gary\"", "!rdfs:comment", "\"Born in Springfield in the USA\"");
ts.addStatement("\"Henk\"", "!rdfs:label", "\"Born in Emmermeer in the Netherlands\"");
ValueObject[] v = ts.getFreetextUniqueSubjects("(and 'emmen' 'born')");
AGUtils.printObjectArray("Subjects matching search: (and 'emmen' 'born')", v);
Cursor cc = ts.getFreetextStatements("(and 'emmen' 'born')");
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next