Examples of MGraph


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

        //check that there is no such mgraph, but only the graph
        boolean expThrown = false;

        try {
            MGraph g = provider.getMGraph(graphUriRef);
        } catch(NoSuchEntityException e) {
            expThrown = true;
        }

        assertTrue(expThrown);
View Full Code Here

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

    @Test
    public void testCreateMGraphNoDuplicateNames() throws Exception {

        TcProvider provider = getInstance();
        MGraph graph = provider.createMGraph(graphUriRef);
        assertNotNull(graph);
        boolean expThrown = false;
        try {
            MGraph other = provider.createMGraph(otherGraphUriRef);
        } catch(EntityAlreadyExistsException eaee) {
            expThrown = true;
        }
        assertTrue(expThrown);
    }
View Full Code Here

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

    @Test
    public void testGetTriplesMGraph() throws Exception {
        TcProvider provider = getInstance();

        MGraph graph = provider.createMGraph(graphUriRef);

        TripleCollection tc = provider.getTriples(graphUriRef);
        assertNotNull(tc);
    }
View Full Code Here

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

   * @param g1
   * @param g2
   * @return a Set of NodePairs
   */
  public static Map<BNode, BNode> getValidMapping(TripleCollection og1, TripleCollection og2) {
    MGraph g1 = new SimpleMGraph(og1);
    MGraph g2 = new SimpleMGraph(og2);
    if (!Utils.removeGrounded(g1,g2)) {
      return null;
    }
    final HashMatching hashMatching;
    try {
View Full Code Here

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

  public GraphNode listUsers(@QueryParam(value = "from") Integer from,
      @QueryParam(value = "to") Integer to, @Context UriInfo uriInfo) {
    AccessController.checkPermission(new UserManagerAccessPermission());
    TrailingSlash.enforceNotPresent(uriInfo);

    MGraph resultGraph = new SimpleMGraph();

    Iterator<NonLiteral> users = userManager.getUsers();
    SortedSet<GraphNode> sortedSet = new TreeSet<GraphNode>(
        new UserComparator());
    Lock readLock = systemGraph.getLock().readLock();
View Full Code Here

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

  @Path("add-user")
  public GraphNode addUser(@Context UriInfo uriInfo) {
    AccessController.checkPermission(new UserManagerAccessPermission());
    TrailingSlash.enforceNotPresent(uriInfo);

    MGraph resultGraph = new SimpleMGraph();
    NonLiteral addUserPage = new BNode();

    resultGraph.add(new TripleImpl(addUserPage, RDF.type,
        USERMANAGER.AddUserPage));
    resultGraph.add(new TripleImpl(addUserPage, RDF.type,
        PLATFORM.HeadedPage));

    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    Lock readLock = contentGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> formFields = contentGraph.filter(null, RDF.type,
          USERMANAGER.UserFormField);
      while (formFields.hasNext()) {
        resultGraph.add(new TripleImpl(addUserPage,
            CUSTOMPROPERTY.customfield, formFields.next().getSubject()));
      }
    } finally {
      readLock.unlock();
    }
View Full Code Here

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

      @QueryParam(value = "roles") String roles,
      @QueryParam(value = "user") String userName,
      @Context UriInfo uriInfo) throws ParseException {
    AccessController.checkPermission(new UserManagerAccessPermission());
    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    MGraph resultGraph = new SimpleMGraph();
    NonLiteral node = new BNode();

    resultGraph.add(new TripleImpl(resource, USERMANAGER.custominformation,
        node));
    resultGraph.add(new TripleImpl(node, RDF.type,
        USERMANAGER.CustomUserInformationPage));

    ArrayList<NonLiteral> customfields = new ArrayList<NonLiteral>();

    if (!roles.equals("") && roles.trim().length() > 0) {
      String[] rolesArray = roles.split(",");
      for (int i = 0; i < rolesArray.length; i++) {
        NonLiteral collection = customPropertyManager
            .getCustomPropertyCollection(PERMISSION.Role,
                rolesArray[i]);
        customfields.addAll(customPropertyManager
            .getCustomfieldsOfCollection(collection));
      }
    }

    for (NonLiteral customField : customfields) {
      UriRef property = customPropertyManager
  .getCustomFieldProperty(customField);

      if (userName != null && !userName.equals("")
          && userName.trim().length() > 0) {
        NonLiteral user = getCustomUser(contentGraph, userName);
        if (user != null) {
          Lock readLock = contentGraph.getLock().readLock();
          readLock.lock();
          try {
            Iterator<Triple> values = contentGraph.filter(user,
                property, null);
            while (values.hasNext()) {
              Resource value = values.next().getObject();
              resultGraph.add(new TripleImpl(customField,
                  CUSTOMPROPERTY.actualvalues, value));
            }
          } finally {
            readLock.unlock();
          }

        }
      }
      resultGraph.add(new TripleImpl(node, CUSTOMPROPERTY.customfield,
          customField));
    }
    return new GraphNode(node, new UnionMGraph(resultGraph, contentGraph));
  }
View Full Code Here

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

  public class DescriptionHandler {

    @GET
    public Object getDescription(@Context UriInfo uriInfo){
      String absoluteUriPath = uriInfo.getAbsolutePath().toString();
      MGraph contentMGraph = tcManager.getMGraph(Constants.CONTENT_GRAPH_URI);
        UriRef uri = new UriRef(absoluteUriPath.substring(0,
            absoluteUriPath.length() - DESCRIPTION_SUFFIX.length()));
        GraphNode graphNode = new GraphNode(uri, contentMGraph);
        return graphNode.getNodeContext();
    }
View Full Code Here

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

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

    MGraph resultGraph = new SimpleMGraph();
    NonLiteral userPermissionPage = new BNode();
    Iterator<PermissionDescripton> permDescs = permGatherer.getAllPermissionDescriptors();
    while(permDescs.hasNext()) {
      PermissionDescripton desc = permDescs.next();
      BNode providedPermission = new BNode();
      resultGraph.add(new TripleImpl(userPermissionPage,
          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(userPermissionPage, RDF.type,
        PLATFORM.HeadedPage));
    resultGraph.add(new TripleImpl(userPermissionPage, RDF.type,
        USERMANAGER.UserPermissionPage));

    NonLiteral user = userManager.getUserByName(userName);
    if (user != null) {
      resultGraph.add(new TripleImpl(userPermissionPage,
          USERMANAGER.user, user));
      Iterator<NonLiteral> permissions = userManager
          .getPermissionsOfUser(user);
      return new GraphNode(userPermissionPage, new UnionMGraph(
          resultGraph, systemGraph));
View Full Code Here

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

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

    NonLiteral user = userManager.getUserByName(userName);
    if (user != null) {
      MGraph resultGraph = new SimpleMGraph();
      NonLiteral updateUserPage = new BNode();
      resultGraph.add(new TripleImpl(updateUserPage, RDF.type,
          USERMANAGER.UpdateUserPage));
      resultGraph.add(new TripleImpl(updateUserPage, RDF.type,
          PLATFORM.HeadedPage));
     

      LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
      resultGraph.add(new TripleImpl(updateUserPage, USERMANAGER.user,
          user));

      Iterator<NonLiteral> userRoles = userManager
          .getRolesOfUser(user);

      ArrayList<NonLiteral> customfields = new ArrayList<NonLiteral>();

      while (userRoles.hasNext()) {
        customfields.addAll(customPropertyManager
            .getCustomfieldsOfCollection(customPropertyManager
                .getCustomPropertyCollection(PERMISSION.Role,
                    userRoles.next().toString())));
      }
      for (NonLiteral customfield : customfields) {
        resultGraph.add(new TripleImpl(updateUserPage,
            CUSTOMPROPERTY.customfield, customfield));
        UriRef property = customPropertyManager.getCustomFieldProperty(customfield);
        NonLiteral contentUser = getCustomUser(contentGraph, userName);

        Lock readLock = contentGraph.getLock().readLock();
        readLock.lock();
        try {
          Iterator<Triple> values = contentGraph.filter(contentUser,
              property, null);
          while (values.hasNext()) {
            PlainLiteral value = (PlainLiteral) values.next().getObject();
            resultGraph.add(new TripleImpl(customfield,
                CUSTOMPROPERTY.actualvalues, value));
          }
        } finally {
          readLock.unlock();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.