コード例 #1
0
  /**
   * Add additional models to the RDF dataset for the given resource
   *
   * @param rdfStream the source stream we'll add named models to
   * @param resource the FedoraResourceImpl in question
   * @param uriInfo a JAX-RS UriInfo object to build URIs to resources
   * @param graphSubjects
   * @throws RepositoryException
   */
  public void addHttpComponentModelsForResourceToStream(
      final RdfStream rdfStream,
      final FedoraResource resource,
      final UriInfo uriInfo,
      final IdentifierTranslator graphSubjects)
      throws RepositoryException {

    LOGGER.debug("Adding additional HTTP context triples to dataset");
    for (final Map.Entry<String, UriAwareResourceModelFactory> e :
        getUriAwareTripleFactories().entrySet()) {
      final String beanName = e.getKey();
      final UriAwareResourceModelFactory uriAwareResourceModelFactory = e.getValue();
      LOGGER.debug("Adding response information using: {}", beanName);

      final Model m =
          uriAwareResourceModelFactory.createModelForResource(resource, uriInfo, graphSubjects);
      rdfStream.concat(RdfStream.fromModel(m));
    }
  }
コード例 #2
0
ファイル: JcrRdfTools.java プロジェクト: hardyoyo/fcrepo4
  /**
   * Get an {@link RdfStream} for the given JCR NodeIterator
   *
   * @param nodeIterator
   * @param iteratorSubject
   * @return
   * @throws RepositoryException
   */
  public RdfStream getJcrPropertiesModel(
      final Iterator<Node> nodeIterator, final Resource iteratorSubject)
      throws RepositoryException {

    final RdfStream results = new RdfStream();
    while (nodeIterator.hasNext()) {
      final Node node = nodeIterator.next();
      results.concat(new PropertiesRdfContext(node, graphSubjects, llstore));
      if (iteratorSubject != null) {
        results.concat(
            singleton(
                create(
                    iteratorSubject.asNode(),
                    HAS_MEMBER_OF_RESULT.asNode(),
                    graphSubjects.getSubject(node.getPath()).asNode())));
      }
    }
    return results;
  }