本文整理汇总了Java中org.openrdf.rio.RDFParserRegistry.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java RDFParserRegistry.getInstance方法的具体用法?Java RDFParserRegistry.getInstance怎么用?Java RDFParserRegistry.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.rio.RDFParserRegistry
的用法示例。
在下文中一共展示了RDFParserRegistry.getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRio
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
/**
* This is needed, because Rio is unable to find the Parser/Writer Factories
* automatically when the jar gets deployed as plugin inside the Neo4j
* Server.
*/
private synchronized void initRio() {
if (!rioInitialized) {
RDFParserRegistry parserRegistry = RDFParserRegistry.getInstance();
parserRegistry.add(new TurtleParserFactory());
parserRegistry.add(new YARSParserFactory());
parserRegistry.add(new RDFXMLParserFactory());
parserRegistry.add(new NTriplesParserFactory());
parserRegistry.add(new RDFJSONParserFactory());
RDFWriterRegistry writerRegistry = RDFWriterRegistry.getInstance();
writerRegistry.add(new TurtleWriterFactory());
writerRegistry.add(new YARSWriterFactory());
writerRegistry.add(new RDFXMLWriterFactory());
writerRegistry.add(new NTriplesWriterFactory());
writerRegistry.add(new RDFJSONWriterFactory());
rioInitialized = true;
}
}
示例2: initRio
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
/**
* This is needed, because Rio is unable to find the Parser/Writer Factories
* automatically when the jar gets deployed as plugin inside the Neo4j
* Server.
*/
private synchronized void initRio() {
if (!rioInitialized) {
RDFParserRegistry parserRegistry = RDFParserRegistry.getInstance();
parserRegistry.add(new TurtleParserFactory());
parserRegistry.add(new RDFXMLParserFactory());
parserRegistry.add(new NTriplesParserFactory());
parserRegistry.add(new RDFJSONParserFactory());
RDFWriterRegistry writerRegistry = RDFWriterRegistry.getInstance();
writerRegistry.add(new TurtleWriterFactory());
writerRegistry.add(new RDFXMLWriterFactory());
writerRegistry.add(new NTriplesWriterFactory());
writerRegistry.add(new RDFJSONWriterFactory());
rioInitialized = true;
}
}
示例3: getFormat
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
private static RDFFormat getFormat(File file){
String fileName = file.getName();
if (fileName.endsWith(".n3")){
fileName = "try.ttl";
}
RDFParserRegistry reg = RDFParserRegistry.getInstance();
FileFormat fileFormat = reg.getFileFormatForFileName(fileName);
if (fileFormat == null || !(fileFormat instanceof RDFFormat)){
//added bridgeDB/OPS specific extension here if required.
logger.warn("OpenRDF does not know the RDF Format for " + fileName);
logger.warn("Using the default format " + DEFAULT_FILE_FORMAT);
return DEFAULT_FILE_FORMAT;
} else {
return (RDFFormat)fileFormat;
}
}
示例4: forFileName
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
private RDFFormat forFileName(String path, RDFFormat fallback) {
RDFFormat format = RDFFormat.forFileName(path);
RDFParserRegistry registry = RDFParserRegistry.getInstance();
if (format != null && registry.has(format))
return format;
return fallback;
}
示例5: forMIMEType
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
private RDFFormat forMIMEType(String contentType, RDFFormat fallback) {
RDFFormat format = RDFFormat.forMIMEType(contentType);
RDFParserRegistry registry = RDFParserRegistry.getInstance();
if (format != null && registry.has(format))
return format;
return fallback;
}
示例6: initialise
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
@PostConstruct
public void initialise() {
log.info("registering RDF importer ...");
RDFParserRegistry parserRegistry = RDFParserRegistry.getInstance();
acceptTypes = new ArrayList<String>();
for(RDFFormat format : parserRegistry.getKeys()) {
acceptTypes.addAll(format.getMIMETypes());
}
log.info(" - available parsers: {}", Arrays.toString(acceptTypes.toArray()));
}
示例7: getParser
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
public static RDFParser getParser(String address, String rdfFormatName) throws BridgeDBException{
RDFParserRegistry reg = RDFParserRegistry.getInstance();
RDFFormat format = null;
if (rdfFormatName == null || rdfFormatName.isEmpty()){
if (address.endsWith(".gz")){
address = address.substring(0, address.length()-3);
}
if (address.endsWith(".n3")){
address = "try.ttl";
}
FileFormat fileFormat = reg.getFileFormatForFileName(address);
if (fileFormat == null || !(fileFormat instanceof RDFFormat)){
//added bridgeDB/OPS specific extension here if required.
logger.warn("OpenRDF does not know the RDF Format for " + address);
logger.warn("Using the default format " + DEFAULT_PARSER);
return DEFAULT_PARSER;
}
format = (RDFFormat)fileFormat;
} else {
for (RDFFormat rdfFormat:RDFFormat.values()){
if (rdfFormat.getName().equalsIgnoreCase(rdfFormatName)){
format = rdfFormat;
}
if (format == null){
throw new BridgeDBException("No RdfFormat with name " + rdfFormatName + " known");
}
}
}
RDFParserFactory factory = reg.get(format);
return factory.getParser();
}
示例8: getFormat
import org.openrdf.rio.RDFParserRegistry; //导入方法依赖的package包/类
private static RDFFormat getFormat(String fileName) throws BridgeDBException{
if (fileName.endsWith(".n3")){
fileName = "try.ttl";
}
RDFParserRegistry reg = RDFParserRegistry.getInstance();
FileFormat fileFormat = reg.getFileFormatForFileName(fileName);
if (fileFormat == null || !(fileFormat instanceof RDFFormat)){
//added bridgeDB/OPS specific extension here if required.
throw new BridgeDBException("failed");
} else {
return (RDFFormat)fileFormat;
}
}