doapfiend.doaplib

Package doapfiend :: Module doaplib |
[hide private]
[frames] | no frames]

# Module doaplib

source code

Library for parsing, displaying, querying and serializing DOAP

Functions | [hide private]
int |
follow_homepages(rdf_xml) If there is a 'doap:Project homepage' it will be looked up on doapspace.org using get_by_homepage to find any other DOAP. | source code
int |
show_links(rdf) If there is a 'doap:Project homepage' it will be looked up on doapspace.org using get_by_homepage to find any other DOAP. | source code
None |
print_doap_by_homepages(homepages) Given a list of homepage URLs, search for DOAP for each and print | source code
generator |
get_homepages(rdf, format=`'``xml``'`) Find all doap:homepage in RDF | source code
boolean |
rdf_has_doap(store) Returns True if triplestore has the DOAP namespace defined | source code
Project |
load_graph(doap, format=`'``xml``'`, get_list=False) Load a DOAP profile into a RDFAlchemy/rdflib graph | source code
string |
get_by_pkg_index(index, project_name, proxy=None) Get DOAP for a package index project name | source code
list |
query_by_homepage(url) Get list of URL's for DOAP given a project's homepage. | source code
print_doap(doap_xml, color=None, format=`'``text``'`, serializer=None, filename=None) Print DOAP as text, xml, or n3 etc. | source code
function |
get_serializer(format) Return a serializer instance given its name | source code
get_plugin(method) Return plugin object if `method` exists | source code
text |
fetch_doap(url, proxy=None) Fetch DOAP by its URL or filename | source code

Variables | [hide private]
| LOG = `logging.getLogger('doapfiend')`
| XMLRPC_SERVER = `<ServerProxy for doapspace.org/xmlrpc/>`
| DOAP_NS = `rdflib.URIRef('http://usefulinc.com/ns/doap#')`

Function Details | [hide private]

### follow_homepages(rdf_xml) | source code
If there is a 'doap:Project homepage' it will be looked up on doapspace.org using get_by_homepage to find any other DOAP. This is useful if we're looking at FOAF and a project is mentioned by homepage. It can also be used on DOAP files to search for additional DOAP files about the same project. Parameters: `rdf_xml` - RDF serialized as XML @type : string Returns: int 0 on sucess or 1 if there was no DOAP in the RDF

### show_links(rdf) | source code
If there is a 'doap:Project homepage' it will be looked up on doapspace.org using get_by_homepage to find any other DOAP. This is useful if we're looking at FOAF and a project is mentioned by homepage. It can also be used on DOAP files to search for additional DOAP files about the same project. Parameters: `rdf` - RDF serialized as XML @type : string Returns: int 0 on sucess or 1 if there was no DOAP in the RDF

### print_doap_by_homepages(homepages) | source code
Given a list of homepage URLs, search for DOAP for each and print Parameters: `homepages` - Project homepage @type : list Returns: None None

### get_homepages(rdf, format=`'``xml``'`) | source code
Find all doap:homepage in RDF Parameters: `rdf` (string) - RDF `format` (string) - Serialization format Returns: generator homepages

### rdf_has_doap(store) | source code
Returns True if triplestore has the DOAP namespace defined Parameters: `store` (rdflib ConjunctiveGraph) - triplestore Returns: boolean True if triplestore contains DOAP namespace

### load_graph(doap, format=`'``xml``'`, get_list=False) | source code
Load a DOAP profile into a RDFAlchemy/rdflib graph Supports any serialization format rdflib can parse (xml, n3, etc.) Parameters: `doap` (string) - DOAP `format` (string) - Serialization format we're parsing `get_list` - Return list of Projects if True Returns: Project a Project{rdfSubject}

### get_by_pkg_index(index, project_name, proxy=None) | source code
Get DOAP for a package index project name Builtin indexes: 'sf' SourceForge 'fm' Freshmeat 'py' Python Package Index Note there can be other package indexes available by third party plugins. Parameters: `index` (string) - Package index two letter abbreviation `project_name` (string) - project name `proxy` (string) - Optional HTTP proxy URL Returns: string text of file retrieved

### query_by_homepage(url) | source code
Get list of URL's for DOAP given a project's homepage. The list can contain zero or multiple URLs. The return format is: [(source, URL), (source, URL)...] 'source' is the two letter package index abbreviation or 'ex' for external. 'external' meaning the DOAP was spidered on the web. Possible package indexes: Current indexes: 'sf' SourceForge 'fm' Freshmeat 'py' Python Package Index 'oh' Packages listed on Ohloh Parameters: `url` (string) - URL of homepage of a project Returns: list A list of tuples containing URLs for DOAP found by homepage

### print_doap(doap_xml, color=None, format=`'``text``'`, serializer=None, filename=None) | source code
Print DOAP as text, xml, or n3 etc. or to stdout or a file A callable serializer object may be passed or a name of a serializer plugin. Parameters: `doap_xml` (string) - DOAP profile in RDF/XML `format` (string) - Serialization syntax formatter name `serializer` (callable) - Instance of a serializer `filename` (string) - Optional filename to write to Returns: `serializer` or 1 if invalid serialization request

### get_serializer(format) | source code
Return a serializer instance given its name Parameters: `format` (string) - Name of serializer Returns: function Instance of a serializer

### get_plugin(method) | source code
Return plugin object if `method` exists Parameters: `method` (string) - name of plugin's method we're calling Returns: list of plugins with `method`

### fetch_doap(url, proxy=None) | source code
Fetch DOAP by its URL or filename Parameters: `url` (string) - URL of DOAP profile in RDF/XML serialization Returns: text DOAP