Class RDFGraph

java.lang.Object
org.semanticweb.owlapi.rdf.model.RDFGraph
All Implemented Interfaces:
Serializable

public class RDFGraph extends Object implements Serializable
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
See Also:
  • Constructor Details

    • RDFGraph

      public RDFGraph()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Determines if this graph is empty (i.e. whether or not it contains any triples).
      Returns:
      true if the graph contains triples, otherwise false
      Since:
      3.5
    • addTriple

      public void addTriple(RDFTriple triple)
      Parameters:
      triple - triple to add
    • getTriplesForSubject

      public Collection<RDFTriple> getTriplesForSubject(RDFNode subject)
      Parameters:
      subject - subject
      Returns:
      sorted triples
    • forceIdOutput

      public void forceIdOutput()
      Ensure ids are output for reused individuals and annotated expressions.
    • getRootAnonymousNodes

      public Set<RDFResourceBlankNode> getRootAnonymousNodes()
      Returns:
      root anonymous nodes
    • dumpTriples

      public void dumpTriples(Writer w) throws IOException
      Parameters:
      w - writer to write to
      Throws:
      IOException - if exceptions happen
    • getAllTriples

      public Set<RDFTriple> getAllTriples()
      Returns:
      all triples in an unmodifiable set
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSubjectsForObject

      public List<RDFResource> getSubjectsForObject(RDFResource node)
      Parameters:
      node - node to search
      Returns:
      list of subjects of triples that include the object
    • setOntology

      public void setOntology(@Nullable RDFResource mappedNode)
      Parameters:
      mappedNode - ontology node
    • getOntology

      @Nullable public RDFResource getOntology()
      Returns:
      ontology node
    • addRootIRIs

      public void addRootIRIs(OWLEntity i)
      Some graphs have multiple root entities, i.e., sameAs(a1, a2, a3) axioms are turned to (a1 sameAs a2), (a2 sameAs a3) because of RDF limitations. To render all triples, a1 and a2 must be rendered; usual process would render only a1, and so a3 would be lost.
      Parameters:
      i - root IRI for this graph
    • getRootIRIs

      public Stream<OWLEntity> getRootIRIs(OWLEntity toSkip)
      Parameters:
      toSkip - entity to skip
      Returns:
      root entities, minus the one to be skipped, sorted