src/type-registry.js
/**
 * Returns a list of registry entries from a given parsed type index graph.
 * @method registrationsFromGraph
 * @param graph {Graph} Parsed type index graph
 * @param rdfClass {NamedNode} RDF Class
 * @param isListed {Boolean} Whether to register in a listed or unlisted index
 * @return {Array<IndexRegistration>}
 */
Returns a list of registry entries from a given parsed type index graph.
Returns a list of registry entries from a given parsed type index graph .
function registrationsFromGraph (graph, rdfClass, isListed, rdf) {
  var entrySubject, instanceMatches, containerMatches
  var ns = vocab(rdf)
  var registrations = []
  if (!graph) {
    return registrations
  }
  var matches = graph.statementsMatching(null, null, rdfClass)
  matches.forEach(function (match) {
    entrySubject = match.subject
    instanceMatches =
      graph.statementsMatching(entrySubject, ns.solid('instance'))
    instanceMatches.forEach(function (location) {
      registrations.push(new IndexRegistration(entrySubject.uri, rdfClass,
        'instance', location.object.uri, isListed))
    })
    containerMatches =
      graph.statementsMatching(entrySubject, ns.solid('instanceContainer'))
    containerMatches.forEach(function (location) {
      registrations.push(new IndexRegistration(entrySubject.uri, rdfClass,
        'container', location.object.uri, isListed))
    })
  })
  return registrations
}
function registrationsFromGraph ( graph , rdfClass , isListed , rdf ) { var entrySubject , instanceMatches , containerMatches var ns = vocab ( rdf ) var registrations = [ ] if ( ! graph ) { return registrations } var matches = graph . statementsMatching ( null , null , rdfClass ) matches . forEach ( function ( match ) { entrySubject = match . subject instanceMatches = graph . statementsMatching ( entrySubject , ns . solid ( 'instance' ) ) instanceMatches . forEach ( function ( location ) { registrations . push ( new IndexRegistration ( entrySubject . uri , rdfClass , 'instance' , location . object . uri , isListed ) ) } ) containerMatches = graph . statementsMatching ( entrySubject , ns . solid ( 'instanceContainer' ) ) containerMatches . forEach ( function ( location ) { registrations . push ( new IndexRegistration ( entrySubject . uri , rdfClass , 'container' , location . object . uri , isListed ) ) } ) } ) return registrations }
Returns a list of registry entries from a given parsed type index graph.
Returns a list of registry entries from a given parsed type index graph .
// Have the hash fragment of the registration, now need to determine // location type, and the actual location. // Now try to find solid:instanceContainer matches