Package uk.ac.osswatch.simal.rdf

Examples of uk.ac.osswatch.simal.rdf.SimalRepositoryException


      try {
        IPerson person = SimalRepositoryFactory.getPersonService().findBySeeAlso(uri);
        if (person == null) {
          person = SimalRepositoryFactory.getPersonService().get(uri);
          if (person == null) {
            throw new SimalRepositoryException("No person with the URI " + uri);
          }
        }
        String id = person.getSimalID();
        if (!peopleIDs.contains(id)) {
          people.add(person);
View Full Code Here


  public void setSimalID(String id) throws SimalRepositoryException {
    if (id.contains(":")
        && !id.startsWith(SimalProperties
            .getProperty((SimalProperties.PROPERTY_SIMAL_INSTANCE_ID)))) {
      throw new SimalRepositoryException("Simal ID cannot contain a ':', id is " + id);
    }
    logger.info("Setting simalId for " + this + " to " + id);
    getJenaResource().addLiteral(SimalOntology.PROJECT_ID, id);
  }
View Full Code Here

  public int getOpennessRating() throws SimalRepositoryException {
  IReviewService service = SimalRepositoryFactory.getReviewService();
  Set<IReview> reviews = service.getReviewsForProject(this);
  if (reviews.size() == 0) {
    logger.debug(this.toString() + " project does not have a review and thus has no openness rating.");
    throw new SimalRepositoryException("Unable to get an openness rating since there has been no review of this entry yet");
  }
 
  double score = 0;
  if (getDownloadPages().size() > 0) {
    score = score + 1;
View Full Code Here

  public void removeName(String name) throws SimalRepositoryException {
      Model model = getJenaResource().getModel();
      StmtIterator statements = model.listStatements(getJenaResource(), Doap.NAME, name);
      if (statements == null) {
        throw new SimalRepositoryException("Name does not exist in resource, cannot remove: " + name);
      }
      model.remove(statements);
  }
View Full Code Here

      Element resultRoot = mergeProjectAndContributorData(domProjectResult,
          domContributorResult).getDocumentElement();

      SimalRepositoryFactory.getProjectService().createProject(resultRoot.getOwnerDocument());
    } catch (TransformerConfigurationException e) {
      throw new SimalRepositoryException("Unable to create XSL Transformer", e);
    } catch (TransformerException e) {
      throw new SimalRepositoryException("Unable to transform Ohloh data", e);
    } catch (MalformedURLException e) {
      throw new SimalRepositoryException("Malformed URL for an Ohloh resource",
          e);
    } catch (IOException e) {
      throw new SimalRepositoryException("Unable to read osloh to doap XSL", e);
    }
  }
View Full Code Here

    dbf.setNamespaceAware(true);
    DocumentBuilder db;
    try {
      db = dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
      throw new SimalRepositoryException("Unable to create document builder", e);
    }
    Document simalPersonDoc = db.newDocument();
    Node simalPersonRDFRoot = simalPersonDoc.createElementNS(RDFUtils.RDF_NS,
        "RDF");
    Element simalPersonElement = simalPersonDoc.createElementNS(
View Full Code Here

      return people;
    }

  public IPerson findById(String id) throws SimalRepositoryException {
      if (!getRepository().isValidSimalID(id)) {
          throw new SimalRepositoryException(
              "Attempt to find a person using an invalid Simal ID of "
                  + id
                  + " are you sure that's a world unique identifier? You may need to call getUniqueSimalID() or RDFUtils.getUniqueSimalID(id)");
        }
        String queryStr = "PREFIX xsd: <" + AbstractSimalRepository.XSD_NAMESPACE_URI
View Full Code Here

        Long.toString(newId));
    try {
      SimalProperties.save();
    } catch (Exception e) {
      LOGGER.warn("Unable to save properties file", e);
      throw new SimalRepositoryException(
          "Unable to save properties file when creating the next person ID", e);
    }

    return fullID;
  }
View Full Code Here

    StreamResult result = new StreamResult(xmlAsWriter);
    try {
      TransformerFactory.newInstance().newTransformer().transform(
          new DOMSource(doc), result);
    } catch (TransformerConfigurationException e) {
      throw new SimalRepositoryException("Unable configure XSL Transformer", e);
    } catch (TransformerException e) {
      throw new SimalRepositoryException("Unable to transform document", e);
    } catch (TransformerFactoryConfigurationError e) {
      throw new SimalRepositoryException("Unable to create XSL Transformer", e);
    }
    String xml = xmlAsWriter.toString();
    StringReader xmlReader = new StringReader(xml);
    // FIXME Are we sure this is the right way? JavaDoc suggests otherwise.
    model.read(xmlReader, "");
View Full Code Here

          simalIDAtt = doc.createAttributeNS(SimalOntology.NS,
              RDFUtils.SIMAL_CATEGORY_ID);
          simalIDAtt.setValue(id);
          category.setAttributeNode(simalIDAtt);
        } catch (Exception e) {
          throw new SimalRepositoryException("Unable to get category", e);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of uk.ac.osswatch.simal.rdf.SimalRepositoryException

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.