Package org.apache.clerezza.rdf.core

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


      throws UnsupportedOperationException, EntityAlreadyExistsException {
    try {
      if (name.getUnicodeString().endsWith(EXTERNALIZEDLITERALS_SUFFIX)) {
        throw new IllegalArgumentException();
      }
      final UriRef baseGraphName = new UriRef(name.getUnicodeString() + EXTERNALIZEDLITERALS_SUFFIX);
      if (tcProvider == null) {
        throw new RuntimeException("MGraph creation currently not possible: tcManager unavailable");
      }
      final MGraph baseGraph = AccessController.doPrivileged(new PrivilegedExceptionAction<MGraph>() {
View Full Code Here


  @Override
  public void deleteTripleCollection(UriRef name)
      throws UnsupportedOperationException, NoSuchEntityException,
      EntityUndeletableException {
    try {
      final UriRef baseGraphName = new UriRef(name.getUnicodeString() + EXTERNALIZEDLITERALS_SUFFIX);
      AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {

        @Override
        public Object run() {
          tcProvider.deleteTripleCollection(baseGraphName);
View Full Code Here

  @Override
  public Set<UriRef> listMGraphs() {
    Set<UriRef> result = getHashStoreUris();
    for (Iterator<UriRef> it = result.iterator(); it.hasNext();) {
      UriRef graphName = it.next();
      final UriRef baseGraphName = new UriRef(graphName.getUnicodeString() + EXTERNALIZEDLITERALS_SUFFIX);
      try {
        tcProvider.getMGraph(baseGraphName);
      } catch (NoSuchEntityException e) {
        log.warn("Store for externalized literals but no base graph found for {}.", graphName);
        it.remove();
View Full Code Here

  private Set<UriRef> getHashStoreUris() {
    Set<UriRef> result = new HashSet<UriRef>();
    if (dataPath.exists()) {
      for (String mGraphDirName : dataPath.list()) {
        try {
          UriRef uri = new UriRef(URLDecoder.decode(mGraphDirName, "utf-8"));
          result.add(uri);
        } catch (UnsupportedEncodingException ex) {
          throw new RuntimeException("utf-8 not supported", ex);
        }
      }
View Full Code Here

            String port = context.getProperty("org.osgi.service.http.port");
            if (port == null) {
              port = DEFAULT_PORT;
            }
            if (port.equals("80")) {
              return new UriRef("http://localhost/");
            }
            return new UriRef("http://localhost:" + port + "/");
          }
        } finally {
          l.unlock();
        }
      }
View Full Code Here

      public Set<UriRef> run() {
        Iterator<Resource> baseUrisIter = getPlatformInstance().
            getObjects(PLATFORM.baseUri);
        Set<UriRef> baseUris = new HashSet<UriRef>();
        while (baseUrisIter.hasNext()) {
          UriRef baseUri = (UriRef) baseUrisIter.next();
          baseUris.add(baseUri);
        }
        baseUris.add(getDefaultBaseUri());
        return baseUris;
      }
View Full Code Here

    }
  }

  private byte[] getThumbnailUri() {
    ThumbnailServiceParams params = parseThumbnailServiceParams();
    UriRef thumbnailUri = thumbnailService.getThumbnailUri(params.getUri(),
        params.getWidth(), params.getHeight(), params.getExact());
    return thumbnailUri.getUnicodeString().getBytes();
  }
View Full Code Here

    return thumbnailBytes;
  }

  private ThumbnailServiceParams parseThumbnailServiceParams() {
    Integer width = null, height = null;
    UriRef uri = null;
    boolean extact = false;
    String queryParams = cachedQueryParams.toString();
    queryParams = queryParams.replace("&amp;", "&");
    String[] nameValues = queryParams.split("&");
    for (String nameValue : nameValues) {
      String[] nameValuePair = nameValue.split("=");
      if (nameValuePair.length == 2) {
        String name = nameValuePair[0];
        if (name.equals("uri")) {
          uri = new UriRef(nameValuePair[1]);
        } else if (name.equals("width")) {
          width = Integer.valueOf(nameValuePair[1]);
        } else if (name.equals("height")) {
          height = Integer.valueOf(nameValuePair[1]);
        } else if (name.equals("exact")) {
View Full Code Here

  @Test
  public void testPut() throws IOException {
   
    int port = createTestWebServer().getPort();

    UriRef uri = new UriRef("http://localhost:" + port + "/test");
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);

    URL serverURL = new URL(uri.getUnicodeString());
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("PUT");
    connection.addRequestProperty("Content-type", "application/x-test");
    //java sends and invalid *; q=.2 in the default accept-header
View Full Code Here

   */
  @Test
  public void testGet() throws IOException {
   
    int port = createTestWebServer().getPort();   
    UriRef uri = new UriRef("http://localhost:" + port + "/test");
   
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);
   
    URL serverURL = new URL(uri.getUnicodeString());
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
   
    connection = (HttpURLConnection) serverURL.openConnection();
    connection.setRequestMethod("GET");

View Full Code Here

TOP

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

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.