RDFSim
This Python library helps generating a vector space from very large hierarchies encoded in RDF. An obvious example application is to generate a vector space from a SKOS hierarchy or an RDFS subclass hierarchy.
Getting started
Running the tests:
$ nosetests
Installing:
$ python setup.py install
Example use
$ wget http://downloads.dbpedia.org/3.7/en/skos_categories_en.nt.bz2 $ bunzip2 skos_categories_en.nt.bz2 $ python >>> from rdfsim.space import Space >>> space = Space(‘skos_categories_en.nt’) >>> space.similarity_uri(category1, category2)
Constructing a vector space for the entire DBpedia SKOS category hierarchy (3M triples) takes a couple of minutes on a commodity laptop, and has a memory footprint of about 500M.
Alternatively, a subset of it is available in the examples/ directory.
How it works
For each topic t in the hierarchy, we consider the set of its parents parents(t, k) at a level k. We construct a vector for each t in a space where each dimension corresponds to a topic d in the hierarchy. The value of t on dimension d is defined as follows:
t_d = sum_{k = 0}^{max_depth} sum_{d in parents(t, k)} decay^k
where max_depth and decay are two parameters, which can be used to influence how much importance we attach to ancestors that are high in the category hierarchy.
They can be specified as follows:
>>> Space.max_depth = 8 >>> Space.decay = 0.9
Metadata
Release files for rdfsim 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rdfsim-0.3.tar.gz | 3.6 kB | Without provenance | Details for rdfsim-0.3.tar.gz |
Release files / rdfsim-0.3.tar.gz
| Download URL | rdfsim-0.3.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f649e5eefe7bcb4d3d3921375ea6621527c2befa1dca25a416e8e94bb413f6de
|
|
BLAKE2b-256 checksum How to use checksums |
3702e641b435d141660b0c68db827f6833f664203efb7501dad0a10b361d926a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for rdfsim 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.