Changes between Version 4 and Version 5 of FrequentlyAskedQuestions

Show
Ignore:
Timestamp:
02/03/2010 17:28:03 (6 months ago)
Author:
daniel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FrequentlyAskedQuestions

    v4 v5  
    1616 
    1717{{{ 
    18 #!html 
     18#!xm 
    1919<% if current_user.guest? %> 
    2020  <p>Guests may not access this data</p> 
     
    8181This will return all sources that have an rdf type which in turn is a "Class" (which means that it was defined in an ontology) 
    8282 
    83 == How do i get all the supertypes of a source? ==  
     83== How do i get all the supertypes of a source? == 
     84 
     85The #types method of a source will return an array of [http://net7.github.com/semantic_naming/classes/N/SourceClass.html SourceClass] objects, each of which you can ask for their supertypes: 
     86 
     87{{{ 
     88#!ruby 
     89supertypes = [] 
     90source.types.each { |tp| supertypes += tp.superty} 
     91supertypes.uniq! 
     92}}} 
     93 
     94This method isn't very efficient, though. You may want to check if the N::SourceClass.subclass_hierarchy method will help you out, or use a custom RDF query like this: 
     95 
     96{{{ 
     97#!ruby 
     98supertypes = ActiveRDF::Query.new(N::SourceClass).select(:superclass).where(source, N::RDF.type, :type).where(:type, N::RDFS.subClassOf, :superclass).execute 
     99}}} 
    84100 
    85101== How do i get all the incoming properties of a source? ==  
     102== How do i get all the outgoing properties of a source? ==  
    86103 
    87 == How do i get all the outgoing properties of a source? ==  
     104You can just use the #direct_predicates and #inverse_predicates methods on a source object. 
     105 
     106{{{ 
     107#!ruby 
     108source.direct_predicates 
     109=> [pred1, pred2] 
     110source.inverse_predicates 
     111=> [pred1, pred2] 
     112}}} 
    88113 
    89114== How do i "unpublish" a source? ==  
    90115 
     116In general we do not recommend delete data from the web after it has been published, as other people may already link to it. If you just want to rebuild your datastore from a clean slate, try importing your data again with the `reset_store` option. 
     117 
     118That said, you may use #delete or #destroy on source objects. This feature is still a bit experimental and may not always remove all traces of the source, though. 
     119 
    91120== How do I add another data object to a source? ==  
    92121 
     122You may add any number of data objects to a source. You can add data objects through the data import facility (even multiple ones) or during incremental imports. To add them programmatically, you need to do something like this: 
     123 
     124{{{ 
     125#!ruby 
     126xml_data = TaliaCore::DataTypes::XmlData.new 
     127xml_data.create_from_file('xml_file', path_to_xml_file) 
     128source.data_records << xml_data 
     129}}} 
     130 
     131See the [http://net7.github.com/talia_core/ documentation] to find out how data records can be created and which data types exist in Talia. 
     132 
    93133== How do I get a hash of a source? ==  
     134== Does the hash change when I modify/add/remove the properties of a source or its data objects? ==  
    94135 
    95 == Does the hash change when I modify/add/remove the properties of a source or its data objects? ==  
     136Talia doesn't provide a special facility to compute hash values for a given source.