Difference between revisions of "Semantic MediaWiki/data"
Jump to navigation
Jump to search
(subpages, not pages) |
(moved a comment here from the main page) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Tables== | ==Tables== | ||
− | As of SMW version 1.7: | + | As the SMW code API is not yet stable or well-documented, it appears that going directly to the database may be the best way to utilize SMW data from code running within MediaWiki (typically as an extension). |
− | * [[/smw_atts2]] | + | |
− | * [[/smw_conc2]] | + | All of this information has been reverse-engineered, mostly from examination of data in a single SMW instance. I was not able to find any data-structure documentation in the [https://doc.semantic-mediawiki.org/index.html official code docs]. |
− | * [[/smw_conccache]] | + | |
− | * [[/smw_ids]] | + | Note that the ''schema'' version numbers are generally higher than the corresponding SMW version<ref name=versions />. |
− | * [[/smw_inst2]] | + | {| |
− | * [[/smw_redi2]] | + | |- |
− | * [[/smw_rels2]] | + | | valign=top | |
− | * [[/smw_spec2]] | + | ===schema version 3=== |
− | * [[/smw_subp2]] | + | These are present in SMW version 1.9 alpha<ref name=versions />: |
− | * [[/smw_subs2]] | + | * '''[[/smw_di_*]]''': |
− | * [[/smw_text2]] | + | ** [[/smw_di_blob]] |
+ | ** [[/smw_di_bool]] | ||
+ | ** [[/smw_di_coords]] | ||
+ | ** [[/smw_di_number]] | ||
+ | ** [[/smw_di_time]] | ||
+ | ** [[/smw_di_url]] | ||
+ | ** [[/smw_di_wikipage]] | ||
+ | * [[/smw_fpt_ask]] | ||
+ | * [[/smw_fpt_askde]] | ||
+ | * [[/smw_fpt_askfo]] | ||
+ | * [[/smw_fpt_asksi]] | ||
+ | * [[/smw_fpt_askst]] | ||
+ | * [[/smw_fpt_cdat]] | ||
+ | * [[/smw_fpt_conc]] | ||
+ | * [[/smw_fpt_conv]] | ||
+ | * [[/smw_fpt_impo]] | ||
+ | * [[/smw_fpt_inst]] | ||
+ | * [[/smw_fpt_ledt]] | ||
+ | * [[/smw_fpt_list]] | ||
+ | * [[/smw_fpt_mdat]] | ||
+ | * [[/smw_fpt_newp]] | ||
+ | * [[/smw_fpt_pval]] | ||
+ | * [[/smw_fpt_redi]] | ||
+ | * [[/smw_fpt_serv]] | ||
+ | * [[/smw_fpt_sf_af]] | ||
+ | * [[/smw_fpt_sf_df]] | ||
+ | * [[/smw_fpt_sobj]] | ||
+ | * [[/smw_fpt_subc]] | ||
+ | * [[/smw_fpt_subp]] | ||
+ | * [[/smw_fpt_type]] | ||
+ | * [[/smw_fpt_unit]] | ||
+ | * [[/smw_fpt_uri]] | ||
+ | * '''[[/smw_object_ids]]''' | ||
+ | * [[/smw_prop_stats]] | ||
+ | | valign=top | | ||
+ | |||
+ | ===schema version 2=== | ||
+ | These were present in SMW version 1.7, and may also be valid for 1.8 (but not 1.9): | ||
+ | * '''[[/smw_atts2]]''': relationships where the value is numerically/logically significant, or a "string" (non-page type) | ||
+ | * [[/smw_conc2]]: not sure; probably [[smw:Help:Concepts|concepts]] | ||
+ | * [[/smw_conccache]]: not sure; presumably a cache for concepts | ||
+ | * '''[[/smw_ids]]''': assigns IDs to all properties, and values that map to a (potential) wiki page | ||
+ | * [[/smw_inst2]]: not sure | ||
+ | * [[/smw_redi2]]: not sure; redirects? | ||
+ | * '''[[/smw_rels2]]''': relationships where the value refers to a (potential) wiki page | ||
+ | * [[/smw_spec2]]: URLs to SWiVT specs | ||
+ | * [[/smw_subp2]]: not sure; sub-property map? | ||
+ | * [[/smw_subs2]]: not sure; looks like a mapping of categories to sub-categories | ||
+ | * '''[[/smw_text2]]''': relationships where the value is a long text/data blob | ||
+ | |||
+ | Core tables are boldfaced; the others seem to be primarily for optimization or auxiliary purposes. | ||
+ | ====Explanations==== | ||
+ | * Semantic relationships are defined in [[/smw rels2]], [[/smw_text2]], and [[/smw_atts2]]. | ||
+ | * Correspondence between SMW entities (property names and some property values) and MediaWiki pages is defined in [[/smw_ids]] | ||
+ | * Presumably the type of storage can be determined by looking up the SMW ID in [[/smw_spec2]], making it unnecessary to check multiple tables (rels2, text2, atts2) for each property. but it does not seem to have been designed for this purpose. | ||
+ | |} | ||
+ | ==Footnote== | ||
+ | <references> | ||
+ | <ref name=versions>I'm presuming that there was a schema version 1 based on the naming of the version 2 tables (they all end in '2'), but this may be incorrect. In any case, schema version 2 corresponds approximately to SMW v1.x, and schema version 3 to SMW 2.x (and some high-numbered 1.x beta releases).</ref> | ||
+ | </references> |
Latest revision as of 20:57, 28 July 2020
Tables
As the SMW code API is not yet stable or well-documented, it appears that going directly to the database may be the best way to utilize SMW data from code running within MediaWiki (typically as an extension).
All of this information has been reverse-engineered, mostly from examination of data in a single SMW instance. I was not able to find any data-structure documentation in the official code docs.
Note that the schema version numbers are generally higher than the corresponding SMW version[1].
schema version 3These are present in SMW version 1.9 alpha[1]:
|
schema version 2These were present in SMW version 1.7, and may also be valid for 1.8 (but not 1.9):
Core tables are boldfaced; the others seem to be primarily for optimization or auxiliary purposes. Explanations
|