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


Java ResourceUtils类代码示例

本文整理汇总了Java中org.apache.jena.util.ResourceUtils的典型用法代码示例。如果您正苦于以下问题:Java ResourceUtils类的具体用法?Java ResourceUtils怎么用?Java ResourceUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceUtils类属于org.apache.jena.util包,在下文中一共展示了ResourceUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: representation

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
@Override
public InputStream representation() {
    final ByteArrayOutputStream out = new ByteArrayOutputStream();

    final RDFWriter writer = doc.getWriter(lang.getName());

    // To allow relative URIs in XML, if desired
    writer.setProperty("allowBadURIs", "true");

    if (useRelativeURIs && Lang.NTRIPLES.equals(lang)) {
        final URI uri = URI.create(resourceURI);
        final String serviceDocURI = routing.serviceDocFor(uri).toString();

        doc.listSubjects()
                .andThen(
                        doc.listObjects()
                                .filterKeep(RDFNode::isURIResource)
                                .mapWith(RDFNode::asResource))
                .filterKeep(Resource::isURIResource)
                .filterKeep(u -> u.getURI().startsWith("#") || u.getURI().equals("")).toSet()
                .forEach(r -> ResourceUtils.renameResource(r,
                        serviceDocURI + r.getURI()));
    }

    writer.write(doc, out, base);

    return new ByteArrayInputStream(out.toByteArray());
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-api-x,代码行数:29,代码来源:ServiceDocumentGenerator.java

示例2: replaceVar

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
public QueryBuilder replaceVar(String varName, String uri)
   {
if (varName == null) throw new IllegalArgumentException("Variable name cannot be null");
if (uri == null) throw new IllegalArgumentException("URI value cannot be null");

if (log.isTraceEnabled()) log.trace("Replacing variable ?{} with URI: {}", varName, uri);
    
Resource var = getVarByName(varName);
var.removeAll(SP.varName);
ResourceUtils.renameResource(var, uri);

return this;
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:14,代码来源:QueryBuilder.java

示例3: isWhereVariable

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
protected boolean isWhereVariable(Variable var)
   {
ResIterator it = ResourceUtils.reachableClosure(getWhere()).
    listSubjectsWithProperty(SP.varName, var.getName());

try
{
    return it.hasNext();
}
finally
{
    it.close();
}
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:15,代码来源:QueryBuilder.java

示例4: build

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
public Model build(Model model)
   {
   	if (model == null) throw new IllegalArgumentException("Model cannot be null");

Map<Resource, String> resourceURIMap = new HashMap<>();
ResIterator resIt = model.listSubjects();
try
{
    while (resIt.hasNext())
    {
	Resource resource = resIt.next();
               if (resource.isAnon())
               {
                   URI uri = build(resource);
                   if (uri != null) resourceURIMap.put(resource, uri.toString());
               }
    }
}
finally
{
    resIt.close();
}

Iterator<Map.Entry<Resource, String>> entryIt = resourceURIMap.entrySet().iterator();
while (entryIt.hasNext())
{
    Map.Entry<Resource, String> entry = entryIt.next();
    ResourceUtils.renameResource(entry.getKey(), entry.getValue());
}

return model;
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:33,代码来源:Skolemizer.java

示例5: flatten

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
/**
 * Merges the version information onto a root VersionedThing.
 */
public static void flatten(Resource root, Resource version) {
    ResourceUtils.renameResource(version, root.getURI());
    root.removeAll(Version.currentVersion);
    root.removeAll(Version.interval);
    root.removeAll(DCTerms.isVersionOf);
    root.removeAll(DCTerms.replaces);
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:11,代码来源:VersionUtil.java

示例6: skolemize

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
/**
 * If the entity is a bNode then skolemize it
 */
public void skolemize() {
    if (entity != null && entity.isAnon()) {
        String skolemURI = Registry.get().baseURI + "/.well-known/skolem/" + entity.getId();
        ResourceUtils.renameResource(entity, skolemURI);
        entity = entity.getModel().createResource( skolemURI );
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:11,代码来源:RegisterItem.java

示例7: relocate

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
private void relocate() {
    String uri = makeItemURI(parentURI, getNotation());
    if ( ! uri.equals(root.getURI()) ) {
        ResourceUtils.renameResource(root, uri);
    }
    root = root.getModel().createResource(uri);
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:8,代码来源:RegisterItem.java

示例8: relocateEntity

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
private void relocateEntity(Resource srcEntity) {
    String uri = entityURI(srcEntity);
    if ( ! uri.equals(srcEntity.getURI()) ) {
        ResourceUtils.renameResource(srcEntity, uri);
        entity = srcEntity.getModel().createResource(uri);
    } else {
        entity = srcEntity;
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:10,代码来源:RegisterItem.java

示例9: normalizeRoot

import org.apache.jena.util.ResourceUtils; //导入依赖的package包/类
/**
 * The query argument order of the root resouce can vary depending on execution
 * environment, normalize it
 */
protected void normalizeRoot(Model m, String base, String arg) {
    List<String> args = new ArrayList<>();
    for (String a : arg.split("&")) args.add(a);
    Set<String> perms = new HashSet<>();
    permute(args, 0, perms);
    for (String perm : perms) {
        Resource r = m.getResource(base + "?" + perm);
        if (r.listProperties().hasNext()) {
            ResourceUtils.renameResource(r, base + "?" + arg);
        }
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:17,代码来源:TestSearchAPI.java


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