Package org.apache.clerezza.rdf.core

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


            .getSubject());
      }
      resultMGraph.addAll(graph);
    } else {
      while (concepts.hasNext()) {
        NonLiteral concept = concepts.next().getSubject();
        GraphNode conceptGraphNode = new GraphNode(concept, graph);
        Iterator<Resource> sameAsConcepts = conceptGraphNode
            .getObjects(OWL.sameAs);
        if (!(hasSameAs(resultMGraph, concept) || hasAnyConcept(
            resultMGraph, sameAsConcepts))) {
View Full Code Here


  }

  private boolean hasSameAs(MGraph graph, NonLiteral sameAsConcept) {
    Iterator<Triple> concepts = graph.filter(null, RDF.type, SKOS.Concept);
    while (concepts.hasNext()) {
      NonLiteral concept = concepts.next().getSubject();
      if (graph.filter(concept, OWL.sameAs, sameAsConcept).hasNext()) {
        return true;
      }
    }
    return false;
View Full Code Here

    return false;
  }

  private boolean hasAnyConcept(MGraph graph, Iterator<Resource> concepts) {
    while (concepts.hasNext()) {
      NonLiteral concept = (NonLiteral) concepts.next();
      if (graph.filter(concept, RDF.type, SKOS.Concept).hasNext()) {
        return true;
      }
    }
    return false;
View Full Code Here

    return false;
  }

  private void addConceptToResultMGraph(MGraph resultMGraph,
      GraphNode graphNode) {
    NonLiteral concept = (NonLiteral) graphNode.getNode();
    resultMGraph.add(new TripleImpl(concept, RDF.type, SKOS.Concept));

    Iterator<Literal> prefLabelStatements = graphNode.getLiterals(SKOS.prefLabel);
    while (prefLabelStatements.hasNext()) {
      resultMGraph.add(new TripleImpl(concept, SKOS.prefLabel,
View Full Code Here

    }
    Set<Set<NonLiteral>> unitedEquivalenceSets = uniteSetsWithCommonElement(ifp2nodesMap.values());
    Map<NonLiteral, NonLiteral> current2ReplacementMap = new HashMap<NonLiteral, NonLiteral>();
    final MGraph owlSameAsGraph = new SimpleMGraph();
    for (Set<NonLiteral> equivalenceSet : unitedEquivalenceSets) {
      final NonLiteral replacement = getReplacementFor(equivalenceSet, owlSameAsGraph);
      for (NonLiteral current : equivalenceSet) {
        if (!current.equals(replacement)) {
          current2ReplacementMap.put(current, replacement);
        }
      }
    }
    final Set<Triple> newTriples = new HashSet<Triple>();
    for (Iterator<Triple> it = mGraph.iterator(); it.hasNext();) {
      final Triple triple = it.next();
      Triple replacementTriple = null;
      final NonLiteral subject = triple.getSubject();
      NonLiteral subjectReplacement =
          current2ReplacementMap.get(subject);
      final Resource object = triple.getObject();
      @SuppressWarnings("element-type-mismatch")
      Resource objectReplacement = current2ReplacementMap.get(object);
      if ((subjectReplacement != null) || (objectReplacement != null)) {
View Full Code Here

  @GET
  @Path("find")
  @Produces("application/rdf+xml")
  public Graph getPersonRdf(@QueryParam("mbox") String mboxString) {
    MGraph mGraph = tcManager.getMGraph(graphName);
    NonLiteral person = getPersonByMbox(mboxString, mGraph);
    return new GraphNode(person, mGraph).getNodeContext();
  }
View Full Code Here

  @GET
  @Path("find")
  @Produces("application/xhtml+xml")
  public GraphNode getPersonHtml(@QueryParam("mbox") String mboxString) {
    MGraph mGraph = tcManager.getMGraph(graphName);
    NonLiteral person = getPersonByMbox(mboxString, mGraph);
    return new GraphNode(person, mGraph);
  }
View Full Code Here

    return new GraphNode(person, mGraph);
  }

  private NonLiteral getPersonByMbox(String mboxString, MGraph mGraph) {
    Iterator<Triple> iter = mGraph.filter(null, FOAF.mbox, new UriRef(mboxString));
    NonLiteral person = null;
    while(iter.hasNext()) {
      person = iter.next().getSubject();
    }
    return person;
  }
View Full Code Here

   *
   */
  private List<String> getAllPermissionsOfAUserByName(String userName)
      throws UserUnregisteredException {

    NonLiteral user = getUserByName(userName);
   
    List<String> result = getPermissionEntriesOfAUser(user, userName);
    Iterator<Triple> roleTriples = systemGraph.filter(user,
        SIOC.has_function, null);

    while (roleTriples.hasNext()) {
      NonLiteral anotherRole = (NonLiteral) roleTriples.next()
          .getObject();
      result.addAll(getPermissionEntriesOfARole(anotherRole, userName, user));
    }
    Iterator<NonLiteral> baseRoles = getResourcesOfType(PERMISSION.BaseRole);
    while(baseRoles.hasNext()) {
View Full Code Here

    Iterator<Triple> ownerTriples =
        systemGraph.filter(new UriRef(location), OSGI.owner, null);

    if (ownerTriples.hasNext()) {
      NonLiteral user = (NonLiteral) ownerTriples.next().getObject();
      lookForPermissions(user, permInfoList);
    }

    if (permInfoList.isEmpty()) {
      return null;
View Full Code Here

TOP

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

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.