本文整理汇总了Java中org.openrdf.rio.RDFWriterFactory类的典型用法代码示例。如果您正苦于以下问题:Java RDFWriterFactory类的具体用法?Java RDFWriterFactory怎么用?Java RDFWriterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RDFWriterFactory类属于org.openrdf.rio包,在下文中一共展示了RDFWriterFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getExportStatementsResult
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
/**
* Get all statements and export them as RDF.
*
* @param repository the Repository object
* @param request the HttpServletRequest object
* @param response the HttpServletResponse object
* @return a model and view for exporting the statements.
* @throws ClientHTTPException throws when errors in parameters
*/
private ModelAndView getExportStatementsResult(final Repository repository, final HttpServletRequest request,
final HttpServletResponse response)
throws ClientHTTPException {
ProtocolUtil.logRequestParameters(request);
ValueFactory vf = repository.getValueFactory();
URI graph = getGraphName(request, vf);
RDFWriterFactory rdfWriterFactory = ProtocolUtil.getAcceptableService(request, response,
RDFWriterRegistry.getInstance());
Map<String, Object> model = new HashMap<String, Object>();
model.put(ExportStatementsView.CONTEXTS_KEY, new Resource[] { graph });
model.put(ExportStatementsView.FACTORY_KEY, rdfWriterFactory);
model.put(ExportStatementsView.USE_INFERENCING_KEY, true);
model.put(ExportStatementsView.HEADERS_ONLY, METHOD_HEAD.equals(request.getMethod()));
return new ModelAndView(ExportStatementsView.getInstance(), model);
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:30,代码来源:GraphHandler.java
示例2: createWriter
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
private RDFWriter createWriter(StringWriter writer) {
RDFWriter result=null;
if(format.equals(Format.TURTLE)) {
result=new TurtlePrettyPrinter(new MemValueFactory().createURI(baseURI.toString()),writer);
} else {
RDFWriterRegistry registry=RDFWriterRegistry.getInstance();
RDFFormat rawFormat=Rio.getWriterFormatForMIMEType(format.getMime(),RDFFormat.RDFXML);
RDFWriterFactory factory=registry.get(rawFormat);
result=factory.getWriter(writer);
if(format.equals(Format.JSON_LD)) {
result.getWriterConfig().set(JSONLDSettings.JSONLD_MODE,JSONLDMode.FLATTEN);
result.getWriterConfig().set(BasicWriterSettings.PRETTY_PRINT,true);
}
}
return result;
}
开发者ID:ldp4j,项目名称:ldp4j,代码行数:17,代码来源:RDFModelFormater.java
示例3: SPARQLGraphStreamingOutput
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
/**
* Creates a new graph streaming output that executes a CONSTRUCT query
* and streams the result.
*
* @param query the CONSTRUCT query to execute
* @param writerFactory a RDF writer factory to use for serialisation
* @param conn the connection to use for query execution
*/
public SPARQLGraphStreamingOutput(
GraphQuery query,
RDFWriterFactory writerFactory,
RepositoryConnection conn) {
super(conn);
this.query = query;
this.factory = writerFactory;
}
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:17,代码来源:SPARQLGraphStreamingOutput.java
示例4: writeN3
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
private void writeN3( Iterable<Statement> graph )
throws RDFHandlerException, IOException
{
RDFWriterFactory writerFactory = new N3WriterFactory();
RDFWriter writer = writerFactory.getWriter( System.out );
writeOutput( writer, graph );
}
开发者ID:apache,项目名称:polygene-java,代码行数:8,代码来源:ApplicationXmlTest.java
示例5: writeXml
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
private void writeXml( Iterable<Statement> graph )
throws RDFHandlerException, IOException
{
RDFWriterFactory writerFactory = new RDFXMLWriterFactory();
RDFWriter writer = writerFactory.getWriter( System.out );
writeOutput( writer, graph );
}
开发者ID:apache,项目名称:polygene-java,代码行数:8,代码来源:ApplicationXmlTest.java
示例6: getExportStatementsResult
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
/**
* Get all statements and export them as RDF.
*
* @param repository the Repository object
* @param request the HttpServletRequest object
* @param response the HttpServletResponse object
* @return a model and view for exporting the statements.
* @throws ClientHTTPException throws when there errors in parsing the request
*/
private ModelAndView getExportStatementsResult(final Repository repository, final HttpServletRequest request,
final HttpServletResponse response)
throws ClientHTTPException {
ProtocolUtil.logRequestParameters(request);
ValueFactory vf = repository.getValueFactory();
Resource subj = ProtocolUtil.parseResourceParam(request, SUBJECT_PARAM_NAME, vf);
URI pred = ProtocolUtil.parseURIParam(request, PREDICATE_PARAM_NAME, vf);
Value obj = ProtocolUtil.parseValueParam(request, OBJECT_PARAM_NAME, vf);
Resource[] contexts = ProtocolUtil.parseContextParam(request, CONTEXT_PARAM_NAME, vf);
boolean useInferencing = ProtocolUtil.parseBooleanParam(request, INCLUDE_INFERRED_PARAM_NAME, true);
RDFWriterFactory rdfWriterFactory = ProtocolUtil.getAcceptableService(request, response,
RDFWriterRegistry.getInstance());
Map<String, Object> model = new HashMap<String, Object>();
model.put(ExportStatementsView.SUBJECT_KEY, subj);
model.put(ExportStatementsView.PREDICATE_KEY, pred);
model.put(ExportStatementsView.OBJECT_KEY, obj);
model.put(ExportStatementsView.CONTEXTS_KEY, contexts);
model.put(ExportStatementsView.USE_INFERENCING_KEY, Boolean.valueOf(useInferencing));
model.put(ExportStatementsView.FACTORY_KEY, rdfWriterFactory);
model.put(ExportStatementsView.HEADERS_ONLY, METHOD_HEAD.equals(request.getMethod()));
model.put(ExportStatementsView.REPO_KEY, repository);
return new ModelAndView(ExportStatementsView.getInstance(), model);
}
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:37,代码来源:StatementHandler.java
示例7: getWriterIfPossible
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
/**
* This method is required as at last check the BinaryRDFWriterFactory was not fully implemeneted.
* @param format
* @param writer
* @return
*/
private static RDFWriter getWriterIfPossible(RDFFormat format, Writer writer){
RDFWriterRegistry register = RDFWriterRegistry.getInstance();
RDFWriterFactory factory = register.get(format);
if (factory == null){
return null;
}
try {
return factory.getWriter(writer);
} catch (Exception ex){
logger.error(ex);
return null;
}
}
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:20,代码来源:BridgeDbRdfTools.java
示例8: AbstractSerializer
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
protected AbstractSerializer( Class<? extends RDFWriterFactory> writerFactoryClass )
{
this.writerFactoryClass = writerFactoryClass;
}
开发者ID:apache,项目名称:polygene-java,代码行数:5,代码来源:AbstractSerializer.java
示例9: getRDFWriterFactory
import org.openrdf.rio.RDFWriterFactory; //导入依赖的package包/类
/**
* Returns a {@link RDFWriterFactory} that produces RDF data according to a
* given MIME-type.
*
* @param mimetype the mimetype
* @return the corresponding writer factory
*/
private RDFWriterFactory getRDFWriterFactory(String mimetype) {
RDFWriterRegistry registry = RDFWriterRegistry.getInstance();
return registry.get(getRDFFormat(mimetype));
}
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:12,代码来源:SPARQLQuery.java
注:本文中的org.openrdf.rio.RDFWriterFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论