com.ldodds.foaf.jena
Class PrimaryPersonSniffer

java.lang.Object
  extended bycom.ldodds.foaf.jena.PrimaryPersonSniffer

public class PrimaryPersonSniffer
extends java.lang.Object

Author:
ldodds

Constructor Summary
PrimaryPersonSniffer()
           
 
Method Summary
static Resource findPrimaryResource(Model model, java.lang.String base, boolean allowGuessWork)
          Note: will never return null if there's a person in the document because of attempts to "guess" the primary topic.
static Resource guessPersonTopicFromRelationships(Model model)
          Attempts to determine the primary person of a FOAF document, if said document doesn't have a foaf:maker or dc:creator property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimaryPersonSniffer

public PrimaryPersonSniffer()
Method Detail

findPrimaryResource

public static Resource findPrimaryResource(Model model,
                                           java.lang.String base,
                                           boolean allowGuessWork)
Note: will never return null if there's a person in the document because of attempts to "guess" the primary topic. Change the switch to alter this behaviour

Parameters:
model -
base -
Returns:

guessPersonTopicFromRelationships

public static Resource guessPersonTopicFromRelationships(Model model)
Attempts to determine the primary person of a FOAF document, if said document doesn't have a foaf:maker or dc:creator property. The algorithm is far from fool-proof, but will deal with most simple FOAF docs, e.g. those created by FOAF-a-Matic Mark 1. The method will return the first Resource it finds in the model that isn't the object of any foaf:knows relationships. This therefore assumes that all people in a simple FOAF file will be known by a single main person. Obviously this isn't always true.

Parameters:
model -
Returns:
the foaf:Person Resource object, or null