Ken Webb 2011-11-21T02:56:41Z
Each instance of a class has its own value for each property. The mass of the planet Jupiter is much greater than the mass of the planet Earth (Jupiter is much bigger). The semi-major axis of Venus is much less than the semi-major axis of Mars (Venus is closer to the Sun).
Every Wikipedia page includes the jQuery library.
function print(x) { console.log(x); } function fix(node) { var str = node.contents().filter(function(){ return(this.nodeType == 3); }).text(); // remove all non-numeric characters (leave digits and decimal point) var x = str.replace(/[^0-9\.]+/g, ''); // every number must have a decimal point if (x.indexOf('.') == -1) { x += '.0'; } return x; } var th = ['','','radius','','','','mass','','','','','','']; print('<?xml version="1.0" encoding="UTF-8"?>\n'); print('<!--\n'); print('Automatically generated using WkSolarSystemObjects.js\n'); var d = new Date(); print(d.toLocaleString() + ' ' + d.getTime() + '\n'); print('www.primordion.com/Xholon\n'); print('URL: ' + window.location.href + '\n'); print('Units: radius in meters(m), mass in kilograms(kg)\n'); print('-->\n'); print('<InstanceDetails>\n'); $('table:eq(2) > tbody > tr').each( function() { $(this).children('td').each( function(index) { if (index == 0) { print('<Instance id="' + $(this).find('a:first').text() + '">\n'); } else if (index == 2) { // radius print(' <Attribute_double roleName="' + th[index] + '">' + (fix($(this))*1000).toFixed(1) + '</Attribute_double>\n'); } else if (index == 6) { // mass print(' <Attribute_double roleName="' + th[index] + '">' + fix($(this)) + 'e21</Attribute_double>\n'); } }); print('</Instance>\n'); }); print('</InstanceDetails>\n');
DBpedia is a community effort to extract structured information from Wikipedia and to make this information available on the Web. SPARQL is a query language for data stored in RDF format, such as the data stored at dbpedia.
The dbpedia snorql site allows querying for data from Wikipedia pages, using SPARQL syntax. Enter the following query:
PREFIX planet: <http://dbpedia.org/resource/Mars> SELECT ?name, ?mass, ?radius, ?temperature, ?semimajorAxis WHERE { planet:<http://dbpedia.org/property/name> ?name . planet:<http://dbpedia.org/ontology/mass> ?mass . planet:<http://dbpedia.org/property/equatorialRadius> ?radius . planet:<http://dbpedia.org/ontology/meanTemperature> ?temperature . planet:<http://dbpedia.org/property/semimajor> ?semimajorAxis . }
The result should be something like this:
name mass radius temperature semimajorAxis "Mars"@en 6418.5 1 210 2 "Mars"@en 6418.5 1 336.15 2 "Mars"@en 6418.5 1 210 "2.279391E8"^^dbpedia:datatype/kilometre "Mars"@en 6418.5 1 336.15 "2.279391E8"^^dbpedia:datatype/kilometre
Alternatively, you can ask for results in XML.
Because the properties captured by dbpedia differ from one planet to another, the query may need to be more flexible. Try this:
PREFIX p:<http://dbpedia.org/property/> PREFIX o:<http://dbpedia.org/ontology/> SELECT DISTINCT ?roleName ?mass ?radius WHERE { ?planet p:name ?roleName; p:mass ?mass. { ?planet p:equatorialRadius ?radius } UNION { ?planet p:meanRadius ?radius } ?planet a o:Planet } ORDER BY ?roleName LIMIT 150