当前位置: 首页>>代码示例>>Java>>正文


Java RDFParserRegistry.getInstance方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:23,代码来源:RepositoryRegistry.java

示例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;
	}
}
 
开发者ID:niclashoyer,项目名称:neo4j-sparql-extension,代码行数:21,代码来源:RepositoryRegistry.java

示例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;
    }
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:17,代码来源:BridgeDBRdfHandler.java

示例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;
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:8,代码来源:OntologyLoader.java

示例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;
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:8,代码来源:OntologyLoader.java

示例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()));

}
 
开发者ID:apache,项目名称:marmotta,代码行数:15,代码来源:RDFImporterImpl.java

示例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();
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:32,代码来源:RdfParser.java

示例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;
    }
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:14,代码来源:LinkSetCombiner.java


注:本文中的org.openrdf.rio.RDFParserRegistry.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。