User:Andreas Plank/Testpage subobjects

From TDWG Terms Wiki
Jump to: navigation, search

Subojects set an ID, usually manually given:

{{#subobject:mysubobject
|property1=value1
|property1=value2
}}

… but next SMW 1.8 also supports indexed IDs (#1, #2 …):

{{#subobjects:
|property1=value1
|property1=value2
}}

Summary

Explanation: * fact, − disadvantage, + advantage:

* #subobject is similar to #set_internal
* they are exported to standard RDF export (although just that there is one but not the saved values)
+ they are exported {{#ask: … format=rdf}}
+ #subobject can have meaningfull IDs (#set_internal IDs are just indexed—#1, #2 etc.—and provide no meaning)
- they can be confusing when browsing in “Browse properties”, because their IDs do not resolve to a target by default (has to be programmed into the Wiki page's HTML-ID)
- for export of "#ask: … format=rdf" one has to know all subobject IDs to query them

See also User:Andreas Plank/Testpage internal objects.

Test

{{#subobject: skos:inScheme-1| skos:inScheme = DarwinCore }} sets a subobject
{{#ask: [[{{FULLPAGENAME}}#skos:inScheme-1]] |?skos:inScheme}} retrieves the data:
 skos:inScheme
Andreas Plank/Testpage subobjects#skos:inScheme-1Darwin Core
<!DOCTYPE rdf:RDF>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
         xmlns:owl="http://www.w3.org/2002/07/owl#" 
         xmlns:swivt="http://semantic-mediawiki.org/swivt/1.0#" 
         xmlns:wiki="http://terms.gbif.org/wiki/Special:URIResolver/" 
         xmlns:property="http://terms.gbif.org/wiki/Special:URIResolver/Property-3A" >
	<owl:Ontology>
		<swivt:creationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-10-10T17:01:57+02:00</swivt:creationDate>
		<owl:imports rdf:resource="http://semantic-mediawiki.org/swivt/1.0"/>
	</owl:Ontology>
	<swivt:Subject rdf:about="http://terms.gbif.org/wiki/Special:URIResolver/dcterms-3AaccessRights-23rdfs:subPropertyOf-1">
		<swivt:masterPage rdf:resource="http://purl.org/dc/terms/accessRights"/>
		<swivt:wikiPageSortKey>dcterms:accessRights#rdfs:subPropertyOf-1</swivt:wikiPageSortKey>
		<rdfs:subPropertyOf rdf:resource="http://terms.gbif.org/wiki/dcterms:rights"/>
	</swivt:Subject>
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#creationDate" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#masterPage" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageSortKey" />
	<!-- Created by Semantic MediaWiki, http://semantic-mediawiki.org/ -->
</rdf:RDF>

#subobject is not resolved by the Special:ExportRDF tool. The only way to resolve it is to #ask again, like:

{{#ask: [[{{FULLPAGENAME}}#skos:inScheme-1]] |?skos:inScheme|format=RDF}}

That is export this query as RDF which produces this URL:

http://terms.gbif.org/wiki/Special:Ask/-5B-5BUser:Andreas-20Plank-2FTestpage-20subobjects-23skos:inScheme-2D1-5D-5D/-3Fskos:inScheme/limit%3D50/format%3Drdf/syntax%3Drdfxml