I have unmanaged triples stored as part of separate documents that I keep in my db content. In fact, each document represents a person, and a particular tee indicates the document URI for the character manager. I am trying to use SPARQL to determine the length of paths between a manager and all the people below them in a hierarchy.
The triples in the document look like
<sem:triple xmlns:sem="http://marklogic.com/semantics"> <sem:subject>http://rdf.abbvienet.com/infrastructure/person/10740024</sem:subject> <sem:predicate>http://schemas.abbvienet.com/ontologies/infrastructure.owl#manager</sem:predicate> <sem:object>http://rdf.abbvienet.com/infrastructure/person/10206242</sem:object> </sem:triple>
I found the following sparql query, which can be used to return a manager, aperson below them in the hierarchy and the number of remote nodes.
select ?manager ?leaf (count(?mid) as ?distance) { BIND(<http://rdf.abbvienet.com/infrastructure/person/10025613> as ?manager) ?leaf <http://schemas.abbvienet.com/ontologies/infrastructure.owl
This works, but very slowly, even when the hierarchy tree I'm looking at is one or two levels deep, about 15 seconds. I have 63,139 control triples of this type in db.
source share