private List<Resource> getPropertyList(GraphNode r) { Iterator<GraphNode> propertyLists = r.getObjectNodes(CRIS.propertyList); if (propertyLists.hasNext()) { List<Resource> rdfList = new RdfList(propertyLists.next()); return rdfList; } throw new RuntimeException("There is no propertyList on this definition."); }
private Set<IRI> getObjectExpansionProperties(GraphNode recipe) { final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(true); final List<String> paramValues = queryParams.get(OBJ_EXP_PARAM); final Set<IRI> result = new HashSet<IRI>(); if (paramValues != null) { for (String uriString : paramValues) { result.add(new IRI(uriString)); } } if (recipe != null) { Iterator<GraphNode> ingredients = recipe.getObjectNodes(RECIPES.ingredient); while (ingredients.hasNext()) { Iterator<RDFTerm> properties = ingredients.next().getObjects(RECIPES.ingredientProperty); while (properties.hasNext()) { result.add((IRI)properties.next()); } } } return result; }
private Set<IRI> getSubjectExpansionProperties(GraphNode recipe) { final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(true); final List<String> paramValues = queryParams.get(SUBJ_EXP_PARAM); final Set<IRI> result = new HashSet<IRI>(); if (paramValues != null) { for (String uriString : paramValues) { result.add(new IRI(uriString)); } } if (recipe != null) { Iterator<GraphNode> ingredients = recipe.getObjectNodes(RECIPES.ingredient); while (ingredients.hasNext()) { Iterator<RDFTerm> properties = ingredients.next().getObjects(RECIPES.ingredientInverseProperty); while (properties.hasNext()) { result.add((IRI)properties.next()); } } } return result; }
private void getPathResults(GraphNode node, List<UriRef> properties, List<String> list) { if (properties.size() == 1) { //being a facet property or not is irrelevant for the result list.addAll(new PropertyHolder(properties.get(0), false).value(node)); } else { Lock lock = node.readLock(); lock.lock(); try { Iterator<GraphNode> iter = node.getObjectNodes(properties.get(0)); while (iter.hasNext()) { getPathResults(iter.next(), properties.subList(1, properties.size()), list); } } finally { lock.unlock(); } } } }
GraphNode node = new GraphNode(indexDefinitionResources.next().getSubject(), this.definitionGraph); Iterator<GraphNode> types = node.getObjectNodes(CRIS.indexedType); while (types.hasNext()) { UriRef tUri = (UriRef) types.next().getNode(); Iterator<GraphNode> properties = node.getObjectNodes(CRIS.indexedProperty); Set<VirtualProperty> props = new HashSet<VirtualProperty>(); while (properties.hasNext()) {
@Override public int importConceptsFromGraph(ImmutableGraph graph, IRI conceptClass, IRI broaderProperty) throws ClassifierException { int importedCount = 0; Iterator<Triple> conceptIterator = graph.filter(null, org.apache.stanbol.enhancer.servicesapi.rdf.Properties.RDF_TYPE, conceptClass); while (conceptIterator.hasNext()) { Triple conceptTriple = conceptIterator.next(); if (!(conceptTriple.getSubject() instanceof IRI)) { continue; } IRI conceptUri = (IRI) conceptTriple.getSubject(); GraphNode node = new GraphNode(conceptUri, graph); List<String> broaderConcepts = new ArrayList<String>(); // TODO: use OWL property inference on sub-properties here instead of explicit // property filter Iterator<GraphNode> broaderIterator = node.getObjectNodes(broaderProperty); while (broaderIterator.hasNext()) { RDFTerm node2 = broaderIterator.next().getNode(); if (node2 instanceof IRI) { broaderConcepts.add(((IRI) node2).getUnicodeString()); } } addConcept(conceptUri.getUnicodeString(), broaderConcepts); importedCount++; } return importedCount; } }
@Override public int importConceptsFromGraph(ImmutableGraph graph, IRI conceptClass, IRI broaderProperty) throws ClassifierException { int importedCount = 0; Iterator<Triple> conceptIterator = graph.filter(null, org.apache.stanbol.enhancer.servicesapi.rdf.Properties.RDF_TYPE, conceptClass); while (conceptIterator.hasNext()) { Triple conceptTriple = conceptIterator.next(); if (!(conceptTriple.getSubject() instanceof IRI)) { continue; } IRI conceptUri = (IRI) conceptTriple.getSubject(); GraphNode node = new GraphNode(conceptUri, graph); List<String> broaderConcepts = new ArrayList<String>(); // TODO: use OWL property inference on sub-properties here instead of explicit // property filter Iterator<GraphNode> broaderIterator = node.getObjectNodes(broaderProperty); while (broaderIterator.hasNext()) { RDFTerm node2 = broaderIterator.next().getNode(); if (node2 instanceof IRI) { broaderConcepts.add(((IRI) node2).getUnicodeString()); } } addConcept(conceptUri.getUnicodeString(), broaderConcepts); importedCount++; } return importedCount; } }