本文整理匯總了Java中org.apache.clerezza.rdf.core.Language類的典型用法代碼示例。如果您正苦於以下問題:Java Language類的具體用法?Java Language怎麽用?Java Language使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Language類屬於org.apache.clerezza.rdf.core包,在下文中一共展示了Language類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.apache.clerezza.rdf.core.Language; //導入依賴的package包/類
@BeforeClass
public static void init(){
LiteralFactory lf = LiteralFactory.getInstance();
UriRef pers1 = new UriRef("http://www.example.org/test#pers1");
UriRef pers2 = new UriRef("http://www.example.org/test#pers2");
MGraph data = new SimpleMGraph();
//NOTE: This test a language literal with and without language as
// well as a xsd:string typed literal. To test correct handling of
// RDF1.1
data.add(new TripleImpl(pers1, RDF.type, FOAF.Person));
data.add(new TripleImpl(pers1, FOAF.name, new PlainLiteralImpl("Rupert Westenthaler",
new Language("de"))));
data.add(new TripleImpl(pers1, FOAF.nick, new PlainLiteralImpl("westei")));
data.add(new TripleImpl(pers1, FOAF.mbox, lf.createTypedLiteral("[email protected]")));
data.add(new TripleImpl(pers1, FOAF.age, lf.createTypedLiteral(38)));
data.add(new TripleImpl(pers1, FOAF.knows, pers2));
data.add(new TripleImpl(pers2, FOAF.name, new PlainLiteralImpl("Reto Bachmann-Gmür")));
rdfData = data.getGraph();
}
示例2: writeEntityInformation
import org.apache.clerezza.rdf.core.Language; //導入依賴的package包/類
private void writeEntityInformation(MGraph writer, Keyword keyword, UriRef entity, Language lang) {
//The rdfs:label
writer.add(new TripleImpl(entity, RDFS_LABEL,
new PlainLiteralImpl(keyword.getForm(), lang)));
//the rdf:type
for(Clazz type : keyword.getClasses()){
writer.add(new TripleImpl(entity, RDF_TYPE, new UriRef(type.getUrl().toString())));
UriRef dbpediaType = createDbpediaTypeUri(type);
if(dbpediaType != null){
writer.add(new TripleImpl(entity, RDF_TYPE, dbpediaType));
}
}
if(keyword.getAbstract() != null){
writer.add(new TripleImpl(entity, RDFS_COMMENT,
new PlainLiteralImpl(keyword.getAbstract(),lang)));
}
if(keyword.getImages() != null && keyword.getImages().length > 0){
Image image = keyword.getImages()[0];
// for(Image image : keyword.getImages()){
writer.add(new TripleImpl(entity, FOAF_DEPICTION, new UriRef(image.getImage().toString())));
writer.add(new TripleImpl(entity, FOAF_THUMBNAIL, new UriRef(image.getThumb().toString())));
// }
}
}
開發者ID:michelemostarda,項目名稱:machinelinking-stanbol-enhancement-engine,代碼行數:25,代碼來源:MLAnnotateEnhancementEngine.java
示例3: handleStatement
import org.apache.clerezza.rdf.core.Language; //導入依賴的package包/類
private void handleStatement(RDFDataset result, Triple t, Map<BNode, String> bNodeMap) {
final String subject = getResourceValue(t.getSubject(), bNodeMap);
final String predicate = getResourceValue(t.getPredicate(), bNodeMap);
final Resource object = t.getObject();
if (object instanceof Literal) {
final String value = ((Literal) object).getLexicalForm();
final String language;
final String datatype;
if (object instanceof TypedLiteral) {
language = null;
datatype = getResourceValue(((TypedLiteral) object).getDataType(), bNodeMap);
} else if (object instanceof PlainLiteral) {
// we use RDF 1.1 literals so we do set the RDF_LANG_STRING
// datatype
datatype = RDF_LANG_STRING;
final Language l = ((PlainLiteral) object).getLanguage();
if (l == null) {
language = null;
} else {
language = l.toString();
}
} else {
throw new IllegalStateException("Unknown Literal class "
+ object.getClass().getName());
}
result.addTriple(subject, predicate, value, datatype, language);
count++;
} else {
result.addTriple(subject, predicate, getResourceValue((NonLiteral) object, bNodeMap));
count++;
}
}