{"_id":"@rdfjs/score","_rev":"5-d899f7e290b8cda7c906776e1583f1c8","name":"@rdfjs/score","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@rdfjs/score","version":"0.1.0","keywords":["rdf","rdfjs","score"],"author":{"url":"https://www.bergnet.org/people/bergi/card#me","name":"Thomas Bergwinkl","email":"bergi@axolotlfarm.org"},"license":"MIT","_id":"@rdfjs/score@0.1.0","maintainers":[{"name":"bergos","email":"bergi@bergnet.org"},{"name":"l00mi","email":"npm.michael@oiu.ch"}],"homepage":"https://github.com/rdfjs-base/score","bugs":{"url":"https://github.com/rdfjs-base/score/issues"},"dist":{"shasum":"e1eb25b0d5a24ad4423c5ebfc6cf46681bb05156","tarball":"https://registry.npmjs.org/@rdfjs/score/-/score-0.1.0.tgz","fileCount":46,"integrity":"sha512-gFsAVtqZEk9TR9FuzgCJ8fY9PBsJldd94bjdWQdtSbiorEtqUk0yvI1ovrCNH0jnfXAW/VOsT/7XXuRlGNRVVA==","signatures":[{"sig":"MEUCIQC3pOQ+tI1KetdxUAGSR3XkGf9LseYRHXmjoQfG7jyCywIgW03NuATSY7NUlsiZXsVhE25hLHy4wcpNNr/BapZzm/w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNr/EACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJHg/+PDZ5ZNg0kjfTQ63bR6WhfNWA2rdBvnCiFS8ke7ikEGXj01+7\r\n9RUgaQis2MnrDrjzOwdKw/U5y8F9BNdCCzPUusUrlfdL8d8R1Oxf+V/UtDVJ\r\niSsZmoUW4X77ZVHbfnXWYk8BnXzeWK5/Dh3wiz+ZCPmmzd8GaMxZZ6J2P0Jy\r\nS97pdd9p61C1YpayDmZVcWBeio8eLrb6BMUmGSR/SKqFo4Gi57cC8ZyjikXt\r\npY9i5el4O/TX+Xt+HkBZRRQrLDsPVhGje9kAWXvxQPMx9bBy6m4AqerFuHh+\r\nrAs5/a2iFAjnPWVud3UEORURWZnPvvU8aKVxAKogXx2MGBiEpa6YF6w+MePp\r\nz4PXA3uS6XNr8ko6FOqmyOatDE3VMU2MyhBsTKUoP8Eprw1JVpvpLHdOoUyS\r\n1OxO4yxAhYYAimWWYgMwLYjeAvh3nf/yKViapDR1oXOqXBiFfWzF7/dEJp3h\r\nVSfaZBdGZ0dL65Q7OGgvEb/H8lbRqPmxzfEEhkeZZIiZuLH9AdLmczafktas\r\nkh5TjX4PytPP1VOJgGh0cO2J/yEK1KVUv07WQRAvdOBLIUJtXLMv2RDda4da\r\nr9ApBmnKXpL3dwSNSRt94GZ6kZfbzB+nM7f5jCMgeDvlEna6S5iJdqh3EQLE\r\nclrn0sIVPoFW7hCHM4NKYz2ORJMXKDTCFPw=\r\n=fWC0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","type":"module","gitHead":"f949f63d0f6c5acbeb34c2c8a1d5b8abc53b6afa","scripts":{"test":"stricter-standard && c8 --reporter=lcov --reporter=text-summary mocha"},"_npmUser":{"name":"bergos","email":"bergi@bergnet.org"},"repository":{"url":"git+https://github.com/rdfjs-base/score.git","type":"git"},"_npmVersion":"8.13.2","description":"Scores RDF/JS terms inside a dataset","directories":{},"_nodeVersion":"18.6.0","dependencies":{"@rdfjs/term-map":"^2.0.0","@rdfjs/term-set":"^2.0.1","@rdfjs/data-model":"^2.0.1","@rdfjs/to-ntriples":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.12.0","mocha":"^10.0.0","@rdfjs/dataset":"^2.0.1","@rdfjs/namespace":"^2.0.0","stricter-standard":"^0.2.0","@rdfjs/environment":"^0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/score_0.1.0_1664532420110_0.4700909044105761","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@rdfjs/score","version":"0.1.1","keywords":["rdf","rdfjs","score"],"author":{"url":"https://www.bergnet.org/people/bergi/card#me","name":"Thomas Bergwinkl","email":"bergi@axolotlfarm.org"},"license":"MIT","_id":"@rdfjs/score@0.1.1","maintainers":[{"name":"bergos","email":"bergi@bergnet.org"},{"name":"l00mi","email":"npm.michael@oiu.ch"}],"homepage":"https://github.com/rdfjs-base/score","bugs":{"url":"https://github.com/rdfjs-base/score/issues"},"dist":{"shasum":"8431cbf62458eb28ddc06dcbd02ee5d814d4f492","tarball":"https://registry.npmjs.org/@rdfjs/score/-/score-0.1.1.tgz","fileCount":46,"integrity":"sha512-+t9Sf5nFUJTvH8X2Xy7H+egLKIyVCwlDzCGrWThSrSCmIENcC9n3+GkMMImnsmYDeSXaWi3awcI1f1TmA84FIQ==","signatures":[{"sig":"MEUCIQDoQ2LczokNgzxat5Wi/RrNef9mO9WKoqqqJ+5RMnJL0gIgZQ3n55d0ug7rQcblF74s+9XyoQUg/scn8N+3EWarKZk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71501,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjOAfIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpX3g/+N3nqW75yaK/CL/zWa2jrEQPLgx2e9X56sSnQwlwxVZ8yfjBA\r\nxsIzulYT6JCjP/lUISIEdTpBDx/J4BmQffvCtCEURXnjpi5JSfdR+YGtjnTB\r\n5mnk5ffJ8UG/cZu3WuUsPnZ02XpJ6D5wI8O2VFGnsRPUyGfDrPYPqBRFodTq\r\n8rBq/mj7tgHiSXf09ohv/MYABkNfMOz7PFOC8zFTSNtrLzvXUgOfdLLdlQ2/\r\nwOe0MrL7qwZ8bNfHCcoWetK8eHT/DwtT2ouP7FH+L0y7NVsMAIfF5pcO3NW6\r\n8atCCxm7LcwwrEdiqDzm3AFrwjG1g+ijlFU1zHNFMC9UDYpqtUtClZ7iyFIp\r\nArwgIDpTfSEKHCDqQ20rvM32k4lCboZWhokDGwdLIqVNS2AfksyfH2d3v9ti\r\nc94DkKc2hQNsw4kNSnvDnd3BtmEArmX2Qe7hYIm02IRXE6+nkvtsF2fu5j16\r\nsYdlT6cBSj4Eo9qEy6cE1vZL4+SO0WoayhjfKjrjFf8+ZS7gDtxo+GBfRZku\r\nZdz4Gug1OWoJb/C+/xzwUvWxn2DTId0QKiD3XLClRM9pKkx6dgaZuu+fyVta\r\n48QIjx8JhHeTarsAYgPOugQ5+nt3pXZq0hqqpvxLhqZzRtyYWP3g8RUF+OGL\r\nXXTvjbwypnQ4jrjPRBjIQDN0eLtwDlZLURc=\r\n=nZLy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","type":"module","gitHead":"a64a68db580549678f95798847e5074ce8055a5e","scripts":{"test":"stricter-standard && c8 --reporter=lcov --reporter=text-summary mocha"},"_npmUser":{"name":"bergos","email":"bergi@bergnet.org"},"repository":{"url":"git+https://github.com/rdfjs-base/score.git","type":"git"},"_npmVersion":"8.13.2","description":"Scores RDF/JS terms inside a dataset","directories":{},"_nodeVersion":"18.6.0","dependencies":{"@rdfjs/term-map":"^2.0.0","@rdfjs/term-set":"^2.0.1","@rdfjs/data-model":"^2.0.1","@rdfjs/to-ntriples":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.12.0","mocha":"^10.0.0","@rdfjs/dataset":"^2.0.1","@rdfjs/namespace":"^2.0.0","stricter-standard":"^0.2.0","@rdfjs/environment":"^0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/score_0.1.1_1664616392723_0.7278248473101234","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@rdfjs/score","version":"0.1.2","keywords":["rdf","rdfjs","score"],"author":{"url":"https://www.bergnet.org/people/bergi/card#me","name":"Thomas Bergwinkl","email":"bergi@axolotlfarm.org"},"license":"MIT","_id":"@rdfjs/score@0.1.2","maintainers":[{"name":"bergos","email":"bergi@bergnet.org"}],"homepage":"https://github.com/rdfjs-base/score","bugs":{"url":"https://github.com/rdfjs-base/score/issues"},"dist":{"shasum":"7ac8bbf2650bea0a1f4150920b6fe752162cc3e4","tarball":"https://registry.npmjs.org/@rdfjs/score/-/score-0.1.2.tgz","fileCount":47,"integrity":"sha512-HKiC6q6sCsEPYVf9B4k/R0Hd+9e0QsjKr4zRdfuv6V4VPiPyzHfAsSUiFfRdi8UvNfpdKmoSWX8PM/ZIPwvq1g==","signatures":[{"sig":"MEYCIQCCbkrv6OGIPRaKewWt9vYi/aUwGiIDcqtoHaigHY2OuwIhAKyaP7oPy57upaGqJ3+VxLrxCHF8o8r1yObtaKKuxkbK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72600},"main":"index.js","type":"module","gitHead":"24a97f4f169a2e5de92ca4488e499562a7044fac","scripts":{"test":"stricter-standard && c8 --reporter=lcov --reporter=text-summary mocha"},"_npmUser":{"name":"bergos","email":"bergi@bergnet.org"},"repository":{"url":"git+https://github.com/rdfjs-base/score.git","type":"git"},"_npmVersion":"10.2.4","description":"Scores RDF/JS terms inside a dataset","directories":{},"_nodeVersion":"20.11.0","dependencies":{"@rdfjs/term-map":"^2.0.1","@rdfjs/term-set":"^2.0.2","@rdfjs/data-model":"^2.0.2","@rdfjs/to-ntriples":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^9.1.0","mocha":"^10.3.0","@rdfjs/dataset":"^2.0.2","@rdfjs/namespace":"^2.0.1","stricter-standard":"^0.3.0","@rdfjs/environment":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/score_0.1.2_1707550603980_0.6465150038616772","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-09-30T10:06:59.986Z","modified":"2026-02-11T20:56:39.610Z","0.1.0":"2022-09-30T10:07:00.258Z","0.1.1":"2022-10-01T09:26:32.877Z","0.1.2":"2024-02-10T07:36:44.128Z"},"bugs":{"url":"https://github.com/rdfjs-base/score/issues"},"author":{"url":"https://www.bergnet.org/people/bergi/card#me","name":"Thomas Bergwinkl","email":"bergi@axolotlfarm.org"},"license":"MIT","homepage":"https://github.com/rdfjs-base/score","keywords":["rdf","rdfjs","score"],"repository":{"url":"git+https://github.com/rdfjs-base/score.git","type":"git"},"description":"Scores RDF/JS terms inside a dataset","maintainers":[{"email":"bergi@bergnet.org","name":"bergos"},{"email":"matthieubosquet@gmail.com","name":"matthieubosquet"}],"readme":"# @rdfjs/score\n[![build status](https://img.shields.io/github/actions/workflow/status/rdfjs-base/score/test.yaml?branch=master)](https://github.com/rdfjs-base/score/actions/workflows/test.yaml)\n[![npm version](https://img.shields.io/npm/v/@rdfjs/score.svg)](https://www.npmjs.com/package/@rdfjs/score)\n\nScores RDF/JS terms inside a dataset\n\n## Install\n\n```bash\nnpm install @rdfjs/score --save\n```\n\n## Usage\n\n### Factory\n\nThis package provides a factory that can be used with [`@rdfjs/environment`](https://github.com/rdfjs-base/environment).\n\n```javascript\nimport DataFactory from '@rdfjs/environment/DataFactory.js'\nimport DatasetFactory from '@rdfjs/environment/DatasetFactory.js'\nimport Environment from '@rdfjs/environment'\nimport ScoreFactory from '@rdfjs/score/Factory.js'\n\nconst env = new Environment([DataFactory, DatasetFactory, ScoreFactory])\n```\n\n### combine(list)\n\nCombines the result of multiple score functions of the same term into a single result and calculates the average score.\n\n```javascript\nimport combine from '@rdfjs/score/combine.js'\n\nconst results = combine([score1, score2])(ptrs)\n```\n\n### combine.prioritized(list)\n\nCombines the result of multiple score functions of the same term into a single result.\nThe new score is a combined value of the results of all score functions for the same term.\nPriorities are used where the first function has the highest priority and the last one the lowest.\n\n```javascript\nimport combine from '@rdfjs/score/combine.js'\n\nconst results = combine.prioritized([score1, score2])(ptrs)\n```\n\n### concat(list)\n\nConcatenates the results of multiple score functions.\n\n```javascript\nimport concat from '@rdfjs/score/concat.js'\n\nconst results = concat([score1, score2])(ptrs)\n```\n\n### count({ graph, object, predicate, subject = true })\n\nScores all given terms based on their occurrence.\nThe parts of the triple that should be taken into account must be given as boolean `true`.\nBy default, only the subject is taken into account.\n\n```javascript\nimport count from '@rdfjs/score/count.js'\n\nconst results = count()(ptrs)\n```\n\n### distinct(results)\n\nReduces the list of results to unique terms.\nThe highest score for each term is used.\n\n```javascript\nimport distinct from '@rdfjs/score/distinct.js'\n\nconst results = distinct(results)\n```\n\n### exists({ graph, object, predicate, subject })\n\nScores a quad with 1, if one of the given parts matches.\nAt least one part must be given.\n\n```javascript\nimport exists from '@rdfjs/score/exists.js'\n\nconst results = exists({ subject: ns.ex.resource })(ptrs)\n```\n\n### fallback(list)\n\nCalls one score function after another until a score function returns a result that is not empty.\n\n```javascript\nimport fallback from '@rdfjs/score/fallback.js'\n\nconst results = fallback([score1, score2])(ptrs)\n```\n\n### fixed(term)\n\nScores the term that matches the given term with 1. \n\n```javascript\nimport fixed from '@rdfjs/score/fixed.js'\n\nconst results = fixed(ns.ex.resource)(ptrs)\n```\n\n### language(languages)\n\nScore language literals based on the order of the given languages.\nThe `*` wildcard can be used to match any language.\n\n```javascript\nimport language from '@rdfjs/score/language.js'\n\nconst results = language(['en', 'de', '*'])(ptrs)\n```\n\n### pageRank ({ alpha, epsilon })\n\nScores the given terms with the [PageRank](https://en.wikipedia.org/wiki/PageRank) algorithm.\nEdges are only processed subject to object direction.\n\n```javascript\nimport pageRank from '@rdfjs/score/pageRank.js'\n\nconst results = pageRank()(ptrs)\n```\n\n### pathDepth()\n\nScores the given terms by the level of the path.\nShorter path depths get scored better than deeper ones. \n\n```javascript\nimport pathDepth from '@rdfjs/score/pathDepth.js'\n\nconst results = pathDepth()(ptrs)\n```\n\n### prioritized(list)\n\nRuns all score functions of the given list and prioritizes the score based on the position of the score function in the array.\nPriorities are used where the first function has the highest priority and the last one the lowest.\n\n```javascript\nimport prioritized from '@rdfjs/score/prioritized.js'\n\nconst results = prioritized([score1, score2])(ptrs)\n```\n\n### product(list)\n\nRuns all score functions of the given list, combines the results with the same term, and scores it with the product of the individual results.\n\n```javascript\nimport product from '@rdfjs/score/product.js'\n\nconst results = product()(ptrs)\n```\n\n### scale({ factor, score })\n\nCalls the given score function and multiplies the score of the results with the given factor.\n\n```javascript\nimport scale from '@rdfjs/score/scale.js'\n\nconst results = scale()(ptrs)\n```\n\n### sort(results)\n\nSorts the given results descending by score (best matches first).\n\n```javascript\nimport sort from '@rdfjs/score/sort.js'\n\nconst sortedResults = sort(results)\n```\n\n### sortObjects({ dataset, objects, score, termCallback })\n\nScores and sorts the given objects, which must have a term attached.\nThe dataset must be given as an argument.\nOptional a `termCallback` function can be given that extracts the term from the object.\nBy default, the term is expected as a property named `term`.\n\n```javascript\nimport sortObjects from '@rdfjs/score/sortObjects.js'\n\nconst sortedObjects = sortObjects({\n  dataset,\n  objects,\n  score,\n  termCallback: object => object.ptr.term\n})\n```\n\n### sum(list)\n\nRuns all score functions of the given list, combines the results with the same term, and scores it with the sum of the individual results.\n\n```javascript\nimport sum from '@rdfjs/score/sum.js'\n\nconst results = sum([score1, score2])(ptrs)\n```\n\n### type(type)\n\nScores all terms that are subjects of a resource with the given type with 1.\n\n```javascript\nimport type from '@rdfjs/score/type.js'\n\nconst results = type(ns.schema.Person)(ptrs)\n```\n","readmeFilename":"README.md"}