本文整理匯總了Java中com.hp.hpl.jena.graph.Node.isLiteral方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.isLiteral方法的具體用法?Java Node.isLiteral怎麽用?Java Node.isLiteral使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.graph.Node
的用法示例。
在下文中一共展示了Node.isLiteral方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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());
}
}
示例2: 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>";
}
}
示例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: isSimpleLiteral
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
static boolean isSimpleLiteral(Node node)
{
if (!node.isLiteral())
return false;
return node.getLiteralDatatype() == null && "".equals(node.getLiteralLanguage());
}
示例5: isNumeric
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
public static boolean isNumeric(Node node)
{
if (!node.isLiteral())
return false;
RDFDatatype datatype = node.getLiteral().getDatatype();
return datatype != null && isNumeric(datatype);
}
示例6: isString
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
public static boolean isString(Node node)
{
if (!node.isLiteral())
return false;
return XSDDatatype.XSDstring.equals(node.getLiteralDatatype());
}
示例7: 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;
}
示例8: matches
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
public boolean matches(Node node) {
return node.isLiteral()
&& this.language.equals(node.getLiteralLanguage())
&& ((this.datatype == null && node.getLiteralDatatype() == null)
|| (this.datatype != null && this.datatype.equals(node.getLiteralDatatype())));
}