On 31/10/11 17:52, Samuel Lampa wrote: > On 09/25/2011 11:05 AM, Markus Krötzsch wrote: >> RDF data is represented by a smaller set of classes under SMWExpElement. >> These classes represent triples for the purpose of serialisation (they >> abstract RDF before fixing a concrete syntax such as RDF/XML or Turtle). > > Got two questions: > > === Q1: Any SMWExpElements / SMWData converter? === > > Are there converters from/to the SMWExpElement related classes and the > SMWData/SMWDataItems combo already? > > I ask since so far I have been thinking about using the > SMWData/SMWDataItem combo as native format in RDFIO, but it strikes me > that the SMWExpElement related classes much more closely matches the > data structure that you get from ARC2's RDF parsers. > > Thus, I was thinking that if I can do only the conversion from ARC2 data > structures to SMWExpElements classes, and then there is already some > converters to SMWData/SMWDataItem, I wouldn't need to reinvent that > wheel...?
Yes, the SMWExpElement classes are meant as an abstraction of RDF terms and triples. They are used (1) as a pre-serialisation format for producing RDF (in any syntax) and (2) as a post-parsing format for interpreting SPARQL results. * Due to (1), there is a complete implementation for the conversion SMWDataItem/SMWSemanticData => SMWExpElement This is done in the class SMWExporter (various methods, should be easy to find). * Due to (2), there is an incomplete conversion SMWExpElement => SMWDataItem It is incomplete since we only need to interpret URIs as wiki pages when reading SPARQL results. Other types of RDF terms are not relevant in the SPARQL results we interpret. This conversion is implemented in SMWExporter::findDataItemForExpElement(). This method could be extended to create SMWDataItems for other types of input on a best-effort basis. Since SPARQL results are plain lists (no graphs), there is no method yet for turning sets of triples into (necessarily many) SMWSemanticData objects. This could be added to SMWExporter as well, if needed. The extension of this code would make sense in SMW. One could also imagine that this is later used for importing SPARQL results into SMW data for general forms of SPARQL queries. Note, however, that a main design goal for such an extension would be to round-trip the data that SMW exports as good as possible. > > === Q2: Status of SMWData/SMWDataItem as API? === > > Also I wondered what status the SMWData/SMWDataItem classes are supposed > to have, as a general API? ... Are they the supposed API, or is SMW > going towards preferring to talk SPARQL with all extensions ... or even > SMWExpElements? > > I ask this since it does not seem clear that I will really *need* to use > the SMWData/SMWDataItem combo as a representation, if I do the wiki page > updates either with the Wiki Object Model extension or an own writer class. > > I would still prefer to use it, if it is pushed as a preferred API for > these kind of things, but I wondered whether that is so for the > foreseeable future? SMWDataItems are supposed to be the main atomic data representation API in SMW. SMWSemanticData is the main annotation (property assignment) API in SMW. Both are assumed to stay in this position for the foreseeable future. SMWExpElement is based on the RDF data model and is therefore not suitable for representing SMW data where we have special elements like wiki pages, properties or geographic coordinates that are not represented explicitly in RDF. We need an API that distinguishes data items by their functional role in SMW (e.g., wiki page vs. property vs. URI) where this distinction does not exist in RDF. For these reasons, data items and semantic data containers are the main API for passing around data in SMW. Markus ------------------------------------------------------------------------------ Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World™ now supports Android™ Apps for the BlackBerry® PlayBook™. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel