本文整理汇总了Java中org.apache.jena.graph.Node.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Node.equals方法的具体用法?Java Node.equals怎么用?Java Node.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.graph.Node
的用法示例。
在下文中一共展示了Node.equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processClassNode
import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
* Converts the node that is supposed to represent a class in the knowledge
* base into an NL phrase.
*
* @param node
* the node
* @param plural
* whether the plural form should be used
* @return the NL phrase
*/
public NPPhraseSpec processClassNode(Node node, boolean plural) {
NPPhraseSpec object;
if (node.equals(OWL.Thing.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.ENTITY.getNlr());
} else if (node.equals(RDFS.Literal.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.VALUE.getNlr());
} else if (node.equals(RDF.Property.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.RELATION.getNlr());
} else if (node.equals(RDF.type.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.TYPE.getNlr());
} else {
String label = uriConverter.convert(node.getURI());
if (label != null) {
// get the singular form
// label = PlingStemmer.stem(label);
// we assume that classes are always used in lower case format
label = label.toLowerCase();
object = nlgFactory.createNounPhrase(nlgFactory.createWord(label, LexicalCategory.NOUN));
} else {
object = nlgFactory.createNounPhrase(GenericType.ENTITY.getNlr());
}
}
// set plural form
object.setPlural(plural);
return object;
}
示例2: processClassNode
import org.apache.jena.graph.Node; //导入方法依赖的package包/类
/**
* Converts the node that is supposed to represent a class in the knowledge
* base into an NL phrase.
*
* @param node
* the node
* @param plural
* whether the plural form should be used
* @return the NL phrase
*/
public NPPhraseSpec processClassNode(Node node, boolean plural) {
NPPhraseSpec object;
if (node.equals(OWL.Thing.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.ENTITY.getNlr());
} else if (node.equals(RDFS.Literal.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.VALUE.getNlr());
} else if (node.equals(RDF.Property.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.RELATION.getNlr());
} else if (node.equals(RDF.type.asNode())) {
object = nlgFactory.createNounPhrase(GenericType.TYPE.getNlr());
} else {
String label = uriConverter.convert(node.getURI());
if (label != null) {
// get the singular form
label = PlingStemmer.stem(label);
// we assume that classes are always used in lower case format
label = label.toLowerCase();
object = nlgFactory.createNounPhrase(nlgFactory.createInflectedWord(label, LexicalCategory.NOUN));
} else {
object = nlgFactory.createNounPhrase(GenericType.ENTITY.getNlr());
}
}
// set plural form
object.setPlural(plural);
return object;
}
示例3: printProperty
import org.apache.jena.graph.Node; //导入方法依赖的package包/类
private int printProperty(Node p) {
String str = slotToString(p);
if (p.equals(RDF.Nodes.type) && str.equals(RDFTYPE)) {
out.print("a");
} else {
out.print(str);
}
out.pad(predicateWidth);
return str.length();
}
示例4: match
import org.apache.jena.graph.Node; //导入方法依赖的package包/类
public static boolean match(Node node, Node pattern) {
return pattern == null || pattern == Node.ANY || pattern.equals(node);
}