Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.MGraph


  @Path("list-roles")
  public GraphNode listRoles(@Context UriInfo uriInfo) {
    AccessController.checkPermission(new UserManagerAccessPermission());
    TrailingSlash.enforceNotPresent(uriInfo);

    MGraph resultGraph = new SimpleMGraph();
    NonLiteral roleOverviewPage = new BNode();
    resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type,
        USERMANAGER.RoleOverviewPage));
    resultGraph.add(new TripleImpl(roleOverviewPage, RDF.type,
        PLATFORM.HeadedPage));
   
    GraphNode result =  new GraphNode(roleOverviewPage,
        new UnionMGraph(resultGraph, systemGraph, cgProvider.getContentGraph()));
    addAvailableRoles(result);
View Full Code Here


    AccessController.checkPermission(new UserManagerAccessPermission());
    AccessController.checkPermission(new PermissionManagerAccessPermission());
    TrailingSlash.enforceNotPresent(uriInfo);

    MGraph resultGraph = new SimpleMGraph();
    NonLiteral rolePermissionPage = new BNode();
    Iterator<PermissionDescripton> permDescs = permGatherer.getAllPermissionDescriptors();
    while(permDescs.hasNext()) {
      PermissionDescripton desc = permDescs.next();
      BNode providedPermission = new BNode();
      resultGraph.add(new TripleImpl(rolePermissionPage,
          USERMANAGER.permission, providedPermission));
      resultGraph.add(new TripleImpl(providedPermission,
          PERMISSION.javaPermissionEntry, new PlainLiteralImpl(desc.getJavaPermissionString())));
      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.title, new PlainLiteralImpl(desc.getSimpleName())));
      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.description, new PlainLiteralImpl(desc.getDescription())));
    }

    resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
        PLATFORM.HeadedPage));
    resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
        USERMANAGER.RolePermissionPage));

    NonLiteral role = userManager.getRoleByTitle(title);
    if (role != null) {
      resultGraph.add(new TripleImpl(rolePermissionPage,
          USERMANAGER.role, role));
      return new GraphNode(rolePermissionPage, new UnionMGraph(
          resultGraph, systemGraph));

    }
View Full Code Here

  @Path("add-property")
  public GraphNode getAddSinglePropertyPage(
      @QueryParam(value = "roleTitle") String role) {

    AccessController.checkPermission(new UserManagerAccessPermission());
    MGraph resultGraph = new SimpleMGraph();
    NonLiteral node = new BNode();
    resultGraph.add(new TripleImpl(node, RDF.type,
        USERMANAGER.AddCustomPropertyPage));
    resultGraph.add(new TripleImpl(node, RDF.type,
        PLATFORM.HeadedPage));

    resultGraph.add(new TripleImpl(node, USERMANAGER.role,
        new PlainLiteralImpl(role)));
    return new GraphNode(node, resultGraph);
  }
View Full Code Here

  public GraphNode manageCustomProperties(
      @QueryParam(value = "role") String role, @Context UriInfo uriInfo) {
    TrailingSlash.enforceNotPresent(uriInfo);

    AccessController.checkPermission(new UserManagerAccessPermission());
    MGraph contentGraph = cgProvider.getContentGraph();
    MGraph resultGraph = new SimpleMGraph();
    NonLiteral propertyManagementPage = new BNode();
    resultGraph.add(new TripleImpl(propertyManagementPage,
        USERMANAGER.role, new PlainLiteralImpl(role)));
    resultGraph.add(new TripleImpl(propertyManagementPage, RDF.type,
        USERMANAGER.CustomFieldPage));
    resultGraph.add(new TripleImpl(propertyManagementPage, RDF.type,
        PLATFORM.HeadedPage));
    ArrayList<NonLiteral> customfields = customPropertyManager
        .getCustomfieldsOfCollection(customPropertyManager
            .getCustomPropertyCollection(PERMISSION.Role, role));
    for (NonLiteral customfield : customfields) {
      resultGraph.add(new TripleImpl(customfield, USERMANAGER.role,
          new PlainLiteralImpl(role)));
      resultGraph.add(new TripleImpl(propertyManagementPage,
          CUSTOMPROPERTY.customfield, customfield));
    }
    return new GraphNode(propertyManagementPage, new UnionMGraph(
        resultGraph, contentGraph));
  }
View Full Code Here

*/
public class RoundTripTest {

  @Test
  public void addAndCount() {
    MGraph mGraph = new SimpleMGraph();
    Graph jenaGraph = new JenaGraph(mGraph);
    Model model = ModelFactory.createModelForGraph(jenaGraph);
    model.add(DC.title, RDFS.label, "title");
    MGraph rewrappedMGraph = new JenaGraphAdaptor(jenaGraph);
    Assert.assertEquals(1, rewrappedMGraph.size());
    rewrappedMGraph.add(new TripleImpl(new BNode(), SKOS.prefLabel,
        LiteralFactory.getInstance().createTypedLiteral("foo")));
    Assert.assertEquals(2, rewrappedMGraph.size());
    Assert.assertEquals(2, mGraph.size());
    rewrappedMGraph.clear();
    Assert.assertEquals(0, rewrappedMGraph.size());
  }
View Full Code Here

    String uriString = uriInfo.getAbsolutePath().toString();
    if (uriString.charAt(uriString.length()-1) != '/') {
      uriString += '/';
    }
    UriRef nodeUri = new UriRef(uriString);
    final MGraph mGraph = cgProvider.getContentGraph();
    Triple typeTriple = new TripleImpl(nodeUri, RDF.type, HIERARCHY.Collection);
    if (mGraph.contains(typeTriple)) {
      return Response.status(405) // Method Not Allowed
          .entity("Collection \"" + nodeUri.getUnicodeString()
          + "\" already exists.").build();
    }
    new CollectionCreator(mGraph).createContainingCollections(nodeUri);
View Full Code Here

    try {
      String depthHeader = WebDavUtils.getHeaderAsString(headers, "Depth");
      if (depthHeader == null) {
        depthHeader = WebDavUtils.infinite;
      }
      final MGraph mGraph = cgProvider.getContentGraph();
      GraphNode node = new GraphNode(nodeUri, mGraph);
      if (body != null) {
        Document requestDoc = WebDavUtils.sourceToDocument(body);
        Node propfindNode = WebDavUtils.getNode(requestDoc, WebDavUtils.propfind);
        Node requestNode = WebDavUtils.getFirstChild(propfindNode);
View Full Code Here

    if (!nodeAtUriExists(nodeUri)) {
      return resourceUnavailable(nodeUri, uriInfo);
    }
    try {
      Document requestDoc = WebDavUtils.sourceToDocument(body);
      final MGraph mGraph = cgProvider.getContentGraph();
      GraphNode node = new GraphNode(nodeUri, mGraph);
      NodeList propsToSet = null;
      NodeList propsToRemove = null;
      Node proppatchNode = WebDavUtils.getNode(requestDoc, WebDavUtils.proppatch);
      NodeList childNodes = proppatchNode.getChildNodes();
View Full Code Here

   * @return
   */
  @GET
  @Override
  public GraphNode getResource(@Context UriInfo uriInfo) {
    final MGraph contentGraph = cgProvider.getContentGraph();
    final String uriString = uriInfo.getAbsolutePath().toString();
    final UriRef indexUri = new UriRef(uriString+"index");
    if (contentGraph.filter(indexUri, null, null).hasNext()) {
      return new GraphNode(indexUri, contentGraph);
    }
    final UriRef uri = new UriRef(uriString);
    MGraph mGraph = new UnionMGraph(new SimpleMGraph(), contentGraph);
    final GraphNode graphNode = new GraphNode(uri, mGraph);
    graphNode.addProperty(RDF.type, PLATFORM.HeadedPage);

    UriRef collectionUri = new UriRef(uriInfo.getAbsolutePath().toString());
    return graphNode;
View Full Code Here

  @GET
  @Path("get")
  public GraphNode getDiscobit(@QueryParam("resource") UriRef uri,
      @QueryParam("graph") UriRef graphUri) {
    final MGraph mGraph = graphUri == null ? cgProvider.getContentGraph() :
      tcManager.getMGraph(graphUri);
    return new GraphNode(uri, mGraph);
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.MGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.