本文整理匯總了Java中com.hp.hpl.jena.graph.Node.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getName方法的具體用法?Java Node.getName怎麽用?Java Node.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.graph.Node
的用法示例。
在下文中一共展示了Node.getName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMappingVarsOfTriple
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
HashMap<String, String[]> result = new HashMap<String, String[]>();
Node subject = t.getSubject();
Node predicate = t.getPredicate();
Node object = t.getObject();
if (subject.isVariable()) {
result.put(subject.getName(), new String[] { Tags.SUBJECT_COLUMN_NAME });
}
if (predicate.isVariable()) {
selectFromTripleStore = true;
result.put(predicate.getName(), new String[] { Tags.PREDICATE_COLUMN_NAME });
}
if (object.isVariable()) {
if (selectFromTripleStore) {
result.put(object.getName(), new String[] { Tags.OBJECT_COLUMN_NAME });
} else {
String objectString = object.getName();
String predicateString = getPropertyFromURI(FmtUtils
.stringForNode(predicate, prefixMapping), false);
result.put(objectString, new String[] { SpecialCharFilter.filter(predicateString) });
}
}
return result;
}
示例2: 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;
}
示例3: getMappingVarsOfTriple
import com.hp.hpl.jena.graph.Node; //導入方法依賴的package包/類
/**
* From a triple the method extracts the variable names
* and the columns to be selected from the table referring to that variable.
*
* @param t
* @return
*/
private HashMap<String, String[]> getMappingVarsOfTriple(Triple t) {
HashMap<String, String[]> result = new HashMap<String, String[]>();
Node subject = t.getSubject();
Node predicate = t.getPredicate();
Node object = t.getObject();
if (subject.isVariable()){
result.put(subject.getName(),
new String[] { Tags.SUBJECT_COLUMN_NAME });
}
if (predicate.isVariable()) {
selectFromTripleStore = true;
result.put(predicate.getName(),
new String[] { Tags.PREDICATE_COLUMN_NAME });
}
if (object.isVariable()) {
if (selectFromTripleStore) {
result.put(object.getName(),
new String[] { Tags.OBJECT_COLUMN_NAME });
} else {
String objectString = object.getName();
String predicateString = getPropertyFromURI(FmtUtils
.stringForNode(predicate, prefixMapping), false);
result.put(objectString, new String[] { SpecialCharFilter
.filter(predicateString) });
}
}
return result;
}