本文整理汇总了Java中org.apache.clerezza.commons.rdf.IRI类的典型用法代码示例。如果您正苦于以下问题:Java IRI类的具体用法?Java IRI怎么用?Java IRI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRI类属于org.apache.clerezza.commons.rdf包,在下文中一共展示了IRI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOntologyInfo
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@Override
public OntologyInfo getOntologyInfo(String id) throws NoSuchOntologyException {
String ontologyURI = ONTOLOGY + id;
Graph g = tcManager.getMGraph(new IRI("ontonethub-graph"));
Iterator<Triple> tripleIt = g.filter(new IRI(ontologyURI),
new IRI(HAS_BUNDLE),
null);
String bundleId = null;
if(tripleIt.hasNext()){
Literal bundleIdLiteral = (Literal) tripleIt.next().getObject();
bundleId = bundleIdLiteral.getLexicalForm();
}
OntologyInfo ontologyInfo = null;
if(bundleId != null) ontologyInfo = ontologyInfo(id, bundleId, g);
if(ontologyInfo == null) throw new NoSuchOntologyException(id);
else return ontologyInfo;
}
示例2: Query
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
public Query(IRI contentStoreUri,
IRI contentStoreViewUri,
Collection<IRI> subjects,
Collection<IRI> types,
Collection<String> searchs,
Integer items, Integer offset, Integer maxFacets,
boolean withContent) {
this.contentStoreUri = contentStoreUri;
this.contentStoreViewUri = contentStoreViewUri;
this.subjects = subjects;
this.types = types;
this.searchs = searchs;
this.items = items;
this.offset = offset;
this.maxFacets = maxFacets;
this.withContent = withContent;
}
示例3: serviceEntryPriviledged
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
/**
* This method return an RdfViewable, this is an RDF serviceUri with
* associated presentational information.
*/
@GET
public RdfViewable serviceEntryPriviledged(@Context final UriInfo uriInfo,
@QueryParam("subject") final List<IRI> subjects,
@QueryParam("type") final List<IRI> types,
@QueryParam("search") final List<String> searchs,
@QueryParam("items") final Integer items,
@QueryParam("offset") final @DefaultValue("0") Integer offset,
@QueryParam("maxFacets") final @DefaultValue("10") Integer maxFacets) throws Exception {
//here we can still access the user name
final String userName = UserUtil.getCurrentUserName();
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<RdfViewable>() {
public RdfViewable run() throws Exception {
return serviceEntry(uriInfo, subjects, types, searchs, items, offset, maxFacets);
}
});
} catch (PrivilegedActionException e) {
throw e.getException();
}
}
示例4: getOntologiesInfo
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@Override
public OntologyInfo[] getOntologiesInfo() {
List<OntologyInfo> ontologiesInfo = new ArrayList<OntologyInfo>();
Graph g = tcManager.getMGraph(new IRI("ontonethub-graph"));
Iterator<Triple> tripleIt = g.filter(null,
new IRI(HAS_BUNDLE),
null);
String bundleId = null;
while(tripleIt.hasNext()){
Triple triple = tripleIt.next();
BlankNodeOrIRI subject = triple.getSubject();
String ontologyId = subject.toString().replace("<", "").replace(">", "");
ontologyId = ontologyId.substring(ontologyId.lastIndexOf("/")+1);
Literal bundleIdLiteral = (Literal) triple.getObject();
bundleId = bundleIdLiteral.getLexicalForm();
if(bundleId != null){
OntologyInfo ontologyInfo;
try {
ontologyInfo = ontologyInfo(ontologyId, bundleId, g);
} catch (NoSuchOntologyException e) {
ontologyInfo = null;
}
if(ontologiesInfo != null) ontologiesInfo.add(ontologyInfo);
}
}
OntologyInfo[] ontologiesInfoArray = new OntologyInfo[ontologiesInfo.size()];
return ontologiesInfo.toArray(ontologiesInfoArray);
}
示例5: getContentStoreView
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@Deprecated
GraphNode getContentStoreView(final IRI contentStoreUri,
final IRI contentStoreViewUri,
final Collection<IRI> subjects,
final Collection<IRI> types,
final Collection<String> searchs,
Integer items,
Integer offset,
Integer maxFacets,
boolean withContent);
示例6: addResourceDescription
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
/**
* Add the description of a serviceUri to the specified Graph using SiteManager.
* The description includes the metadata provided by the SiteManager.
*
*/
private void addResourceDescription(IRI iri, Graph mGraph) {
final Entity entity = siteManager.getEntity(iri.getUnicodeString());
if (entity != null) {
final RdfValueFactory valueFactory = new RdfValueFactory(mGraph);
final Representation representation = entity.getRepresentation();
if (representation != null) {
valueFactory.toRdfRepresentation(representation);
}
}
}
示例7: ContentStoreImpl
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
public ContentStoreImpl() {
final List<IRI> subjectLabelPath = new ArrayList<IRI>();
subjectLabelPath.add(DC.subject);
subjectLabelPath.add(RDFS.label);
subjectLabel = new PathVirtualProperty(subjectLabelPath, false);
List<VirtualProperty> joinedProperties = new ArrayList<VirtualProperty>();
joinedProperties.add(contentProperty);
joinedProperties.add(subjectLabel);
labelsAndContent = new JoinVirtualProperty(joinedProperties,false);
}
示例8: serviceEntry
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
public RdfViewable serviceEntry(@Context final UriInfo uriInfo,
@QueryParam("subject") final List<IRI> subjects,
@QueryParam("type") final Collection<IRI> types,
@QueryParam("search") final List<String> searchs,
@QueryParam("items") Integer items,
@QueryParam("offset") @DefaultValue("0") Integer offset,
@QueryParam("maxFacets") @DefaultValue("10") Integer maxFacets) throws Exception {
//this maks sure we are nt invoked with a trailing slash which would affect
//relative resolution of links (e.g. css)
TrailingSlash.enforcePresent(uriInfo);
String viewUriString = uriInfo.getRequestUri().toString();//getAbsolutePath().toString();
if (items == null) {
if (viewUriString.indexOf('?') > 0) {
viewUriString += "&";
} else {
viewUriString += "?";
}
viewUriString += "items=10";
items = 10;
}
final IRI contentStoreViewUri = new IRI(viewUriString);
//This is the URI without query params
final IRI contentStoreUri = new IRI(uriInfo.getAbsolutePath().toString());
GraphNode node = getContentStoreView(contentStoreUri, contentStoreViewUri,
subjects, types, searchs, items,
offset, maxFacets, false);
//What we return is the GraphNode we created with a template path
return new RdfViewable("ContentStoreView", node, ContentStoreImpl.class);
}
示例9: getContentStoreView
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
/**
* Returns a GraphNode of type ContentStoreView.
*
* @param contentStoreUri The IRI of the content store to use
* @param contentStoreViewUri The IRI that shall be assigned to the returned
* view
* @param subjects The dc:subjects the matching content items shall have
* @param searchs The search patterns the matching documents shall satisfy
* @param items the number of items to return
* @param offset the position at which to start items (for pagination)
* @param maxFacets the maximum number of facets the result shall contain
* @return a GraphNode describing the ContentStoreView
*/
@Override
public GraphNode getContentStoreView(final IRI contentStoreUri,
final IRI contentStoreViewUri,
final Collection<IRI> subjects,
final Collection<String> searchs,
Integer items,
Integer offset,
Integer maxFacets,
boolean withContent) {
return getContentStoreView(contentStoreUri, contentStoreViewUri,
subjects, Collections.EMPTY_LIST, searchs,
items, offset, maxFacets, withContent);
}
示例10: postContent
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@POST
public String postContent(@Context final UriInfo uriInfo, final byte[] data,
@HeaderParam("Content-Type") MediaType contentType) {
final String digest = DigestUtils.md5Hex(data);
String resourcePath = uriInfo.getAbsolutePath().toString();
if (!resourcePath.endsWith("/")) {
resourcePath += '/';
}
resourcePath += CONTENT_PREFIX;
final IRI contentUri = new IRI(resourcePath + digest);
discobitsHandler.put(contentUri, contentType, data);
return "Posted " + data.length + " bytes, with uri " + contentUri + ": " + contentType;
}
示例11: getEntity
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@GET
@Path("entity")
public RdfViewable getEntity(@QueryParam("uri") IRI entityUri) {
final Graph resultGraph = new SimpleGraph();
addResourceDescription(entityUri, resultGraph);
final GraphNode resultNode = new GraphNode(entityUri, resultGraph);
resultNode.addPropertyValue(RDFS.comment, "here you go");
//TODO use own rendering spec
return new RdfViewable("ContentStoreView", resultNode, ContentStoreImpl.class);
}
示例12: getContent
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@GET
@Path(CONTENT_PREFIX + "{hash: .*}")
public Response getContent(@Context final UriInfo uriInfo) {
final String resourcePath = uriInfo.getAbsolutePath().toString();
final IRI contentUri = new IRI(resourcePath);
final byte[] data = discobitsHandler.getData(contentUri);
final MediaType mediaType = discobitsHandler.getMediaType(contentUri);
Response.ResponseBuilder responseBuilder =
Response.ok(data, mediaType)
.header("Link", "<" + resourcePath + ".meta>; rel=meta");
return responseBuilder.build();
}
示例13: getMeta
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
@GET
@Path(CONTENT_PREFIX + "{hash: .*}.meta")
public RdfViewable getMeta(@Context final UriInfo uriInfo) {
final String resourcePath = uriInfo.getAbsolutePath().toString();
final IRI contentUri = new IRI(resourcePath.substring(0, resourcePath.length() - 5));
return getMeta(contentUri);
}
示例14: addResourceDescription
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
/**
* Add the description of a serviceUri to the specified Graph using
* SiteManager. The description includes the metadata provided by the
* SiteManager.
*
*/
private void addResourceDescription(IRI iri, Graph mGraph) {
final Entity entity = siteManager.getEntity(iri.getUnicodeString());
if (entity != null) {
final RdfValueFactory valueFactory = new RdfValueFactory(mGraph);
final Representation representation = entity.getRepresentation();
if (representation != null) {
valueFactory.toRdfRepresentation(representation);
}
}
//Also add selected properties from content graph
//Note that we have to be selective or we would add all the documents the
//entity is a subject of.
Graph cg = contentGraphProvider.getContentGraph();
Lock l = cg.getLock().readLock();
l.lock();
try {
Iterator<Triple> allOutgoing = cg.filter(iri, null, null);
while (allOutgoing.hasNext()) {
Triple t = allOutgoing.next();
if (t.getPredicate().equals(RDF.type)) {
mGraph.add(t);
continue;
}
if (t.getObject() instanceof Literal) {
mGraph.add(t);
}
}
} finally {
l.unlock();
}
}
示例15: copyProperties
import org.apache.clerezza.commons.rdf.IRI; //导入依赖的package包/类
private void copyProperties(GraphNode fromNode, Graph toGraph, IRI... properties) {
for (IRI property : properties) {
Iterator<RDFTerm> objects = fromNode.getObjects(property);
while (objects.hasNext()) {
RDFTerm object = objects.next();
toGraph.add(new TripleImpl((BlankNodeOrIRI) fromNode.getNode(),
property, object));
}
}
}