本文整理汇总了Java中org.apache.jena.rdf.model.AnonId类的典型用法代码示例。如果您正苦于以下问题:Java AnonId类的具体用法?Java AnonId怎么用?Java AnonId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnonId类属于org.apache.jena.rdf.model包,在下文中一共展示了AnonId类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addTriple
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
@Override
public void addTriple(CrawleableUri uri, Triple triple) {
String uriString = uri.getUri().toString();
if (rdfData.containsKey(uriString)) {
Model model = rdfData.get(uriString);
Resource s;
Node n = triple.getSubject();
if (n.isBlank()) {
s = model.createResource(new AnonId(triple.getSubject().getBlankNodeId()));
} else {
s = model.createResource(triple.getSubject().getURI());
}
Property p = model.createProperty(triple.getPredicate().getURI());
if (triple.getObject().isURI()) {
model.add(s, p, model.createResource(triple.getObject().getURI()));
} else if (triple.getObject().isBlank()) {
model.add(s, p, model.createResource(new AnonId(triple.getObject().getBlankNodeId())));
} else {
model.add(s, p, triple.getObject().getLiteralValue().toString());
}
} else {
LOGGER.error("Called to add a triple to the URI \"" + uriString + "\" which has never been opened.");
healthyness = false;
}
}
开发者ID:dice-group,项目名称:Squirrel,代码行数:26,代码来源:InMemorySink.java
示例2: convertEntityToResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
public Resource convertEntityToResource(IfcEntity entity) {
String namespaceSuffix = entity.getNamespaceSuffix();
if (namespaceSuffix == null) {
namespaceSuffix = "";
}
if (entity.hasName()) {
return jenaModel.createResource(formatModelName(namespaceSuffix + entity.getName()));
} else {
String nodeName = namespaceSuffix + String.format(Ifc2RdfVocabulary.IFC.BLANK_NODE_ENTITY_URI_FORMAT, entity.getLocalId());
if (nameAllBlankNodes) {
return jenaModel.createResource(formatModelBlankNodeName(nodeName));
} else {
return jenaModel.createResource(new AnonId(nodeName));
}
}
}
开发者ID:Web-of-Building-Data,项目名称:drumbeat-ifc2ld,代码行数:19,代码来源:Ifc2RdfModelExporter.java
示例3: convertShortEntityToResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
public Resource convertShortEntityToResource(IfcShortEntity entity, long childNodeCount) {
String namespaceSuffix = entity.getNamespaceSuffix();
if (namespaceSuffix == null) {
namespaceSuffix = "";
}
String nodeName = namespaceSuffix + String.format("%s_%s", entity.getTypeInfo(), entity.getValue());
Resource entityResource;
if (nameAllBlankNodes) {
entityResource = jenaModel.createResource(formatModelBlankNodeName(RegexUtils.getSafeUrl(nodeName)));
} else {
entityResource = jenaModel.createResource(new AnonId(nodeName));
}
entityResource.addProperty(RDF.type, jenaModel.createResource(converter.formatTypeName(entity.getTypeInfo())));
IfcLiteralValue value = entity.getValue();
RDFNode valueNode = convertLiteralValue((IfcLiteralValue) value, entityResource, childNodeCount, jenaModel);
entityResource.addProperty(EXPRESS.hasValue, valueNode);
return entityResource;
}
开发者ID:Web-of-Building-Data,项目名称:drumbeat-ifc2ld,代码行数:21,代码来源:Ifc2RdfModelExporter.java
示例4: rdf4jResourceToJenaResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
private Resource rdf4jResourceToJenaResource(@NonNull Model jenaModel,
@NonNull org.eclipse.rdf4j.model.Resource resource) {
if (resource instanceof SimpleIRI) {
return jenaModel.createResource(resource.stringValue());
} else {
return jenaModel.createResource(new AnonId(resource.stringValue()));
}
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:9,代码来源:ShaclValidator.java
示例5: anonName
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
protected static String anonName(AnonId id) {
String name = "_:A";
final String sid = id.toString();
for (int i = 0; i < sid.length(); i++) {
final char c = sid.charAt(i);
if (c == 'X') {
name = name + "XX";
} else if (Character.isLetterOrDigit(c)) {
name = name + c;
} else {
name = name + "X" + Integer.toHexString(c) + "X";
}
}
return name;
}
开发者ID:iotoasis,项目名称:SDA,代码行数:16,代码来源:StrUtils.java
示例6: getSkolemizedResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
private Resource getSkolemizedResource(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final RDFNode resource, final String topic) throws RepositoryException {
final AnonId id = resource.asResource().getId();
if (!skolemizedBnodeMap.containsKey(id)) {
final String base = idTranslator.asString(createResource(topic));
final Resource skolemizedSubject = idTranslator.toDomain(base + "#" + blankNodeIdentifier());
findOrCreateHashUri(idTranslator, skolemizedSubject);
skolemizedBnodeMap.put(id, skolemizedSubject);
}
return skolemizedBnodeMap.get(id);
}
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:14,代码来源:JcrRdfTools.java
示例7: createAnonResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
protected Resource createAnonResource(String anonId) {
return jenaModel.createResource(new AnonId(anonId));
}
开发者ID:Web-of-Building-Data,项目名称:drumbeat-ifc2ld,代码行数:4,代码来源:Ifc2RdfExporterBase.java
注:本文中的org.apache.jena.rdf.model.AnonId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论