Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-indexer
Commits
6326c6be
Commit
6326c6be
authored
2 years ago
by
vlorentz
Committed by
Phabricator Migration user
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MeSoCoRe
parent
42cb3776
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!376
Draft: MeSoCoRe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/_ext/ld_properties.py
+47
-0
47 additions, 0 deletions
docs/_ext/ld_properties.py
docs/conf.py
+6
-0
6 additions, 0 deletions
docs/conf.py
docs/index.rst
+1
-0
1 addition, 0 deletions
docs/index.rst
docs/mesocore.rst
+156
-0
156 additions, 0 deletions
docs/mesocore.rst
with
210 additions
and
0 deletions
docs/_ext/ld_properties.py
0 → 100644
+
47
−
0
View file @
6326c6be
from
typing
import
Any
,
Dict
,
List
,
Tuple
from
docutils.nodes
import
(
Element
,
Node
,
TextElement
,
literal
,
reference
,
system_message
,
)
from
sphinx.util.docutils
import
ReferenceRole
PREFIXES
=
{
"
schema
"
:
"
http://schema.org/
"
,
"
codemeta
"
:
"
https://codemeta.github.io/terms/
"
,
"
forge
"
:
"
https://forgefed.org/vocabulary.html#
"
,
"
as
"
:
"
https://www.w3.org/TR/activitystreams-vocabulary/#
"
,
"
wikidata
"
:
"
http://www.wikidata.org/entity/
"
,
"
mesocore
"
:
"
https://www.softwareheritage.org/schema/2022/mesocore/
"
,
}
class
PropertyRole
(
ReferenceRole
):
def
run
(
self
)
->
Tuple
[
List
[
Node
],
List
[
system_message
]]:
(
prefix
,
local_name
)
=
self
.
target
.
split
(
"
:
"
,
1
)
try
:
namespace
=
PREFIXES
[
prefix
]
except
KeyError
:
msg
=
self
.
inliner
.
reporter
.
error
(
__
(
"
invalid prefix %s
"
)
%
prefix
,
line
=
self
.
lineno
)
prb
=
self
.
inliner
.
problematic
(
self
.
rawtext
,
self
.
rawtext
,
msg
)
return
[
prb
],
[
msg
]
full_name
=
namespace
+
local_name
text
=
literal
(
""
,
self
.
target
)
link
=
reference
(
""
,
""
,
text
,
internal
=
False
,
refuri
=
full_name
,
classes
=
[
"
ld-property
"
]
)
return
[
link
],
[]
def
setup
(
app
:
"
Sphinx
"
)
->
Dict
[
str
,
Any
]:
from
docutils.parsers.rst
import
roles
roles
.
register_local_role
(
"
prop
"
,
PropertyRole
())
This diff is collapsed.
Click to expand it.
docs/conf.py
+
6
−
0
View file @
6326c6be
import
pathlib
import
sys
from
swh.docs.sphinx.conf
import
*
# NoQA
from
swh.docs.sphinx.conf
import
*
# NoQA
sys
.
path
.
append
(
str
(
pathlib
.
Path
(
__file__
).
parent
/
"
_ext
"
))
extensions
+=
[
"
ld_properties
"
]
This diff is collapsed.
Click to expand it.
docs/index.rst
+
1
−
0
View file @
6326c6be
...
@@ -14,6 +14,7 @@ information from archive source code artifacts.
...
@@ -14,6 +14,7 @@ information from archive source code artifacts.
README.md
README.md
dev-info.rst
dev-info.rst
metadata-workflow.rst
metadata-workflow.rst
mesocore.rst
Reference Documentation
Reference Documentation
...
...
This diff is collapsed.
Click to expand it.
docs/mesocore.rst
0 → 100644
+
156
−
0
View file @
6326c6be
Metadata on Social Code Repositories
====================================
MeSoCoRe is a vocabulary which complements ontologies like schema.org/CodeMeta
and DOAP in describing software projects. While the latter are meant to describe
source code projects, MeSoCoRe describes VCS repositories of these projects.
This includes, for example, "stars" and "watchers" on platforms like GitHub, Gitlab,
or Gitea.
The namespace is ``https://www.softwareheritage.org/schema/2022/mesocore/``;
and it is meant to be used primarily in alongside CodeMeta/schema.org
and ForgeFed/ActivityStreams.
The following prefixes are used throughout this document for readability:
.. code-block:: json
{
"schema": "http://schema.org/",
"codemeta": "https://codemeta.github.io/terms/",
"forge": "https://forgefed.org/vocabulary.html#",
"as": "https://www.w3.org/TR/activitystreams-vocabulary/#",
"wikidata": "http://www.wikidata.org/entity/",
"mesocore": "https://www.softwareheritage.org/schema/2022/mesocore/",
}
For example, here is a document using all three together:
.. code-block:: json
{
"@context": {
"as": "https://www.w3.org/ns/activitystreams#",
"codemeta": "https://codemeta.github.io/terms/",
"forge": "https://forgefed.org/ns#",
"mesocore": "https://www.softwareheritage.org/schema/2022/mesocore/",
"schema":"http://schema.org/",
"wikidata": "http://www.wikidata.org/entity/"
},
"@type": "forge:Repository",
"@id": "https://github.com/octocat/linguist",
"schema:name": "Linguist",
"schema:description": "Language Savant",
"codemeta:issueTracker": "https://github.com/octocat/linguist/issues",
"mesocore:vcs": {
"@type": "schema:SoftwareApplication",
"@id": "wikidata:Q186055",
"schema:name": "Git"
},
"mesocore:containsSourceCode": {
"@type": "schema:SoftwareSourceCode",
"schema:name": "Linguist",
"schema:description": "This library is used on GitHub.com to detect blob languages"
},
"as:followers": {
"@type": "as:OrderedCollection",
"as:totalitems": 123
},
"forge:forks": {
"@type": "as:OrderedCollection",
"as:totalItems": 138
},
"forge:forkOf": {
"@type": "forge:Repository",
"@id": "https://github.com/github/linguist",
"schema:name": "Linguist"
}
}
Types
-----
*This section is not normative*
None, MeSoCoRe reuses ``https://forgefed.org/ns#Repository``.
Relation properties
-------------------
Relation properties from other specifications
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*This section is not normative*
The following properties are typically used in MeSoCoRe documents:
* The :prop:`as:followers` property lists actors (typically persons) subscribed
to a repository.
As it is an :prop:`as:OrderedCollection`, its :prop:`as:totalItems` attribute contains
the number of followers, which matches ``watchers_count`` on GitHub and GitLab;
which can also be expressed with :prop:`schema:InteractionCounter`
* :prop:`forge:forkedFrom` and :prop:`forge:forks` properties to describe relationships
between repositories. (:prop:`forge:forks` is also an :prop:`as:OrderedCollection`).
Mirrors
^^^^^^^
TODO
Social properties
-----------------
Social properties from other specifications
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*This section is not normative*
* The :prop:`as:likes` property lists actors (typically persons) who "like"
to a repository.
As it is an :prop:`as:OrderedCollection`, its :prop:`as:totalItems` attribute contains
the number of followers, which matches ``stargazers_count`` on GitHub and
``star_count`` on GitLab;
which can also be expressed with :prop:`schema:InteractionCounter`
.. comment:
* The common concept of star(gazers) and watchers on GitHub/GitLab/Gitea can
be represented using :prop:`schema:InteractionCounter` with types
:prop:`schema:LikeAction` and :prop:`schema:FollowAction` (note that the latter can
also be expressed using :prop:`as:followers`):
TODO: use :prop:`as:likes` instead?
.. code-block:: json
{
"@context": {
"as": "https://www.w3.org/ns/activitystreams#",
"codemeta": "https://codemeta.github.io/terms/",
"forge": "https://forgefed.org/ns#",
"mesocore": "https://www.softwareheritage.org/schema/2022/mesocore/",
"schema":"http://schema.org/",
"wikidata": "http://www.wikidata.org/entity/"
},
"@type": "forge:Repository",
"@id": "https://github.com/octocat/linguist",
"schema:interactionStatistic": [
{
"@type": "schema:InteractionCounter",
"schema:interactionType": "http://schema.org/LikeAction",
"schema:userInteractionCount": 146
},
{
"@type": "schema:InteractionCounter",
"schema:interactionType": "http://schema.org/FollowAction",
"schema:userInteractionCount": 123
},
]
}
Configuration properties
------------------------
Statistics properties
---------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment