當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。