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


Java Resource.stringValue方法代码示例

本文整理汇总了Java中org.openrdf.model.Resource.stringValue方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.stringValue方法的具体用法?Java Resource.stringValue怎么用?Java Resource.stringValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.model.Resource的用法示例。


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

示例1: createStatementRegex

import org.openrdf.model.Resource; //导入方法依赖的package包/类
/**
 * Creates a Regular Expression to match serialized statements meeting these constraints. A <code>null</code> or empty parameters imply
 * no constraint. A <code>null</code> return value implies no constraints.
 * 
 * @param context
 *            context constraint
 * @param subject
 *            subject constraint
 * @param predicates
 *            list of predicate constraints
 * @return a regular expression that can be used to match serialized statements. A <code>null</code> return value implies no
 *         constraints.
 */
public static String createStatementRegex(StatementConstraints contraints) {
    Resource context = contraints.getContext();
    Resource subject = contraints.getSubject();
    Set<URI> predicates = contraints.getPredicates();
    if (context == null && subject == null && (predicates == null || predicates.isEmpty())) {
        return null;
    }

    // match on anything but a separator
    String anyReg = "[^" + SEP + "]*";

    // if context is empty, match on any context
    String contextReg = (context == null) ? anyReg : context.stringValue();

    // if subject is empty, match on any subject
    String subjectReg = (subject == null) ? anyReg : subject.stringValue();

    // if the predicates are empty, match on any predicate. Otherwise, "or" the predicates.
    String predicateReg = "";
    if (predicates == null || predicates.isEmpty()) {
        predicateReg = anyReg;
    } else {
        predicateReg = "(" + StringUtils.join(predicates, "|") + ")";
    }

    return "^" + contextReg + SEP + subjectReg + SEP + predicateReg + SEP + ".*";
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:41,代码来源:StatementSerializer.java

示例2: TypeRequirementVisitor

import org.openrdf.model.Resource; //导入方法依赖的package包/类
public TypeRequirementVisitor(String varName, Resource requiredType) {
    final Var typeVar = new Var("-const-" + requiredType.stringValue(), requiredType);
    typeVar.setConstant(true);
    this.varName = varName;
    if (BASE_TYPES.contains(requiredType)) {
        this.typeRequirement = null;
    }
    else {
        this.typeRequirement = new StatementPattern(new Var(varName), RDF_TYPE_VAR, typeVar);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:12,代码来源:SpinConstructRule.java

示例3: encodeIdentifier

import org.openrdf.model.Resource; //导入方法依赖的package包/类
private Object encodeIdentifier(final Resource identifier) {
    if (identifier instanceof URI) {
        try {
            final Integer key = this.dictionary.keyFor((URI) identifier, false);
            if (key != null) {
                return AvroSerializer.newGenericRecord(AvroSchemas.COMPRESSED_IDENTIFIER, key);
            }
        } catch (final IOException ex) {
            throw new IllegalStateException("Cannot access dictionary: " + ex.getMessage(), ex);
        }
    }
    final String id = identifier instanceof BNode ? "_:" + ((BNode) identifier).getID()
            : identifier.stringValue();
    return AvroSerializer.newGenericRecord(AvroSchemas.PLAIN_IDENTIFIER, id);
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:16,代码来源:AvroSerializer.java

示例4: encodeIdentifier

import org.openrdf.model.Resource; //导入方法依赖的package包/类
private Object encodeIdentifier(final Resource identifier) {
    if (identifier instanceof URI) {
        try {
            final Integer key = this.dictionary.keyFor((URI) identifier, false);
            if (key != null) {
                return SerializerAvro.newGenericRecord(Schemas.COMPRESSED_IDENTIFIER, key);
            }
        } catch (final IOException ex) {
            throw new IllegalStateException("Cannot access dictionary: " + ex.getMessage(), ex);
        }
    }
    final String id = identifier instanceof BNode ? "_:" + ((BNode) identifier).getID()
            : identifier.stringValue();
    return SerializerAvro.newGenericRecord(Schemas.PLAIN_IDENTIFIER, id);
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:16,代码来源:SerializerAvro.java

示例5: resourceToString

import org.openrdf.model.Resource; //导入方法依赖的package包/类
/**
 * Returns the correct syntax for a Resource, 
 * depending on whether it is a URI or a Blank Node (ie, BNode)
 * 
 * @param uriOrBnode The resource to serialise to a string
 * @return The string value of the sesame resource
 */
private static String resourceToString(Resource uriOrBnode)
{
	if(uriOrBnode instanceof URI)
	{
		return uriOrBnode.stringValue();
	}
	else
	{
		return "_:" + ((BNode)uriOrBnode).getID();
	}
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:19,代码来源:RDFJSON.java

示例6: resourceToString

import org.openrdf.model.Resource; //导入方法依赖的package包/类
/**
 * Returns the correct syntax for a Resource, depending on whether it is a URI
 * or a Blank Node (ie, BNode)
 * 
 * @param uriOrBnode
 *          The resource to serialise to a string
 * @return The string value of the sesame resource
 */
private static String resourceToString(Resource uriOrBnode) {
	if (uriOrBnode instanceof URI) {
		return uriOrBnode.stringValue();
	} else {
		return "_:" + ((BNode) uriOrBnode).getID();
	}
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:16,代码来源:RDFGSON.java


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