title: Extracting Labels and comments from the RDF file using RDFlib in Python
body: <p>I have the follow ontology:</p>
  
  <pre><code>&lt;!-- http://purl.org/ontology/bibo/Article --&gt;
  &lt;owl:Class rdf:about="Article"&gt;
      &lt;rdfs:label xml:lang="en"&gt;Article&lt;/rdfs:label&gt;
      &lt;rdfs:subClassOf rdf:resource="Document"/&gt;
      &lt;rdfs:isDefinedBy rdf:datatype="&amp;xsd;anyURI"
          &gt;http://purl.org/ontology/bibo/&lt;/rdfs:isDefinedBy&gt;
      &lt;ns:term_status&gt;stable&lt;/ns:term_status&gt;
      &lt;rdfs:comment xml:lang="en"
          &gt;A written composition in prose, usually nonfiction, on a specific topic, forming an independent part of a book or other publication, as a newspaper or magazine.&lt;/rdfs:comment&gt;
  &lt;/owl:Class&gt;
  
  &lt;!-- http://purl.org/ontology/bibo/AudioDocument --&gt;
  
  &lt;owl:Class rdf:about="AudioDocument"&gt;
      &lt;rdfs:label xml:lang="en"&gt;audio document&lt;/rdfs:label&gt;
      &lt;rdfs:subClassOf rdf:resource="Document"/&gt;
      &lt;rdfs:isDefinedBy rdf:datatype="&amp;xsd;anyURI"
          &gt;http://purl.org/ontology/bibo/&lt;/rdfs:isDefinedBy&gt;
      &lt;ns:term_status&gt;stable&lt;/ns:term_status&gt;
      &lt;rdfs:comment xml:lang="en"
          &gt;An audio document; aka record.&lt;/rdfs:comment&gt;
  &lt;/owl:Class&gt;
  
  &lt;!-- http://purl.org/NET/c4dm/event.owl#place --&gt;
  
  &lt;owl:ObjectProperty rdf:about="&amp;event;place"&gt;
      &lt;skos:scopeNote xml:lang="en"
          &gt;Used to relate an event such as a conference to the geographical place where it happens, for example Paris.&lt;/skos:scopeNote&gt;
  &lt;/owl:ObjectProperty&gt;
  
  &lt;!-- http://purl.org/dc/terms/date --&gt;
  
  &lt;owl:DatatypeProperty rdf:about="&amp;terms;date"&gt;
      &lt;skos:scopeNote xml:lang="en"
          &gt;Use to link a bibliographic item to the date of an event. Check dcterms:created and other for proper specializations for this property&lt;/skos:scopeNote&gt;
  &lt;/owl:DatatypeProperty&gt;
  </code></pre>
  
  <p>I'm trying to extract Labels, comments and about from classes, properties definitions. I'm using RDFlib to parse the file. I want to have the output:</p>
  
  <pre><code>(about) Article
  (label) Article
  (comment) written composition in prose, usually nonfiction, on a specific topic, forming an independent part of a book or other
  
  (about) AudioDocument
  (label) Audio Document
  (comment) An audio document; aka record.
  
  (about) place
  (scopeNote) Used to relate an event such as a conference to the geographical place where it happens, for example Paris.
  
  (about) date
  (scopeNote) use to link a bibliographic item to the date of an event. check dcterms:created and other for proper specializations 
  </code></pre>
  
  <p>My initial code:</p>
  
  <pre><code>for s, p, o in graph:
      if type(s) == rdflib.term.URIRef:
              print 'Subject = ',s 
              print ' '
              print 'Property = ',p 
              print ' '
              print 'Object = ',o 
              print ' '
  </code></pre>
  
  <p>I really don't know how to continue! Does anyone can help me?</p>