本文整理汇总了Java中com.hp.hpl.jena.graph.Node.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java Node.isBlank方法的具体用法?Java Node.isBlank怎么用?Java Node.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.graph.Node
的用法示例。
在下文中一共展示了Node.isBlank方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
/**
* Pretty-prints an RDF node and shortens URIs into QNames according to a
* {@link PrefixMapping}.
* @param n An RDF node
* @return An N-Triples style textual representation with URIs shortened to QNames
*/
public static String toString(Node n, PrefixMapping prefixes) {
if (n.isURI()) {
return qNameOrURI(n.getURI(), prefixes);
}
if (n.isBlank()) {
return "_:" + n.getBlankNodeLabel();
}
if (n.isVariable()) {
return "?" + n.getName();
}
if (Node.ANY.equals(n)) {
return "?ANY";
}
// Literal
String s = "\"" + n.getLiteralLexicalForm() + "\"";
if (!"".equals(n.getLiteralLanguage())) {
s += "@" + n.getLiteralLanguage();
}
if (n.getLiteralDatatype() != null) {
s += "^^" + qNameOrURI(n.getLiteralDatatypeURI(), prefixes);
}
return s;
}
示例2: limitTo
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
public void limitTo(Node node) {
if (isEmpty) return;
if (Node.ANY.equals(node) || node.isVariable()) {
return;
}
if (fixedNode == null) {
fixedNode = node;
} else if (!fixedNode.equals(node)) {
limitToEmptySet();
}
if (node.isURI()) {
limitToURIs();
limitValues(node.getURI());
}
if (node.isBlank()) {
limitToBlankNodes();
limitValues(node.getBlankNodeLabel());
}
if (node.isLiteral()) {
limitToLiterals(node.getLiteralLanguage(), node.getLiteralDatatype());
limitValues(node.getLiteralLexicalForm());
}
}
示例3: resource
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
protected String resource(Node rsrc) {
if (rsrc.isBlank()) {
return "http://marklogic.com/semantics/blank/" + Long.toHexString(
fuse(scramble((long)rsrc.hashCode()),fuse(scramble(milliSecs),randomValue)));
} else {
return escapeXml(rsrc.toString());
}
}
示例4: object
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
protected String object(Node node) {
if (node.isLiteral()) {
String text = node.getLiteralLexicalForm();
String type = node.getLiteralDatatypeURI();
String lang = node.getLiteralLanguage();
if (lang == null || "".equals(lang)) {
lang = "";
} else {
lang = " xml:lang='" + escapeXml(lang) + "'";
}
if ("".equals(lang)) {
if (type == null) {
type = "http://www.w3.org/2001/XMLSchema#string";
}
type = " datatype='" + escapeXml(type) + "'";
} else {
type = "";
}
return "<sem:object" + type + lang + ">" + escapeXml(text) + "</sem:object>";
} else if (node.isBlank()) {
return "<sem:object>http://marklogic.com/semantics/blank/" + Long.toHexString(
fuse(scramble((long)node.hashCode()),fuse(scramble(milliSecs),randomValue)))
+"</sem:object>";
} else {
return "<sem:object>" + escapeXml(node.toString()) + "</sem:object>";
}
}
示例5: translate
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
@Override
public SqlStatement translate() {
Select select = new Select(this._tableName);
select.setTabs(_tabs);
Map<String, String> vars = new HashMap<String, String>();
ArrayList<String> whereConditions = new ArrayList<String>();
boolean first = true;
Node subject = _t1.getSubject();
Node predicate = _t1.getPredicate();
Node object = _t1.getObject();
if (subject.isURI() || subject.isBlank()) {
whereConditions.add(Tags.SUBJECT_COLUMN_NAME + " = '"+ FmtUtils.stringForNode(subject,
this._prefixMapping).replace("http://yago-knowledge.org/resource/", "") + "'");
} else {
vars.put(Tags.SUBJECT_COLUMN_NAME, subject.getName());
}
if (predicate.isURI()) {
this._tableName = FmtUtils.stringForNode(predicate, this._prefixMapping).replace("http://yago-knowledge.org/resource/", "").replace(":", "__");
this.verticalPartitioning = true;
} else {
vars.put(Tags.PREDICATE_COLUMN_NAME, predicate.getName());
}
if (object.isURI() || object.isLiteral() || object.isBlank()) {
String string = FmtUtils.stringForNode(object,
this._prefixMapping).replace("http://yago-knowledge.org/resource/", "");
//if (object.isLiteral()) {
// string = "" + object.getLiteral().toString();
//}
whereConditions.add(Tags.OBJECT_COLUMN_NAME + " = '" + string + "'");
} else {
vars.put(Tags.OBJECT_COLUMN_NAME, object.getName());
}
ArrayList<String> varSet = new ArrayList<String>();
for (String var : vars.keySet()) {
select.addSelector(vars.get(var), new String[] { var });
varSet.add(vars.get(var));
}
select.setVariables(varSet);
// FROM
select.setFrom(this._tableName);
// WHERE
for (String where : whereConditions) {
select.addConjunction(where);
}
select.setDistinct(_isDistinct);
return select;
}
示例6: matches
import com.hp.hpl.jena.graph.Node; //导入方法依赖的package包/类
public boolean matches(Node node) { return node.isBlank(); }