Merge branch 'develop' of https://github.com/vivo-project/Vitro into develop

This commit is contained in:
hudajkhan 2013-10-03 12:48:19 -04:00
commit 8eaba019a6
3 changed files with 35 additions and 2 deletions

View file

@ -32,6 +32,13 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
public class RelationshipChecker { public class RelationshipChecker {
private static final Log log = LogFactory.getLog(RelationshipChecker.class); private static final Log log = LogFactory.getLog(RelationshipChecker.class);
protected static final String NS_CORE = "http://vivoweb.org/ontology/core#";
protected static final String NS_OBO = "http://purl.obolibrary.org/obo/";
protected static final String URI_RELATES = NS_CORE + "relates";
protected static final String URI_RELATED_BY = NS_CORE + "relatedBy";
protected static final String URI_INHERES_IN = NS_OBO + "RO_0000052";
protected static final String URI_REALIZES = NS_OBO + "BFO_0000055";
private final OntModel ontModel; private final OntModel ontModel;
public RelationshipChecker(OntModel ontModel) { public RelationshipChecker(OntModel ontModel) {
@ -147,6 +154,32 @@ public class RelationshipChecker {
} }
} }
/**
* Get a list of URIs for object that link to the specified resource, by
* means of the specified properties, through a linking node of the
* specified type.
*
* So we're looking for object URIs that statisfy these statements:
*
* <resourceUri> <property1Uri> <linkNodeUri>
*
* <linkNodeUri> rdfs:type <linkNodeTypeUri>
*
* <linkNodeUri> <property2Uri> <objectUri>
*/
public List<String> getObjectsThroughLinkingNode(String resourceUri,
String property1Uri, String linkNodeTypeUri, String property2Uri) {
List<String> list = new ArrayList<String>();
for (String linkNodeUri : getObjectsOfProperty(resourceUri, property1Uri)) {
if (isResourceOfType(linkNodeUri, linkNodeTypeUri)) {
list.addAll(getObjectsOfProperty(linkNodeUri, property2Uri));
}
}
return list;
}
public Selector createSelector(String subjectUri, String predicateUri, public Selector createSelector(String subjectUri, String predicateUri,
String objectUri) { String objectUri) {
Resource subject = (subjectUri == null) ? null : ontModel Resource subject = (subjectUri == null) ? null : ontModel

View file

@ -174,7 +174,7 @@ public class FileGraphSetup implements ServletContextListener {
if ( !model.isEmpty() ) { if ( !model.isEmpty() ) {
baseModel.addSubModel(model); baseModel.addSubModel(model);
log.info("Attached file graph as " + type + " submodel " + pathToURI(p, type)); log.info("Attached file graph as " + type + " submodel " + p.getFileName());
} }
modelChanged = modelChanged | updateGraphInDB(dataset, model, type, p); modelChanged = modelChanged | updateGraphInDB(dataset, model, type, p);

View file

@ -148,7 +148,7 @@ public class RDFFilesLoader {
private static void readOntologyFileIntoModel(Path p, Model model) { private static void readOntologyFileIntoModel(Path p, Model model) {
String format = getRdfFormat(p); String format = getRdfFormat(p);
log.info("Loading file at " + p + " as " + format); log.info("Loading "+ p);
try (InputStream stream = new FileInputStream(p.toFile())) { try (InputStream stream = new FileInputStream(p.toFile())) {
model.read(stream, null, format); model.read(stream, null, format);
log.debug("...successful"); log.debug("...successful");