Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends

PD_DocumentRDF Class Reference

The RDF associated with a document. More...

#include <pd_DocumentRDF.h>

Inheritance diagram for PD_DocumentRDF:
PD_RDFModel PD_RDFModelFromAP PD_RDFModelFromStartEndPos RDFModel_SPARQLLimited RDFModel_XMLIDLimited

List of all members.

Public Member Functions

 PD_DocumentRDF (PD_Document *doc)
virtual ~PD_DocumentRDF ()
UT_Error setupWithPieceTable ()
 If the document changes its m_pPieceTable it needs to call here too.
bool haveSemItems () const
 Does this document have any semantic items like contacts, events etc.
virtual PD_ObjectList getObjects (const PD_URI &s, const PD_URI &p)
 Get a list of all the objects which have the given subject and predicate.
virtual PD_URIList getSubjects (const PD_URI &p, const PD_Object &o)
 Get a list of all the subjects which have the given predicate and object.
virtual PD_URIList getAllSubjects ()
virtual POCol getArcsOut (const PD_URI &s)
 Get the predicate and objects which have the given subject.
virtual bool contains (const PD_URI &s, const PD_URI &p, const PD_Object &o)
 Test if the given triple is in the RDF or not.
virtual bool contains (const PD_RDFStatement &st)
virtual long getTripleCount ()
 Get the total number of triples in the model.
virtual PD_RDFModelIterator begin ()
virtual PD_RDFModelIterator end ()
virtual void dumpModel (const std::string &headerMsg="dumpModel()")
 Dump the model as debug messages.
virtual
PD_DocumentRDFMutationHandle 
createMutation ()
 The single way that you can update the document RDF is through an PD_DocumentRDFMutation.
void handleCollabEvent (const gchar **szAtts, const gchar **szProps)
 Internal method: used by AbiCollab to update the RDF.
PD_RDFModelHandle getRDFAtPosition (PT_DocPosition pos)
PD_RDFModelHandle getRDFForID (const std::string &xmlid)
std::list< pf_Frag_Object * > getObjectsInScopeOfTypesForRange (std::set< PTObjectType > objectTypes, std::pair< PT_DocPosition, PT_DocPosition > range)
std::set< std::string > & addXMLIDsForObjects (std::set< std::string > &ret, std::list< pf_Frag_Object * > objectList)
PT_DocPosition addXMLIDsForBlockAndTableCellForPosition (std::set< std::string > &col, PT_DocPosition pos)
void addRDFForID (const std::string &xmlid, PD_DocumentRDFMutationHandle &m)
std::set< std::string > & addRelevantIDsForPosition (std::set< std::string > &ret, PT_DocPosition pos)
std::set< std::string > & addRelevantIDsForRange (std::set< std::string > &ret, PD_DocumentRange *range)
std::set< std::string > & addRelevantIDsForRange (std::set< std::string > &ret, std::pair< PT_DocPosition, PT_DocPosition > range)
std::set< std::string > & getAllIDs (std::set< std::string > &ret)
std::pair< PT_DocPosition,
PT_DocPosition
getIDRange (const std::string &xmlid) const
PD_RDFModelHandle createRestrictedModelForXMLIDs (const std::string &writeID, const std::set< std::string > &xmlids)
PD_RDFModelHandle createRestrictedModelForXMLIDs (const std::set< std::string > &xmlids)
virtual void maybeSetDocumentDirty ()
void runMilestone2Test ()
void runMilestone2Test2 ()
void dumpObjectMarkersFromDocument ()
void runPlay ()
std::string makeLegalXMLID (const std::string &s)
void relinkRDFToNewXMLID (const std::string &oldxmlid, const std::string &newxmlid, bool deepCopyRDF=false)
PD_RDFModelHandle createScratchModel ()
PD_RDFSemanticItems getAllSemanticObjects (const std::string &classRestriction="")
PD_RDFSemanticItems getSemanticObjects (const std::set< std::string > &xmlids)
PD_RDFContacts getContacts (PD_RDFModelHandle alternateModel=PD_RDFModelHandle((PD_RDFModel *) 0))
PD_RDFEvents getEvents (PD_RDFModelHandle alternateModel=PD_RDFModelHandle((PD_RDFModel *) 0))
PD_RDFLocations getLocations (PD_RDFModelHandle alternateModel=PD_RDFModelHandle((PD_RDFModel *) 0))
void selectXMLIDs (const std::set< std::string > &xmlids, FV_View *pView=0) const
void showEditorWindow (const PD_RDFSemanticItems &cl)

Static Public Member Functions

static std::string getSPARQL_LimitedToXMLIDList (const std::set< std::string > &xmlids, const std::string &extraPreds="")
static PD_URI getManifestURI ()
static void setSemanticItemFactory (PD_SemanticItemFactory *f)
static void setRDFDialogs (PD_RDFDialogs *d)
static PD_SemanticItemFactorygetSemanticItemFactory ()
static PD_RDFDialogsgetRDFDialogs ()

Protected Member Functions

PD_ObjectListapGetObjects (const PP_AttrProp *AP, PD_ObjectList &ret, const PD_URI &s, const PD_URI &p)
 Internal method: Using the supplied AP, insert into ret a list of all the objects which have the given subject and predicate.
PD_URIListapGetSubjects (const PP_AttrProp *AP, PD_URIList &ret, const PD_URI &p, const PD_Object &o)
 Internal method: Using the supplied AP, insert into ret a list of all the subjects which have the given predicate and object.
PD_URIListapGetAllSubjects (const PP_AttrProp *AP, PD_URIList &ret)
 Internal method: Using the supplied AP, insert into ret a list of every subject in the model.
POColapGetArcsOut (const PP_AttrProp *AP, POCol &ret, const PD_URI &s)
 Get the predicate and objects which have the given subject.
bool apContains (const PP_AttrProp *AP, const PD_URI &s, const PD_URI &p, const PD_Object &o)
 Internal method: tests if the AP has the triple or not.
void apDumpModel (const PP_AttrProp *AP, const std::string &headerMsg)
 Dump the model contained in the given AP as debug messages.
void updateHaveSemItemsCache ()

Protected Attributes

PD_Documentm_doc

Private Member Functions

PD_DocumentgetDocument (void) const
pt_PieceTablegetPieceTable (void) const
void setIndexAP (PT_AttrPropIndex idx)
 Change the AttrProp Index that we are using to store all the RDF.
PT_AttrPropIndex getIndexAP (void) const
 Get the AttrProp index where we are storing all the RDF.
virtual const PP_AttrPropgetAP (void)
 Get the AttrProp with all the RDF in it.
virtual UT_Error setAP (PP_AttrProp *newAP)
virtual bool isStandAlone () const
std::set< std::string > & priv_addRelevantIDsForPosition (std::set< std::string > &ret, PT_DocPosition pos, PT_DocPosition searchBackThisFar=0)
PD_RDFLocationsaddLocations (PD_RDFLocations &ret, bool isGeo84, const std::string sparql, PD_RDFModelHandle alternateModel)

Private Attributes

PT_AttrPropIndex m_indexAP
bool m_haveSemItems

Static Private Attributes

static PD_SemanticItemFactorys_SemanticItemFactory
static PD_RDFDialogss_RDFDialogs

Friends

class PD_DocumentRDFMutation
class RDFModel_SPARQLLimited
class PD_RDFMutation_XMLIDLimited
class PD_RDFSemanticItem

Detailed Description

The RDF associated with a document.

The RDFModel interface can be used to query all the RDF for this document. Use createMutation() to create an object which allows you to update the RDF in batch.

To find the RDF which is associated with an element use getRDFAtPosition() and getRDFForID() which return a submodel.


Constructor & Destructor Documentation

PD_DocumentRDF::PD_DocumentRDF ( PD_Document doc  )  [explicit]

References UT_DEBUGMSG.

PD_DocumentRDF::~PD_DocumentRDF (  )  [virtual]

References UT_DEBUGMSG.


Member Function Documentation

PD_RDFLocations & PD_DocumentRDF::addLocations ( PD_RDFLocations ret,
bool  isGeo84,
const std::string  sparql,
PD_RDFModelHandle  alternateModel 
) [private]
void PD_DocumentRDF::addRDFForID ( const std::string &  xmlid,
PD_DocumentRDFMutationHandle m 
)
std::set< std::string > & PD_DocumentRDF::addRelevantIDsForPosition ( std::set< std::string > &  ret,
PT_DocPosition  pos 
)

References addRelevantIDsForRange().

Referenced by getRDFAtPosition().

std::set< std::string > & PD_DocumentRDF::addRelevantIDsForRange ( std::set< std::string > &  ret,
PD_DocumentRange range 
)
std::set< std::string > & PD_DocumentRDF::addRelevantIDsForRange ( std::set< std::string > &  ret,
std::pair< PT_DocPosition, PT_DocPosition range 
)
std::set< std::string > & PD_DocumentRDF::addXMLIDsForObjects ( std::set< std::string > &  ret,
std::list< pf_Frag_Object * >  objectList 
)
bool PD_DocumentRDF::apContains ( const PP_AttrProp AP,
const PD_URI s,
const PD_URI p,
const PD_Object o 
) [protected]

Internal method: tests if the AP has the triple or not.

References decodePOCol(), gchar, PP_AttrProp::getProperty(), and PD_URI::toString().

Referenced by PD_DocumentRDFMutation::add(), contains(), and PD_RDFModelFromStartEndPos::contains().

void PD_DocumentRDF::apDumpModel ( const PP_AttrProp AP,
const std::string &  headerMsg 
) [protected]
PD_URIList & PD_DocumentRDF::apGetAllSubjects ( const PP_AttrProp AP,
PD_URIList ret 
) [protected]

Internal method: Using the supplied AP, insert into ret a list of every subject in the model.

If you want to get all triples, then first get all subjects and then use getArcsOut() to get the predicate-object combinations for each of the subjects.

References gchar, PP_AttrProp::getNthProperty(), PP_AttrProp::getPropertyCount(), and szName.

Referenced by getAllSubjects(), and PD_RDFModelFromStartEndPos::getAllSubjects().

POCol & PD_DocumentRDF::apGetArcsOut ( const PP_AttrProp AP,
POCol ret,
const PD_URI s 
) [protected]

Get the predicate and objects which have the given subject.

This can be thought of as all the arcs from the node at 's' in the RDF graph.

References decodePOCol(), gchar, PP_AttrProp::getProperty(), and PD_URI::toString().

Referenced by getArcsOut(), and PD_RDFModelFromStartEndPos::getArcsOut().

PD_ObjectList & PD_DocumentRDF::apGetObjects ( const PP_AttrProp AP,
PD_ObjectList ret,
const PD_URI s,
const PD_URI p 
) [protected]

Internal method: Using the supplied AP, insert into ret a list of all the objects which have the given subject and predicate.

For example: emu has legs emu has eyes would give { legs, eyes }

References decodePOCol(), gchar, PP_AttrProp::getProperty(), and PD_URI::toString().

Referenced by getObjects(), and PD_RDFModelFromStartEndPos::getObjects().

PD_URIList & PD_DocumentRDF::apGetSubjects ( const PP_AttrProp AP,
PD_URIList ret,
const PD_URI p,
const PD_Object o 
) [protected]

Internal method: Using the supplied AP, insert into ret a list of all the subjects which have the given predicate and object.

For example: emu has legs emu has eyes human has legs when called with ( has, legs ) would give { emu, human }

References decodePOCol(), gchar, PP_AttrProp::getNthProperty(), PP_AttrProp::getPropertyCount(), and szName.

Referenced by getSubjects(), and PD_RDFModelFromStartEndPos::getSubjects().

PD_RDFModelIterator PD_DocumentRDF::begin (  )  [virtual]
bool PD_DocumentRDF::contains ( const PD_URI s,
const PD_URI p,
const PD_Object o 
) [virtual]

Test if the given triple is in the RDF or not.

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apContains(), and getAP().

Referenced by PD_DocumentRDFMutation::add(), and contains().

bool PD_DocumentRDF::contains ( const PD_RDFStatement st  )  [virtual]
PD_DocumentRDFMutationHandle PD_DocumentRDF::createMutation (  )  [virtual]

The single way that you can update the document RDF is through an PD_DocumentRDFMutation.

This is where you get one of those.

See also:
PD_DocumentRDFMutation

Implements PD_RDFModel.

Reimplemented in RDFModel_SPARQLLimited, and RDFModel_XMLIDLimited.

References PD_DocumentRDFMutation.

Referenced by getRDFAtPosition(), getRDFForID(), handleCollabEvent(), relinkRDFToNewXMLID(), and runMilestone2Test().

PD_RDFModelHandle PD_DocumentRDF::createRestrictedModelForXMLIDs ( const std::string &  writeID,
const std::set< std::string > &  xmlids 
)
PD_RDFModelHandle PD_DocumentRDF::createRestrictedModelForXMLIDs ( const std::set< std::string > &  xmlids  ) 
PD_RDFModelHandle PD_DocumentRDF::createScratchModel (  ) 

References getDocument().

void PD_DocumentRDF::dumpModel ( const std::string &  headerMsg = "dumpModel()"  )  [virtual]

Dump the model as debug messages.

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apDumpModel(), getAP(), m_doc, UT_DEBUG_ONLY_ARG, and UT_DEBUGMSG.

Referenced by runMilestone2Test().

PD_RDFModelIterator PD_DocumentRDF::end ( void   )  [virtual]

Implements PD_RDFModel.

std::set< std::string > & PD_DocumentRDF::getAllIDs ( std::set< std::string > &  ret  ) 
PD_RDFSemanticItems PD_DocumentRDF::getAllSemanticObjects ( const std::string &  classRestriction = ""  ) 
PD_URIList PD_DocumentRDF::getAllSubjects (  )  [virtual]

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apGetAllSubjects(), and getAP().

Referenced by addRDFForID(), and getTripleCount().

POCol PD_DocumentRDF::getArcsOut ( const PD_URI s  )  [virtual]

Get the predicate and objects which have the given subject.

This can be thought of as all the arcs from the node at 's' in the RDF graph.

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apGetArcsOut(), and getAP().

Referenced by addRDFForID(), getTripleCount(), and runMilestone2Test2().

PT_AttrPropIndex PD_DocumentRDF::getIndexAP ( void   )  const [private]

Get the AttrProp index where we are storing all the RDF.

References m_indexAP.

Referenced by getAP().

PD_RDFLocations PD_DocumentRDF::getLocations ( PD_RDFModelHandle  alternateModel = PD_RDFModelHandle((PD_RDFModel*)0)  ) 
PD_URI PD_DocumentRDF::getManifestURI (  )  [static]
PD_ObjectList PD_DocumentRDF::getObjects ( const PD_URI s,
const PD_URI p 
) [virtual]

Get a list of all the objects which have the given subject and predicate.

For example: emu has legs emu has eyes would give { legs, eyes }

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apGetObjects(), and getAP().

Referenced by PD_DocumentRDFMutation::remove().

PD_RDFDialogs * PD_DocumentRDF::getRDFDialogs (  )  [static]
PD_RDFModelHandle PD_DocumentRDF::getRDFForID ( const std::string &  xmlid  ) 
PD_SemanticItemFactory * PD_DocumentRDF::getSemanticItemFactory (  )  [static]
PD_RDFSemanticItems PD_DocumentRDF::getSemanticObjects ( const std::set< std::string > &  xmlids  ) 
std::string PD_DocumentRDF::getSPARQL_LimitedToXMLIDList ( const std::set< std::string > &  xmlids,
const std::string &  extraPreds = "" 
) [static]
PD_URIList PD_DocumentRDF::getSubjects ( const PD_URI p,
const PD_Object o 
) [virtual]

Get a list of all the subjects which have the given predicate and object.

For example: emu has legs emu has eyes human has legs when called with ( has, legs ) would give { emu, human }

Reimplemented from PD_RDFModel.

Reimplemented in PD_RDFModelFromStartEndPos.

References apGetSubjects(), and getAP().

Referenced by runMilestone2Test2().

long PD_DocumentRDF::getTripleCount (  )  [virtual]

Get the total number of triples in the model.

This can be relatively expensive to calculate. So definately don't keep on doing it in a loop.

Reimplemented from PD_RDFModel.

References getAllSubjects(), and getArcsOut().

Referenced by apDumpModel().

void PD_DocumentRDF::handleCollabEvent ( const gchar **  szAtts,
const gchar **  szProps 
)

Internal method: used by AbiCollab to update the RDF.

References createMutation().

bool PD_DocumentRDF::haveSemItems (  )  const

Does this document have any semantic items like contacts, events etc.

References m_haveSemItems.

bool PD_DocumentRDF::isStandAlone (  )  const [private, virtual]
std::string PD_DocumentRDF::makeLegalXMLID ( const std::string &  s  ) 
void PD_DocumentRDF::maybeSetDocumentDirty (  )  [virtual]
void PD_DocumentRDF::relinkRDFToNewXMLID ( const std::string &  oldxmlid,
const std::string &  newxmlid,
bool  deepCopyRDF = false 
)
void PD_DocumentRDF::runMilestone2Test (  ) 
void PD_DocumentRDF::runMilestone2Test2 (  ) 
void PD_DocumentRDF::runPlay (  ) 
void PD_DocumentRDF::selectXMLIDs ( const std::set< std::string > &  xmlids,
FV_View pView = 0 
) const
void PD_DocumentRDF::setIndexAP ( PT_AttrPropIndex  idx  )  [private]

Change the AttrProp Index that we are using to store all the RDF.

This is used by PD_DocumentRDFMutation to commit it's changes.

References m_indexAP.

Referenced by setAP().

void PD_DocumentRDF::setRDFDialogs ( PD_RDFDialogs d  )  [static]
void PD_DocumentRDF::setSemanticItemFactory ( PD_SemanticItemFactory f  )  [static]
UT_Error PD_DocumentRDF::setupWithPieceTable (  ) 

If the document changes its m_pPieceTable it needs to call here too.

In various places like PD_Document::_importFile the document creates a new piecetable and thus must notify the DocumentRDF of this change so we can update our AttrProp indexes and the like.

References pt_VarSet::addIfUniqueAP(), getPieceTable(), pt_PieceTable::getVarSet(), m_indexAP, and UT_DEBUGMSG.

void PD_DocumentRDF::showEditorWindow ( const PD_RDFSemanticItems cl  ) 
void PD_DocumentRDF::updateHaveSemItemsCache (  )  [protected]

Friends And Related Function Documentation

friend class PD_DocumentRDFMutation [friend]

Referenced by createMutation().

friend class PD_RDFSemanticItem [friend]
friend class RDFModel_SPARQLLimited [friend]

Member Data Documentation


The documentation for this class was generated from the following files: