Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_OWLExport.php |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | $cur_queue = array(); |
189 | 189 | |
190 | 190 | if ( 1 == $recursion ) { |
191 | | - $cur_queue = $this->element_queue + $cur_queue; // make sure the array is *dublicated* instead of copying its ref |
| 191 | + $cur_queue = $this->element_queue + $cur_queue; // make sure the array is *duplicated* instead of copying its ref |
192 | 192 | $this->element_queue = array(); |
193 | 193 | } |
194 | 194 | |
— | — | @@ -612,7 +612,7 @@ |
613 | 613 | * Print the triples associated to a specific page, and references those needed. |
614 | 614 | * They get printed in the printFooter-function. |
615 | 615 | * |
616 | | - * @param $st The SMWSmallTitle wrapping the page to be exported |
| 616 | + * @param $st SMWSmallTitle wrapping the page to be exported |
617 | 617 | * @param $fullexport Boolean to define whether all the data for the page should |
618 | 618 | * be exported, or whether just a definition of the given title. |
619 | 619 | * @param $backlinks Boolean specifying if properties linking to the exported title |
— | — | @@ -752,7 +752,7 @@ |
753 | 753 | /** |
754 | 754 | * Add an extra namespace that was encountered during output. The method |
755 | 755 | * checks whether the required namespace is available globally and adds |
756 | | - * it to the list of extra_namesapce otherwise. |
| 756 | + * it to the list of extra_namespace otherwise. |
757 | 757 | */ |
758 | 758 | public function addExtraNamespace( $nsshort, $nsuri ) { |
759 | 759 | if ( !array_key_exists( $nsshort, $this->global_namespaces ) ) { |
— | — | @@ -804,7 +804,7 @@ |
805 | 805 | * caching purposes elsewhere. |
806 | 806 | */ |
807 | 807 | protected function getSemanticData( $pagevalue, $core_props_only ) { |
808 | | - $semdata = smwfGetStore()->getSemanticData( $pagevalue, $core_props_only ? array( '__spu', '__typ', '__imp' ) : false ); // maybe advise Store to retrieve only core things |
| 808 | + $semdata = smwfGetStore()->getSemanticData( $pagevalue, $core_props_only ? array( '__spu', '__typ', '__imp' ) : false ); // advise store to retrieve only core things |
809 | 809 | if ( $core_props_only ) { // be sure to filter all non-relevant things that may still be present in the retrieved |
810 | 810 | $result = new SMWSemanticData( $pagevalue ); |
811 | 811 | foreach ( array( '__spu', '__typ', '__imp' ) as $propid ) { |
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Data.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | | - * Check if this element can be serialised using parserType="Collection" and |
| 129 | + * Check if this element can be serialised using parseType="Collection" and |
130 | 130 | * if yes return an array of SMWExpElements corresponding to the collection |
131 | 131 | * elements in the specified order. Otherwise return false. |
132 | 132 | */ |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | $rdfrest = SMWExporter::getSpecialElement( 'rdf', 'rest' ); |
137 | 137 | $rdfnil = SMWExporter::getSpecialElement( 'rdf', 'nil' ); |
138 | 138 | $name = $this->getSubject()->getName(); |
139 | | - // first check if we are basically an rdf List: |
| 139 | + // first check if we are basically an RDF List: |
140 | 140 | if ( ( ( $name == '' ) || ( $name { 0 } == '_' ) ) && // bnode |
141 | 141 | ( array_key_exists( $rdftype->getName(), $this->m_children ) ) && |
142 | 142 | ( count( $this->m_children[$rdftype->getName()] ) == 1 ) && |
— | — | @@ -182,13 +182,14 @@ |
183 | 183 | foreach ( $this->m_edges as $key => $edge ) { |
184 | 184 | foreach ( $this->m_children[$key] as $child ) { |
185 | 185 | $name = $child->getSubject()->getName(); |
186 | | - if ( ( $name == '' ) || ( $name[0] == '_' ) ) { // bnode, distribute ID |
| 186 | + if ( ( $name == '' ) || ( $name[0] == '_' ) ) { // bnode, rename ID to avoid unifying bnodes of different contexts |
| 187 | + // TODO: should we really rename bnodes of the form "_id" here? |
187 | 188 | $child = clone $child; |
188 | 189 | $subject = new SMWExpElement( '_' . $smwgBnodeCount++, $child->getSubject()->getDataValue() ); |
189 | 190 | $child->setSubject( $subject ); |
190 | 191 | } |
191 | 192 | $result[] = array( $this->m_subject, $edge, $child->getSubject() ); |
192 | | - $result = array_merge( $result, $child->getTripleList() ); // recursively generate all children of childs. |
| 193 | + $result = array_merge( $result, $child->getTripleList() ); // recursively generate all children's triples |
193 | 194 | } |
194 | 195 | } |
195 | 196 | return $result; |
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Element.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * This class can also be used to represent blank nodes: It is assumed that all objects |
18 | 18 | * of class SMWExpElement or any of its subclasses do represent blank node if their name |
19 | 19 | * is empty or of the form "_id" where "id" is any identifier string. IDs are local to the |
20 | | - * current context, which such as a list of triples or an SMWExpData container. |
| 20 | + * current context, such as a list of triples or an SMWExpData container. |
21 | 21 | * @ingroup SMW |
22 | 22 | */ |
23 | 23 | class SMWExpElement { |
Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php |
— | — | @@ -42,8 +42,16 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | | - * Create exportable data from a given semantic data record. If given, the string $modifier is used |
47 | | - * as a modifier to the URI of the subject (e.g. a unit for properties). |
| 46 | + * Create exportable data from a given semantic data record. If given, the |
| 47 | + * string $modifier is used as a modifier to the URI of the subject (e.g. a |
| 48 | + * unit for properties). The function itself introduces modifiers for the |
| 49 | + * SMWResourceElement objects that it creates to represent properties with |
| 50 | + * units. When exporting further data for such properties recursively, |
| 51 | + * these modifiers should be provided (they are not part of the |
| 52 | + * SMWPageValue that is part of the SMWSemanticData object, since units are |
| 53 | + * part of data values in SMW, but part of property names in the RDF export |
| 54 | + * for better tool compatibility). This is the origin of all modifier |
| 55 | + * strings that are used with this method. |
48 | 56 | */ |
49 | 57 | static public function makeExportData( /*SMWSemanticData*/ $semdata, $modifier = '' ) { |
50 | 58 | SMWExporter::initBaseURIs(); |
— | — | @@ -105,8 +113,8 @@ |
106 | 114 | $pe = SMWExporter::getResourceElement( $property ); |
107 | 115 | foreach ( $semdata->getPropertyValues( $property ) as $dv ) { |
108 | 116 | $ed = $dv->getExportData(); |
109 | | - $pem = ( $dv->getUnit() != false ) ? $pe->makeVariant( $dv->getUnit() ):$pe; |
110 | 117 | if ( $ed !== null ) { |
| 118 | + $pem = ( $dv->getUnit() != false ) ? $pe->makeVariant( $dv->getUnit() ):$pe; |
111 | 119 | $result->addPropertyObjectValue( $pem, $ed ); |
112 | 120 | } |
113 | 121 | } |