本文整理匯總了Java中org.openrdf.rio.RDFHandlerException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java RDFHandlerException.printStackTrace方法的具體用法?Java RDFHandlerException.printStackTrace怎麽用?Java RDFHandlerException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openrdf.rio.RDFHandlerException
的用法示例。
在下文中一共展示了RDFHandlerException.printStackTrace方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toByteArray
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
public static byte[] toByteArray(Set<Statement> statements) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
RDFHandler rdfHandler = new BinaryRDFWriter(os);
try {
rdfHandler.startRDF();
for (Statement statement : statements) {
rdfHandler.handleStatement(statement);
}
rdfHandler.endRDF();
} catch (RDFHandlerException e) {
e.printStackTrace();
}
return os.toByteArray();
}
示例2: writePredicateStatToVoid
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
private void writePredicateStatToVoid(URI dataset, URI predicate, long pCount, int distS, int distO) {
BNode propPartition = vf.createBNode();
Literal count = vf.createLiteral(String.valueOf(pCount));
Literal distinctS = vf.createLiteral(String.valueOf(distS));
Literal distinctO = vf.createLiteral(String.valueOf(distO));
try {
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.propertyPartition.toString()), propPartition));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.property.toString()), predicate));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.triples.toString()), count));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.distinctSubjects.toString()), distinctS));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.distinctObjects.toString()), distinctO));
} catch (RDFHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: writePredicateStatToVoid
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
private void writePredicateStatToVoid(URI predicate, long pCount, int distS, int distO) {
BNode propPartition = vf.createBNode();
Literal count = vf.createLiteral(String.valueOf(pCount));
Literal distinctS = vf.createLiteral(String.valueOf(distS));
Literal distinctO = vf.createLiteral(String.valueOf(distO));
try {
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.propertyPartition.toString()), propPartition));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.property.toString()), predicate));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.triples.toString()), count));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.distinctSubjects.toString()), distinctS));
writer.handleStatement(vf.createStatement(propPartition, vf.createURI(VOID2.distinctObjects.toString()), distinctO));
} catch (RDFHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例4: writeTypeStatToVoid
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
private void writeTypeStatToVoid(URI dataset, Value type, long tCount) {
BNode classPartition = vf.createBNode();
Literal count = vf.createLiteral(String.valueOf(tCount));
try {
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.classPartition.toString()), classPartition));
writer.handleStatement(vf.createStatement(classPartition, vf.createURI(VOID2.clazz.toString()), type));
writer.handleStatement(vf.createStatement(classPartition, vf.createURI(VOID2.entities.toString()), count));
} catch (RDFHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例5: writeTypeStatToVoid
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
private void writeTypeStatToVoid(Value type, long tCount) {
BNode classPartition = vf.createBNode();
Literal count = vf.createLiteral(String.valueOf(tCount));
try {
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.classPartition.toString()), classPartition));
writer.handleStatement(vf.createStatement(classPartition, vf.createURI(VOID2.clazz.toString()), type));
writer.handleStatement(vf.createStatement(classPartition, vf.createURI(VOID2.entities.toString()), count));
} catch (RDFHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例6: writeGeneralStats
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
private void writeGeneralStats() {
try {
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.triples.toString()), vf.createLiteral(String.valueOf(tripleCount))));
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.properties.toString()), vf.createLiteral(String.valueOf(predicates.size()))));
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.classes.toString()), vf.createLiteral(String.valueOf(typeCountMap.size()))));
writer.handleStatement(vf.createStatement(dataset, vf.createURI(VOID2.entities.toString()), vf.createLiteral(String.valueOf(entityCount))));
} catch (RDFHandlerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例7: getAnnotationAsJsonLd
import org.openrdf.rio.RDFHandlerException; //導入方法依賴的package包/類
/**
* This is a fast way to print the annotations. Much much faster using the
* appropriate SPARQL query. If this change is accepted in anno4j then we
* will remove this
*
* @param anno
* @return
*/
public String getAnnotationAsJsonLd(Annotation anno) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
/*
http://stackoverflow.com/questions/33241812/sparql-query-to-get-all-triples-related-to-a-specific-subject
CONSTRUCT {
<http://lifewatchgreece.eu/entity/annotations/6fe690c7-371e-476b-affd-919ba062ed13> ?prop ?val .
?child ?childProp ?childPropVal .
?someSubj ?incomingChildProp ?child .
}
WHERE {
<http://lifewatchgreece.eu/entity/annotations/6fe690c7-371e-476b-affd-919ba062ed13>?prop ?val ; (<>|!<>)+ ?child .
?child ?childProp ?childPropVal.
?someSubj ?incomingChildProp ?child.
}
*/
// Get the whole graph of a specific annotation
String query = "CONSTRUCT {\n"
+ " <" + anno.getResourceAsString() + "> ?prop ?val .\n"
+ " ?child ?childProp ?childPropVal . \n"
//+ " ?someSubj ?incomingChildProp ?child .\n"
+ "}\n"
+ "WHERE {\n"
+ " <" + anno.getResourceAsString() + "> ?prop ?val ; (<>|!<>)+ ?child . \n"
+ " ?child ?childProp ?childPropVal.\n"
//+ " ?someSubj ?incomingChildProp ?child. \n"
+ "}";
RDFWriter writer = Rio.createWriter(RDFFormat.JSONLD, out);
// Execute the query
GraphQueryResult results = sparqlGraphQuery(query);
Rio.write(QueryResults.asModel(results), writer);
} catch (RDFHandlerException e) {
e.printStackTrace();
} catch (QueryEvaluationException ex) {
Logger.getLogger(Anno4jRepository.class.getName()).log(Level.SEVERE, null, ex);
}
return out.toString();
}