本文整理匯總了Java中com.hp.hpl.jena.graph.Node.isURI方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.isURI方法的具體用法?Java Node.isURI怎麽用?Java Node.isURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.graph.Node
的用法示例。
在下文中一共展示了Node.isURI方法的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: limitTo
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
public void limitTo(Node node) {
logger.debug("limitting to " + node);
if (node.isURI())
limitedToURIs = true;
else if (node.isLiteral())
limitedToLiterals = true;
else if (Var.isBlankNodeVar(node))
limitedToBlankNodes = true;
}
示例4: classMapNamesForResource
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
public Collection<String> classMapNamesForResource(Node resource) {
if (!resource.isURI()) {
return Collections.<String>emptyList();
}
List<String> results = new ArrayList<String>();
for (Entry<String,NodeMaker> entry: classMapNodeMakers.entrySet()) {
String classMapName = entry.getKey();
NodeMaker nodeMaker = entry.getValue();
if (!nodeMaker.selectNode(resource, RelationalOperators.DUMMY).equals(NodeMaker.EMPTY)) {
results.add(classMapName);
}
}
return results;
}
示例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.isURI(); }