/**
   * Adds Object Properties to the current Individual, and adds corresponding predicate to the list
   * (parallel arraylists)
   */
  public void addObjectPropertiesByPredicateType(String predicateURI, OWLNamedIndividual ind) {
    OWLObjectProperty objectProp =
        PROVGraph.manager.getOWLDataFactory().getOWLObjectProperty(IRI.create(predicateURI));
    NodeSet<OWLNamedIndividual> owlObjectIndividuals =
        PROVGraph.reasoner.getObjectPropertyValues(ind, objectProp);
    System.out.println(predicateURI + " Nodes: " + owlObjectIndividuals.getNodes().size());

    for (Node<OWLNamedIndividual> owlSameInd : owlObjectIndividuals) {
      OWLNamedIndividual currInd = owlSameInd.getRepresentativeElement();

      if (currInd != null) {
        String owlIndURI = currInd.toStringID();
        System.out.println("owlIndURI: " + owlIndURI);

        // if the target individual has been previously created, point to that PROVIndividual object
        if (PROVGraph.individualsHM.containsKey(owlIndURI)) {
          PROVIndividual targetProvInd =
              PROVGraph.individualsHM.get(owlSameInd.getRepresentativeElement().toStringID());

          OPconnectionObjectInds.add(targetProvInd);
          OPconnections.add(predicateURI);
        } else // otherwise create a new object with the URI, and add it to the pool of collected
               // PROVIndividuals
        {
          PROVIndividual targetProvInd =
              new PROVIndividual(owlSameInd.getRepresentativeElement().toStringID());
          PROVGraph.individualsHM.put(targetProvInd.uri, targetProvInd);

          OPconnectionObjectInds.add(targetProvInd);
          OPconnections.add(predicateURI);
        }
      } else {
        PROVIndividual anonProvInd = new PROVIndividual("Anonymous Individual " + (++anonIndsCntr));
        // **anonProvInd.uri not unique
        PROVGraph.individualsHM.put(anonProvInd.uri, anonProvInd);

        OPconnectionObjectInds.add(anonProvInd);
        OPconnections.add(predicateURI);
      }
    }
  }
Exemple #2
0
 private static void print(Node<OWLClass> parent, OWLReasoner reasoner, int depth) {
   // We don't want to print out the bottom node (containing owl:Nothing and unsatisfiable classes)
   // because this would appear as a leaf node everywhere
   if (parent.isBottomNode()) {
     return;
   }
   // Print an indent to denote parent-child relationships
   printIndent(depth);
   // Now print the node (containing the child classes)
   printNode(parent);
   for (Node<OWLClass> child : reasoner.getSubClasses(parent.getRepresentativeElement(), true)) {
     // Recurse to do the children.  Note that we don't have to worry about cycles as there
     // are non in the inferred class hierarchy graph - a cycle gets collapsed into a single
     // node since each class in the cycle is equivalent.
     print(child, reasoner, depth + 1);
   }
 }
Exemple #3
0
 @Override
 public String getRenderName() {
   return CommandInterpreter.getRenderName(ticker.getRepresentativeElement());
 }