Get a collection of IRIs for identifying the categories of triples to retrieve.

@param prefer the Prefer header
@return the categories of triples to retrieve
357709
public static Set<IRI> triplePreferences(final Prefer prefer) {
        final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION);
        if (prefer != null) {
            if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) {
                include.remove(LDP.PreferContainment);
                include.remove(LDP.PreferMembership);
            }
            if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) {
                include.remove(Trellis.PreferUserManaged);
            }
            prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove);
            prefer.getInclude().stream().map(rdf::createIRI)
                .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add);
        }
        return include;
    }
600687
public static Prefer ofOmit(final String... omits) {
        final List<String> iris = asList(omits);
        if (iris.isEmpty()) {
            return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION));
        }
        return valueOf(join("=", PREFER_RETURN, PREFER_REPRESENTATION) + "; " + PREFER_OMIT + "=\"" +
                iris.stream().collect(joining(" ")) + "\"");
    }
916609
@GetMapping(value = "/{entityTypeId}", produces = APPLICATION_JSON_VALUE)
  public EntityCollectionResponse retrieveEntityCollection(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid EntityCollectionRequest request,
      @RequestParam(value = "attributes", required = false) String[] attributes,
      @RequestParam(value = "expand", required = false) String[] attributeExpands) {
    Set<String> attributesSet = toAttributeSet(attributes);
    Map<String, Set<String>> attributeExpandSet = toExpandMap(attributeExpands);

    return retrieveEntityCollectionInternal(
        entityTypeId, request, attributesSet, attributeExpandSet);
  }
714806
private void updateTripleDiffs(Set<Triple> existing, Set<Triple> desired)
            throws ResourceIndexException {

        // Delete any existing triples that are no longer desired,
        // leaving the ones we want in place
        HashSet<Triple> obsoleteTriples = new HashSet<Triple>(existing);
        obsoleteTriples.removeAll(desired);
        updateTriples(obsoleteTriples, true);

        // Add only new desired triples
        HashSet<Triple> newTriples = new HashSet<Triple>(desired);
        newTriples.removeAll(existing);
        updateTriples(newTriples, false);

    }
341796
public ApiResponse<ApiSuccessResponse> getRootCategoriesWithHttpInfo(GetRootCategoriesData getRootCategoriesData) throws ApiException {
        com.squareup.okhttp.Call call = getRootCategoriesValidateBeforeCall(getRootCategoriesData, null, null);
        Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
381901
private PortletCategoryBean filterCategoryFavoritesOnly(PortletCategoryBean category) {

        // Subcategories
        final Set<PortletCategoryBean> subcategories = new HashSet<>();
        category.getSubcategories()
                .forEach(
                        sub -> {
                            final PortletCategoryBean filteredBean =
                                    filterCategoryFavoritesOnly(sub);
                            if (filteredBean != null) {
                                subcategories.add(filteredBean);
                            }
                        });

        // Portlets
        final Set<PortletDefinitionBean> portlets = new HashSet<>();
        category.getPortlets()
                .forEach(
                        child -> {
                            if (child.getFavorite()) {
                                logger.debug(
                                        "Including portlet '{}' because it is a favorite:  {}",
                                        child.getFname());
                                portlets.add(child);
                            } else {
                                logger.debug(
                                        "Skipping portlet '{}' because it IS NOT a favorite:  {}",
                                        child.getFname());
                            }
                        });

        return !subcategories.isEmpty() || !portlets.isEmpty()
                ? PortletCategoryBean.create(
                        category.getId(),
                        category.getName(),
                        category.getDescription(),
                        subcategories,
                        portlets)
                : null;
    }
209810
def _get_triplet_value_list(self, graph, identity, rdf_type):
        
        values = []
        for elem in graph.objects(identity, rdf_type):
            values.append(elem.toPython())
        return values
1308653
public IssueCategory getByID(String categoryID)
    {
        IssueCategory issueCategory = this.issueCategories.get(categoryID);
        if (issueCategory == null)
        {
            // We do not have this one yet, so store it as a placeholder. It will presumably be loaded later on.
            issueCategory = new IssueCategory(categoryID, "placeholder", categoryID, categoryID, 0, true);
            this.issueCategories.put(categoryID, issueCategory);
        }
        return issueCategory;
    }
1030757
public static int getClosest (int direction, int[] possible,
            boolean preferCW)
    {
        // rotate a tick at a time, looking for matches
        int first = direction;
        int second = direction;
        for (int ii = 0; ii <= FINE_DIRECTION_COUNT / 2; ii++) {
            if (IntListUtil.contains(possible, first)) {
                return first;
            }

            if (ii != 0 && IntListUtil.contains(possible, second)) {
                return second;
            }

            first = preferCW ? rotateCW(first, 1) : rotateCCW(first, 1);
            second = preferCW ? rotateCCW(second, 1) : rotateCW(second, 1);
        }

        return NONE;
    }
981865
public static Collection<List<String>> unorderedUntypedDependencyObjectify(Tree t, HeadFinder hf, TreeTransformer collinizer) {
    return dependencyObjectify(t, hf, collinizer, new UnorderedUntypedDependencyTyper(hf));
  }
213864
private TripleIterator getTripleIterator(final Set<Triple> set) {
        return new TripleIterator() {

            private final Iterator<Triple> _iter = set.iterator();

            @Override
            public boolean hasNext() {
                return _iter.hasNext();
            }

            @Override
            public Triple next() {
                return getLocalizedTriple(_iter.next());
            }

            @Override
            public void close() {
            }
        };
    }
212454
@Override
	public List<Scope>  getScopesByCollector(ObjectId collectorId) {
		List<Scope> scopes = scopeRepository.findByCollectorId(collectorId);

		//clean up needed for < > characters
		for (Scope scope : scopes) {
			scope.setName(  scope.getName().replaceAll("[<>]", "")  );
			scope.setProjectPath(  scope.getProjectPath().replaceAll("[<>]", "")  );
		}

		return scopes;
	}
27706
private function getMatchingIndex(array $matchingList, PreferenceInterface $pref)
    {
        $index = -1;

        foreach ($matchingList as $key => $match) {
            if ($match->getVariant() === $pref->getVariant()) {
                $index = $key;
            }
        }

        return $index;
    }
638321
public FedoraResourceImpl loadProperties( final FedoraResourceImpl resource ) throws FedoraException {
        final String path = resource.getPropertiesPath();
        final HttpGet get = createGetMethod(path, null);
        if (resource instanceof FedoraObject) {
            get.addHeader("Prefer", "return=representation; "
                + "include=\"http://fedora.info/definitions/v4/repository#EmbedResources\"");
        }

        try {
            get.setHeader("accept", "application/rdf+xml");
            final HttpResponse response = execute(get);

            final String uri = get.getURI().toString();
            final StatusLine status = response.getStatusLine();

            if (status.getStatusCode() == SC_OK) {
                LOGGER.debug("Updated properties for resource {}", uri);

                // header processing
                final Header[] etagHeader = response.getHeaders("ETag");
                if (etagHeader != null && etagHeader.length > 0) {
                    resource.setEtagValue( etagHeader[0].getValue() );
                }

                // StreamRdf
                final HttpEntity entity = response.getEntity();
                final Lang lang = RDFLanguages.contentTypeToLang(entity.getContentType().getValue().split(":")[0]);
                final CollectorStreamTriples streamTriples = new CollectorStreamTriples();
                RiotReader.parse(entity.getContent(), lang, uri, streamTriples);
                resource.setGraph( RDFSinkFilter.filterTriples(streamTriples.getCollected().iterator(), Node.ANY) );
                return resource;
            } else if (status.getStatusCode() == SC_FORBIDDEN) {
                LOGGER.info("request for resource {} is not authorized.", uri);
                throw new ForbiddenException("request for resource " + uri + " is not authorized.");
            } else if (status.getStatusCode() == SC_BAD_REQUEST) {
                LOGGER.info("server does not support metadata type application/rdf+xml for resource {} " +
                                     " cannot retrieve", uri);
                throw new BadRequestException("server does not support the request metadata type for resource " + uri);
            } else if (status.getStatusCode() == SC_NOT_FOUND) {
                LOGGER.info("resource {} does not exist, cannot retrieve", uri);
                throw new NotFoundException("resource " + uri + " does not exist, cannot retrieve");
            } else {
                LOGGER.info("unexpected status code ({}) when retrieving resource {}", status.getStatusCode(), uri);
                throw new FedoraException("error retrieving resource " + uri + ": " + status.getStatusCode() + " "
                                          + status.getReasonPhrase());
            }
        } catch (final FedoraException e) {
            throw e;
        } catch (final Exception e) {
            e.printStackTrace();
            LOGGER.info("Could not encode URI parameter: {}", e.getMessage());
            throw new FedoraException(e);
        } finally {
            get.releaseConnection();
        }
    }
1051487
public ApiResponse<ApiSuccessResponse> getStandardResponseFavoritesWithHttpInfo(GetFavoritesData getFavoritesData) throws ApiException {
        com.squareup.okhttp.Call call = getStandardResponseFavoritesValidateBeforeCall(getFavoritesData, null, null);
        Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
321599
public List<MediaType> getAccept() {
		String value = getFirst(ACCEPT);
		List<MediaType> result = (value != null ? MediaType.parseMediaTypes(value) : Collections.<MediaType>emptyList());

		// Some containers parse 'Accept' into multiple values
		if (result.size() == 1) {
			List<String> acceptHeader = get(ACCEPT);
			if (acceptHeader.size() > 1) {
				value = StringUtils.collectionToCommaDelimitedString(acceptHeader);
				result = MediaType.parseMediaTypes(value);
			}
		}

		return result;
	}
585152
def get_triples(self, subject=None, predicate=None, object_=None):
        """"""

        for triple in self.triples:

            # Filter out non-matches
            if subject is not None and triple['subject'] != subject:
                continue
            if predicate is not None and triple['predicate'] != predicate:
                continue
            if object_ is not None and triple['object'] != object_:
                continue

            yield triple