From: S P. <ski...@ea...> - 2007-04-06 05:44:26
|
cnit first wrote: > It would be nice to have a Image datatype, whith should be rendered as > a standard image link (with options) in result of search query. > Currently, I've tried to combine [[Image:]] wikitext with inline <ask> > query for attribute that has a type of String and value of imagename, > that didn't work. People have come up with workarounds for parsing glitches like these involving templates and quoting. In the fact box maybe you could use service links (http://ontoworld.org/wiki/Help:Service_links) to get a thumbnail. There are some other ways you could represent images: If the attribute value is a string containing the full wikitext for an image, e.g. [[Image:aifb.gif|left]], then SMW displays that image in text and in the factbox, but not in inline queries. This is probably another case of bug 9334 (http://bugzilla.wikimedia.org/show_bug.cgi?id=9334 ), that wikitext in inline queries is not parsed. Or maybe the property should be a relation to the image's wikipage, e.g. [[Logo::Image:aifb.gif]]. But this just creates a wiki link to Image:Aifb.gif, rather than displaying the image. Again, could be a parsing glitch. I tried these out at http://ontoworld.org/wiki/Test_Image , take a look and please edit it to show what you're trying to do. > If there's a possibility of image queries, please > let me know. As you and I've found, it's not too hard to add datatypes to SMW. The ones so far arose from the defined XML Schema datatypes and some physical attributes like temperature that can't be represented by Type:Linear and custom units. IMO, before adding another datatype it's better to first generalize existing SMW facilities such as service links, format strings, the special property [[possible values]], etc. to support neat ideas like images. (If SMW has a datatype for images, why not media:, colors, etc?) > Otherwise, I might consider trying to do that myself [and then you wrote it -- yowsah! ] I found a couple of things trying to make your code work with latest SVN code: * needs global $smwgContLang; * $nt is undeclared in $thumbhtml=$skin->makeKnownLinkObj($nt, $thumb->toHtml()); * getXSDType() returns http://www.w3.org/2001/XMLSchema#image , but there is no XML Schema datatype for images. If you care about RDF export, perhaps you could make the XSD string the URL of the image and use the XSD type http://www.w3.org/2001/XMLSchema#anyURI Anyway, well done! -- =S Page |