Examples of IDoapCategory


Examples of uk.ac.osswatch.simal.model.IDoapCategory

  @Test
  public void testImportProgrammes() throws SimalRepositoryException {
    Iterator<IDoapCategory> cats = SimalRepositoryFactory.getCategoryService().getAll().iterator();
    boolean catIsValid = false;
    while (cats.hasNext()) {
      IDoapCategory cat = cats.next();
      String name = cat.getName();
      if (name.equals("Programme A")) {
        Set<IProject> projects = cat.getProjects();
       
        assertEquals("Don't have the right number of current projects for Programme A",2, projects.size());
        catIsValid = true;
        break;
      }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

      assertTrue("Not managed to get any categories from the repo",
          cats.size() > 0);

      Iterator<IDoapCategory> catsIt = cats.iterator();
      while (catsIt.hasNext()) {
        IDoapCategory cat = catsIt.next();
        logger.debug("Got category: " + cat.getLabel());
      }
    }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

    public void testGetAllCategories() throws SimalRepositoryException,
        IOException {
      Set<IDoapCategory> cats = SimalRepositoryFactory.getCategoryService().getAll();

      Iterator<IDoapCategory> itrCats = cats.iterator();
      IDoapCategory cat;
      while (itrCats.hasNext()) {
        cat = itrCats.next();
        logger.debug("Got category: " + cat.getSimalID() + " : " + cat.getURI());
      }

      assertTrue("Got too few categories", 50 < cats.size());
    }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

      assertEquals("Got wrong number of categories", 56, nrCategories);
    }

    @Test
    public void testFindCategoryById() throws SimalRepositoryException {
      IDoapCategory cat = SimalRepositoryFactory.getCategoryService().findById("1");
      assertNotNull(cat);
      assertEquals("Category name is incorrect", "Simal ID Test", cat.getName());
    }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

    @Test
    public void testGetOrCreateCategory() throws SimalRepositoryException {
     boolean exists = getRepository().containsResource(TEST_SIMAL_PROJECT_CATEGORY_TWO);
     assertTrue("Test category does not exist", exists);
    
     IDoapCategory gotCat = SimalRepositoryFactory.getCategoryService().get(TEST_SIMAL_PROJECT_CATEGORY_TWO);
     IDoapCategory gotOrCreateCat = SimalRepositoryFactory.getCategoryService().getOrCreate(TEST_SIMAL_PROJECT_CATEGORY_TWO);
     assertEquals("Retrieved categories are different depending on method of retrieval", gotCat.getURI(), gotOrCreateCat.getURI());
   
     String uri = "http://test.com/category";
     gotCat = SimalRepositoryFactory.getCategoryService().get(uri);
     assertNull("Retrieved a category we should not have been able to get", gotCat);
    
     gotOrCreateCat = SimalRepositoryFactory.getCategoryService().getOrCreate(uri);
     assertNotNull("Failed to create a category using getOrCreateCategory", gotOrCreateCat);
    
     gotCat = SimalRepositoryFactory.getCategoryService().get(uri);
     assertNotNull("Failed to retrieve a recently created category", gotCat);
    
     gotOrCreateCat.delete();
     gotCat = SimalRepositoryFactory.getCategoryService().get(uri);
     assertNull("Retrieved a category we should have deleted", gotCat);
    }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

    Property o = Doap.CATEGORY;
    com.hp.hpl.jena.rdf.model.Resource r = model.createResource(uri);
    Statement s = model.createStatement(r, RDF.type, o);
    model.add(s);

    IDoapCategory cat = new Category(r);
    cat.setSimalID(getNewID());
    return cat;
  }
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

    Query query = QueryFactory.create(queryStr);
    Model model = ((JenaSimalRepository) getRepository()).getModel();
    QueryExecution qe = QueryExecutionFactory.create(query, model);
    ResultSet results = qe.execSelect();

    IDoapCategory category = null;
    while (results.hasNext()) {
      QuerySolution soln = results.nextSolution();
      RDFNode node = soln.get("category");
      if (node.isResource()) {
        category = new Category(
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

   * @see uk.ac.osswatch.simal.service.ICategoryService#getAllCategoriesAsJSON()
   */
  public String getAllCategoriesAsJSON() throws SimalRepositoryException {
    StringBuffer json = new StringBuffer("{ \"items\": [");
    Iterator<IDoapCategory> categories = getAll().iterator();
    IDoapCategory category;
    while (categories.hasNext()) {
      category = categories.next();
      json.append(category.toJSONRecord());
      if (categories.hasNext()) {
        json.append(",");
      }
    }
    json.append("]}");
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

    for (int i = 0; i < categories.getLength(); i = i + 1) {
      category = (Element) categories.item(i);
      simalIDAtt = category.getAttributeNodeNS(SimalOntology.NS,
          RDFUtils.SIMAL_CATEGORY_ID);
      if (simalIDAtt == null) {
        IDoapCategory simalCategory;
        try {
          Attr att = category.getAttributeNodeNS(RDFUtils.RDF_NS, "resource");
          simalCategory = SimalRepositoryFactory.getCategoryService().get(
              att.getNodeValue().trim());
          if (simalCategory != null) {
            id = simalCategory.getSimalID();
          } else {
            id = SimalRepositoryFactory.getPersonService().getNewID();
          }
          simalIDAtt = doc.createAttributeNS(SimalOntology.NS,
              RDFUtils.SIMAL_CATEGORY_ID);
View Full Code Here

Examples of uk.ac.osswatch.simal.model.IDoapCategory

   *
   * @see uk.ac.osswatch.simal.wicket.panel.AbstractAddPanel#processAddSubmit()
   */
  @Override
  protected void processAddSubmit() {
    IDoapCategory selectedCategory = inputModel.getcomboChoice();
    try {
      if (selectedCategory != null) {
        getUpdatePanel().addToDisplayList(selectedCategory);
        getUpdatePanel().addToModel(selectedCategory);
      } else {
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.